Skip to content

Commit 4331362

Browse files
authored
Remove the _active flag from POTelSpan (#3470)
1 parent 64cbaff commit 4331362

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

sentry_sdk/tracing.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,6 @@ class POTelSpan:
11941194
def __init__(
11951195
self,
11961196
*,
1197-
active=True, # type: bool
11981197
op=None, # type: Optional[str]
11991198
description=None, # type: Optional[str]
12001199
status=None, # type: Optional[str]
@@ -1221,7 +1220,6 @@ def __init__(
12211220
self._otel_span = tracer.start_span(
12221221
description or op or "", start_time=start_timestamp
12231222
) # XXX
1224-
self._active = active
12251223

12261224
self.origin = origin or DEFAULT_SPAN_ORIGIN
12271225
self.op = op
@@ -1250,19 +1248,17 @@ def __enter__(self):
12501248
# XXX use_span? https://github.com/open-telemetry/opentelemetry-python/blob/3836da8543ce9751051e38a110c0468724042e62/opentelemetry-api/src/opentelemetry/trace/__init__.py#L547
12511249
#
12521250
# create a Context object with parent set as current span
1253-
if self._active:
1254-
ctx = otel_trace.set_span_in_context(self._otel_span)
1255-
# set as the implicit current context
1256-
self._ctx_token = context.attach(ctx)
1251+
ctx = otel_trace.set_span_in_context(self._otel_span)
1252+
# set as the implicit current context
1253+
self._ctx_token = context.attach(ctx)
12571254

12581255
return self
12591256

12601257
def __exit__(self, ty, value, tb):
12611258
# type: (Optional[Any], Optional[Any], Optional[Any]) -> None
12621259
self._otel_span.end()
12631260
# XXX set status to error if unset and an exception occurred?
1264-
if self._active:
1265-
context.detach(self._ctx_token)
1261+
context.detach(self._ctx_token)
12661262

12671263
@property
12681264
def description(self):

0 commit comments

Comments
 (0)