Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit 32a30f2

Browse files
authored
Merge pull request #52 from honeycombio/tredman.context-manager-return
[trace] tracer context manager should yield the span object
2 parents ada2ea6 + d7769f5 commit 32a30f2

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

beeline/test_trace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def test_trace_context_manager_starts_span_if_trace_active(self):
6969
tracer.start_span.return_value = mock_span
7070
tracer.finish_span = Mock()
7171

72-
with tracer('foo'):
73-
pass
72+
with tracer('foo') as span:
73+
self.assertEqual(span, mock_span, 'tracer context manager should yield the span')
7474

7575
tracer.start_span.assert_called_once_with(context={'name': 'foo'}, parent_id=None)
7676
tracer.start_trace.assert_not_called()

beeline/trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __call__(self, name, trace_id=None, parent_id=None):
5151
if span:
5252
log('tracer context manager started new trace, id = %s',
5353
span.trace_id)
54-
yield
54+
yield span
5555
except Exception as e:
5656
if span:
5757
span.add_context({

beeline/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '2.4.2'
1+
VERSION = '2.4.3'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
setup(
55
python_requires='>=2.7',
66
name='honeycomb-beeline',
7-
version='2.4.2',
7+
version='2.4.3',
88
description='Honeycomb library for easy instrumentation',
99
url='https://github.com/honeycombio/beeline-python',
1010
author='Honeycomb.io',

0 commit comments

Comments
 (0)