diff --git a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py index 98ce560f67e..78339f58081 100644 --- a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py +++ b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py @@ -171,8 +171,8 @@ class OTLPExporterMixin( insecure: Connection type credentials: ChannelCredentials object for server authentication headers: Headers to send when exporting - compression: Compression algorithm to be used in channel timeout: Backend request timeout in seconds + compression: gRPC compression method to use """ def __init__( diff --git a/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py b/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py index b4f8d19a8e1..bcd8b68cabe 100644 --- a/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py +++ b/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py @@ -226,6 +226,17 @@ def test_otlp_headers_from_env(self, mock_ssl_channel, mock_secure): # pylint: disable=no-self-use def test_otlp_compression_from_env(self): + # Just OTEL_EXPORTER_OTLP_COMPRESSION should work + with patch( + "opentelemetry.exporter.otlp.exporter.insecure_channel" + ) as mock_insecure_channel, patch.dict( + "os.environ", {OTEL_EXPORTER_OTLP_COMPRESSION: "deflate"} + ): + OTLPSpanExporter(insecure=True) + mock_insecure_channel.assert_called_once_with( + "localhost:4317", compression=Compression.Deflate + ) + # Specifying kwarg should take precedence over env with patch( "opentelemetry.exporter.otlp.exporter.insecure_channel" @@ -248,17 +259,6 @@ def test_otlp_compression_from_env(self): "localhost:4317", compression=Compression.NoCompression ) - # Just OTEL_EXPORTER_OTLP_COMPRESSION should work - with patch( - "opentelemetry.exporter.otlp.exporter.insecure_channel" - ) as mock_insecure_channel, patch.dict( - "os.environ", {OTEL_EXPORTER_OTLP_COMPRESSION: "deflate"} - ): - OTLPSpanExporter(insecure=True) - mock_insecure_channel.assert_called_once_with( - "localhost:4317", compression=Compression.Deflate - ) - # OTEL_EXPORTER_OTLP_SPAN_COMPRESSION as higher priority than # OTEL_EXPORTER_OTLP_COMPRESSION with patch(