diff --git a/CHANGELOG.md b/CHANGELOG.md index cfea0a571cd..f257ced33a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Moving `Getter`, `Setter` and `TextMapPropagator` out of `opentelemetry.trace.propagation` and into `opentelemetry.propagators` ([#1662])(https://github.com/open-telemetry/opentelemetry-python/pull/1662) +- Rename `BaggagePropagator` to `W3CBaggagePropagator` + ([#1663])(https://github.com/open-telemetry/opentelemetry-python/pull/1663) ## [0.18b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.18b0) - 2021-02-16 diff --git a/opentelemetry-api/setup.cfg b/opentelemetry-api/setup.cfg index d3cbe4ddf23..332069041ce 100644 --- a/opentelemetry-api/setup.cfg +++ b/opentelemetry-api/setup.cfg @@ -54,7 +54,7 @@ opentelemetry_tracer_provider = default_tracer_provider = opentelemetry.trace:DefaultTracerProvider opentelemetry_propagator = tracecontext = opentelemetry.trace.propagation.tracecontext:TraceContextTextMapPropagator - baggage = opentelemetry.baggage.propagation:BaggagePropagator + baggage = opentelemetry.baggage.propagation:W3CBaggagePropagator [options.extras_require] test = diff --git a/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py b/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py index 9c68357a7c9..e59df9d2859 100644 --- a/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py +++ b/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py @@ -21,7 +21,7 @@ from opentelemetry.propagators import textmap -class BaggagePropagator(textmap.TextMapPropagator): +class W3CBaggagePropagator(textmap.TextMapPropagator): """Extracts and injects Baggage which is used to annotate telemetry.""" MAX_HEADER_LENGTH = 8192 diff --git a/opentelemetry-api/src/opentelemetry/propagate/__init__.py b/opentelemetry-api/src/opentelemetry/propagate/__init__.py index 77d09b9a9f2..44f9897a532 100644 --- a/opentelemetry-api/src/opentelemetry/propagate/__init__.py +++ b/opentelemetry-api/src/opentelemetry/propagate/__init__.py @@ -25,7 +25,7 @@ ``opentelemetry.propagators.composite.CompositeHTTPPropagator`` with 2 propagators, one of type ``opentelemetry.trace.propagation.tracecontext.TraceContextTextMapPropagator`` -and other of type ``opentelemetry.baggage.propagation.BaggagePropagator``. +and other of type ``opentelemetry.baggage.propagation.W3CBaggagePropagator``. Notice that these propagator classes are defined as ``opentelemetry_propagator`` entry points in the ``setup.cfg`` file of ``opentelemetry``. diff --git a/opentelemetry-api/tests/baggage/test_baggage_propagation.py b/opentelemetry-api/tests/baggage/test_baggage_propagation.py index 719e8d91e3e..954bc1aba76 100644 --- a/opentelemetry-api/tests/baggage/test_baggage_propagation.py +++ b/opentelemetry-api/tests/baggage/test_baggage_propagation.py @@ -16,7 +16,7 @@ from unittest.mock import Mock, patch from opentelemetry import baggage -from opentelemetry.baggage.propagation import BaggagePropagator +from opentelemetry.baggage.propagation import W3CBaggagePropagator from opentelemetry.context import get_current from opentelemetry.propagators.textmap import DictGetter @@ -25,7 +25,7 @@ class TestBaggagePropagation(unittest.TestCase): def setUp(self): - self.propagator = BaggagePropagator() + self.propagator = W3CBaggagePropagator() def _extract(self, header_value): """Test helper""" @@ -87,7 +87,7 @@ def test_invalid_header(self): self.assertEqual(self._extract(header), expected) def test_header_too_long(self): - long_value = "s" * (BaggagePropagator.MAX_HEADER_LENGTH + 1) + long_value = "s" * (W3CBaggagePropagator.MAX_HEADER_LENGTH + 1) header = "key1={}".format(long_value) expected = {} self.assertEqual(self._extract(header), expected) @@ -96,15 +96,15 @@ def test_header_contains_too_many_entries(self): header = ",".join( [ "key{}=val".format(k) - for k in range(BaggagePropagator.MAX_PAIRS + 1) + for k in range(W3CBaggagePropagator.MAX_PAIRS + 1) ] ) self.assertEqual( - len(self._extract(header)), BaggagePropagator.MAX_PAIRS + len(self._extract(header)), W3CBaggagePropagator.MAX_PAIRS ) def test_header_contains_pair_too_long(self): - long_value = "s" * (BaggagePropagator.MAX_PAIR_LENGTH + 1) + long_value = "s" * (W3CBaggagePropagator.MAX_PAIR_LENGTH + 1) header = "key1=value1,key2={},key3=value3".format(long_value) expected = {"key1": "value1", "key3": "value3"} self.assertEqual(self._extract(header), expected) diff --git a/opentelemetry-api/tests/propagators/test_propagators.py b/opentelemetry-api/tests/propagators/test_propagators.py index 5e2abaed1a4..1ea80146ef8 100644 --- a/opentelemetry-api/tests/propagators/test_propagators.py +++ b/opentelemetry-api/tests/propagators/test_propagators.py @@ -17,7 +17,7 @@ from unittest import TestCase from unittest.mock import Mock, patch -from opentelemetry.baggage.propagation import BaggagePropagator +from opentelemetry.baggage.propagation import W3CBaggagePropagator from opentelemetry.environment_variables import OTEL_PROPAGATORS from opentelemetry.trace.propagation.tracecontext import ( TraceContextTextMapPropagator, @@ -33,7 +33,8 @@ def test_propagators(propagators): self.assertEqual(len(propagators), 2) self.assertEqual( - propagators, {TraceContextTextMapPropagator, BaggagePropagator} + propagators, + {TraceContextTextMapPropagator, W3CBaggagePropagator}, ) mock_compositehttppropagator.configure_mock(