Skip to content

Commit

Permalink
Use Correlations API
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Jul 20, 2020
1 parent 4342236 commit b72fd42
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
from deprecated import deprecated

from opentelemetry import propagators
from opentelemetry.correlationcontext import set_correlation, get_correlation
from opentelemetry.context import Context
from opentelemetry.ext.opentracing_shim import util
from opentelemetry.ext.opentracing_shim.version import __version__
Expand Down Expand Up @@ -273,15 +274,14 @@ def log_event(self, event, payload=None):
def set_baggage_item(self, key, value):
"""Implements the ``set_baggage_item`` method from the base class."""
# pylint: disable=protected-access
copy = self._context._baggage.copy()
copy.update({key: value})

self._context._baggage = Context(copy)
self._context._baggage = set_correlation(
key, value, context=self._context._baggage
)

def get_baggage_item(self, key):
"""Implements the ``get_baggage_item`` method from the base class."""
# pylint: disable=protected-access
return self._context._baggage[key]
return get_correlation(key, context=self._context._baggage)


class ScopeShim(opentracing.Scope):
Expand Down

0 comments on commit b72fd42

Please sign in to comment.