@@ -406,7 +406,7 @@ def _customize_span_exporter(span_exporter: SpanExporter, resource: Resource) ->
406
406
return _create_aws_otlp_exporter (endpoint = endpoint , service = XRAY_SERVICE , region = region )
407
407
408
408
_logger .warning (
409
- "Improper configuration see : please export/set "
409
+ "Improper configuration: please export/set "
410
410
"OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf and OTEL_TRACES_EXPORTER=otlp"
411
411
)
412
412
@@ -438,15 +438,22 @@ def _customize_logs_exporter(log_exporter: LogExporter) -> LogExporter:
438
438
439
439
_logger .info ("Detected using AWS OTLP Logs Endpoint." )
440
440
441
- if isinstance (log_exporter , OTLPLogExporter ) and _validate_and_fetch_logs_header ().is_valid :
442
- endpoint , region = _extract_endpoint_and_region_from_otlp_endpoint (logs_endpoint )
443
- # Setting default compression mode to Gzip as this is the behavior in upstream's
444
- # collector otlp http exporter:
445
- # https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlphttpexporter
446
- return _create_aws_otlp_exporter (endpoint = endpoint , service = LOGS_SERIVCE , region = region )
441
+ if isinstance (log_exporter , OTLPLogExporter ):
442
+
443
+ if _validate_and_fetch_logs_header ().is_valid :
444
+ endpoint , region = _extract_endpoint_and_region_from_otlp_endpoint (logs_endpoint )
445
+ # Setting default compression mode to Gzip as this is the behavior in upstream's
446
+ # collector otlp http exporter:
447
+ # https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlphttpexporter
448
+ return _create_aws_otlp_exporter (endpoint = endpoint , service = LOGS_SERIVCE , region = region )
449
+
450
+ _logger .warning (
451
+ "Improper configuration: Please configure the environment variable OTEL_EXPORTER_OTLP_LOGS_HEADERS "
452
+ "to have values for x-aws-log-group and x-aws-log-stream"
453
+ )
447
454
448
455
_logger .warning (
449
- "Improper configuration see : please export/set "
456
+ "Improper configuration: please export/set "
450
457
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf and OTEL_LOGS_EXPORTER=otlp"
451
458
)
452
459
@@ -651,12 +658,6 @@ def _validate_and_fetch_logs_header() -> OtlpLogHeaderSetting:
651
658
652
659
is_valid = log_group is not None and log_stream is not None
653
660
654
- if not is_valid :
655
- _logger .warning (
656
- "Improper configuration: Please configure the environment variable OTEL_EXPORTER_OTLP_LOGS_HEADERS "
657
- "to have values for x-aws-log-group and x-aws-log-stream"
658
- )
659
-
660
661
return OtlpLogHeaderSetting (log_group , log_stream , namespace , is_valid )
661
662
662
663
0 commit comments