Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename BaggagePropagator to W3CBaggagePropagator #1663

Merged
merged 4 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1656])(https://github.com/open-telemetry/opentelemetry-python/pull/1656)
- Rename `DefaultSpan` to `NonRecordingSpan`
([#1661])(https://github.com/open-telemetry/opentelemetry-python/pull/1661)

- Rename `BaggagePropagator` to `W3CBaggagePropagator`
([#1666])(https://github.com/open-telemetry/opentelemetry-python/pull/1666)
codeboten marked this conversation as resolved.
Show resolved Hide resolved
## [0.18b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.18b0) - 2021-02-16

### Added
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-api/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
from opentelemetry.trace.propagation import textmap


class BaggagePropagator(textmap.TextMapPropagator):
"""Extracts and injects Baggage which is used to annotate telemetry.
"""
class W3CBaggagePropagator(textmap.TextMapPropagator):
"""Extracts and injects Baggage which is used to annotate telemetry."""

MAX_HEADER_LENGTH = 8192
MAX_PAIR_LENGTH = 4096
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down
12 changes: 6 additions & 6 deletions opentelemetry-api/tests/baggage/test_baggage_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.trace.propagation.textmap import DictGetter

Expand All @@ -25,7 +25,7 @@

class TestBaggagePropagation(unittest.TestCase):
def setUp(self):
self.propagator = BaggagePropagator()
self.propagator = W3CBaggagePropagator()

def _extract(self, header_value):
"""Test helper"""
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions opentelemetry-api/tests/propagators/test_propagators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down