Skip to content

Commit 7eab1e8

Browse files
committed
Return EntryValue from get_entry_value.
1 parent 23ea35d commit 7eab1e8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

opentelemetry-api/src/opentelemetry/distributedcontext/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,14 @@ def get_entries(self) -> typing.Iterable[Entry]:
8787
def get_entry_value(
8888
self,
8989
key: EntryKey
90-
) -> typing.Optional[Entry]:
90+
) -> typing.Optional[EntryValue]:
9191
"""Returns the entry associated with a key or None
9292
9393
Args:
9494
key: the key with which to perform a lookup
9595
"""
96-
return self._container.get(key)
96+
if key in self._container:
97+
return self._container[key].value
9798

9899

99100
class DistributedContextManager:

opentelemetry-api/tests/distributedcontext/test_distributed_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_get_entry_value_present(self):
8383
value = self.context.get_entry_value(
8484
self.entry.key,
8585
)
86-
self.assertIs(value, self.entry)
86+
self.assertIs(value, self.entry.value)
8787

8888
def test_get_entry_value_missing(self):
8989
key = distributedcontext.EntryKey("missing")

0 commit comments

Comments
 (0)