@@ -355,7 +355,7 @@ def _customize_span_exporter(span_exporter: SpanExporter, resource: Resource) ->
355355 traces_endpoint = os .environ .get (AWS_XRAY_DAEMON_ADDRESS_CONFIG , "127.0.0.1:2000" )
356356 span_exporter = OTLPUdpSpanExporter (endpoint = traces_endpoint )
357357
358- if is_aws_otlp_endpoint (traces_endpoint , "xray" ):
358+ if _is_aws_otlp_endpoint (traces_endpoint , "xray" ):
359359 _logger .info ("Detected using AWS OTLP Traces Endpoint." )
360360
361361 if isinstance (span_exporter , OTLPSpanExporter ):
@@ -379,10 +379,12 @@ def _customize_span_exporter(span_exporter: SpanExporter, resource: Resource) ->
379379def _customize_logs_exporter (log_exporter : LogExporter , resource : Resource ) -> LogExporter :
380380 logs_endpoint = os .environ .get (OTEL_EXPORTER_OTLP_LOGS_ENDPOINT )
381381
382- if is_aws_otlp_endpoint (logs_endpoint , "logs" ):
382+ if _is_aws_otlp_endpoint (logs_endpoint , "logs" ):
383383 _logger .info ("Detected using AWS OTLP Logs Endpoint." )
384384
385- if isinstance (log_exporter , OTLPLogExporter ) and validate_logs_headers ():
385+ if isinstance (log_exporter , OTLPLogExporter ) and _validate_logs_headers ():
386+ # Setting default compression mode to Gzip as this is the behavior in upstream's
387+ # collector otlp http exporter: https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlphttpexporter
386388 return OTLPLogExporter (
387389 endpoint = logs_endpoint ,
388390 compression = Compression .Gzip ,
@@ -517,7 +519,7 @@ def _is_lambda_environment():
517519 return AWS_LAMBDA_FUNCTION_NAME_CONFIG in os .environ
518520
519521
520- def is_aws_otlp_endpoint (otlp_endpoint : str = None , service : str = "xray" ) -> bool :
522+ def _is_aws_otlp_endpoint (otlp_endpoint : str = None , service : str = "xray" ) -> bool :
521523 """Is the given endpoint an AWS OTLP endpoint?"""
522524
523525 pattern = AWS_TRACES_OTLP_ENDPOINT_PATTERN if service == "xray" else AWS_LOGS_OTLP_ENDPOINT_PATTERN
@@ -528,7 +530,7 @@ def is_aws_otlp_endpoint(otlp_endpoint: str = None, service: str = "xray") -> bo
528530 return bool (re .match (pattern , otlp_endpoint .lower ()))
529531
530532
531- def validate_logs_headers () -> bool :
533+ def _validate_logs_headers () -> bool :
532534 """Checks if x-aws-log-group and x-aws-log-stream are present in the headers in order to send logs to
533535 AWS OTLP Logs endpoint."""
534536
0 commit comments