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 fab74f5bb9a..d550705a512 100644 --- a/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py +++ b/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py @@ -132,27 +132,20 @@ def __init__( endpoint: str = "localhost:55680", credentials: ChannelCredentials = None, metadata: Optional[Tuple[Any]] = None, - compression: str = None, + compression: Compression = Compression.NoCompression, ): super().__init__() self._metadata = metadata self._collector_span_kwargs = None - if compression == "gzip": - self.compression = Compression.Gzip - else: - self.compression = Compression.NoCompression - if credentials is None: self._client = self._stub( - insecure_channel(endpoint, compression=self.compression) + insecure_channel(endpoint, compression=compression) ) else: self._client = self._stub( - secure_channel( - endpoint, credentials, compression=self.compression - ) + secure_channel(endpoint, credentials, compression=compression) ) @abstractmethod 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 4e806ef3f76..efc29c60301 100644 --- a/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py +++ b/exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py @@ -158,19 +158,6 @@ def setUp(self): def tearDown(self): self.server.stop(None) - def test_no_compression(self): - """Test default compression passed to constructor""" - exporter = OTLPSpanExporter() - - self.assertEqual(exporter.compression, Compression.NoCompression) - - def test_gzip_compression(self): - """Test the compression argument passed to constructor.""" - compression = "gzip" - exporter = OTLPSpanExporter(compression=compression) - - self.assertEqual(exporter.compression, Compression.Gzip) - @patch("opentelemetry.exporter.otlp.exporter.expo") @patch("opentelemetry.exporter.otlp.exporter.sleep") def test_unavailable(self, mock_sleep, mock_expo):