Skip to content

Commit d0569b5

Browse files
committed
test
1 parent 9fdc363 commit d0569b5

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"
9696
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"
9797
OTEL_EXPORTER_OTLP_LOGS_HEADERS = "OTEL_EXPORTER_OTLP_LOGS_HEADERS"
98-
CODE_CORRELATION_ENABLED_CONFIG = "OTEL_AWS_CODE_CORRELATION_ENABLED"
98+
OTEL_AWS_ENHANCED_CODE_ATTRIBUTES = "OTEL_AWS_ENHANCED_CODE_ATTRIBUTES"
9999

100100
XRAY_SERVICE = "xray"
101101
LOGS_SERIVCE = "logs"
@@ -473,7 +473,7 @@ def _customize_logs_exporter(log_exporter: LogExporter) -> LogExporter:
473473

474474
def _customize_span_processors(provider: TracerProvider, resource: Resource) -> None:
475475

476-
if get_code_correlation_enabled_status() is True:
476+
if is_enhanced_code_attributes() is True:
477477
# pylint: disable=import-outside-toplevel
478478
from amazon.opentelemetry.distro.code_correlation import CodeAttributesSpanProcessor
479479

@@ -622,32 +622,21 @@ def _is_application_signals_runtime_enabled():
622622
)
623623

624624

625-
def get_code_correlation_enabled_status() -> Optional[bool]:
625+
def is_enhanced_code_attributes() -> bool:
626626
"""
627-
Get the code correlation enabled status from environment variable.
627+
Get the enhanced code attributes enabled status from environment variable.
628628
629629
Returns:
630-
True if OTEL_AWS_CODE_CORRELATION_ENABLED is set to 'true'
631-
False if OTEL_AWS_CODE_CORRELATION_ENABLED is set to 'false'
632-
None if OTEL_AWS_CODE_CORRELATION_ENABLED is not set (default state)
630+
True if OTEL_AWS_ENHANCED_CODE_ATTRIBUTES is set to 'true'
631+
else False
633632
"""
634-
env_value = os.environ.get(CODE_CORRELATION_ENABLED_CONFIG)
635-
636-
if env_value is None:
637-
return None # Default state - environment variable not set
633+
env_value = os.environ.get(OTEL_AWS_ENHANCED_CODE_ATTRIBUTES, "false")
638634

639635
env_value_lower = env_value.strip().lower()
640636
if env_value_lower == "true":
641637
return True
642-
if env_value_lower == "false":
643-
return False
644-
# Invalid value, treat as default and log warning
645-
_logger.warning(
646-
"Invalid value for %s: %s. Expected 'true' or 'false'. Using default.",
647-
CODE_CORRELATION_ENABLED_CONFIG,
648-
env_value,
649-
)
650-
return None
638+
639+
return False
651640

652641

653642
def _is_lambda_environment():
@@ -907,4 +896,4 @@ def _create_aws_otlp_exporter(endpoint: str, service: str, region: str):
907896
# pylint: disable=broad-exception-caught
908897
except Exception as errors:
909898
_logger.error("Failed to create AWS OTLP exporter: %s", errors)
910-
return None
899+
return None

0 commit comments

Comments
 (0)