Skip to content

Commit 93b220b

Browse files
committed
Revert some stuff
1 parent 2196b5c commit 93b220b

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

sentry_sdk/integrations/opentelemetry/utils.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,30 @@ def extract_span_data(span):
130130
if db_query:
131131
return span_data_for_db_query(span)
132132

133+
rpc_service = span.attributes.get(SpanAttributes.RPC_SERVICE)
134+
if rpc_service:
135+
return (
136+
span.attributes.get(SentrySpanAttribute.OP) or "rpc",
137+
description,
138+
status,
139+
http_status,
140+
origin,
141+
)
142+
143+
messaging_system = span.attributes.get(SpanAttributes.MESSAGING_SYSTEM)
144+
if messaging_system:
145+
return (
146+
span.attributes.get(SentrySpanAttribute.OP) or "message",
147+
description,
148+
status,
149+
http_status,
150+
origin,
151+
)
152+
153+
faas_trigger = span.attributes.get(SpanAttributes.FAAS_TRIGGER)
154+
if faas_trigger:
155+
return (str(faas_trigger), description, status, http_status, origin)
156+
133157
return (op, description, status, http_status, origin)
134158

135159

sentry_sdk/tracing.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,9 +1653,6 @@ def is_success(self):
16531653

16541654
def finish(self, end_timestamp=None):
16551655
# type: (Optional[Union[float, datetime]]) -> Optional[str]
1656-
if self.status is None:
1657-
self.set_status(SPANSTATUS.OK)
1658-
16591656
if end_timestamp is not None:
16601657
from sentry_sdk.integrations.opentelemetry.utils import (
16611658
convert_to_otel_timestamp,

tests/integrations/celery/test_celery.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,16 @@ def dummy_task(x, y):
221221
assert execution_event["contexts"]["trace"]["status"] == "ok"
222222

223223
assert len(execution_event["spans"]) == 1
224-
assert execution_event["spans"][0] == ApproxDict({
225-
"trace_id": str(root_span.trace_id),
226-
"op": "queue.process",
227-
"description": "dummy_task",
228-
})
224+
assert (
225+
execution_event["spans"][0].items()
226+
>= {
227+
"trace_id": str(transaction.trace_id),
228+
"same_process_as_parent": True,
229+
"op": "queue.process",
230+
"description": "dummy_task",
231+
"data": ApproxDict(),
232+
}.items()
233+
)
229234
assert submission_event["spans"] == [
230235
{
231236
"data": ApproxDict(),
@@ -444,7 +449,7 @@ def walk_dogs(x, y):
444449
walk_dogs, [["Maisey", "Charlie", "Bodhi", "Cory"], "Dog park round trip"], 1
445450
)
446451

447-
sampling_context = traces_sampler.call_args_list[0][0][0]
452+
sampling_context = traces_sampler.call_args_list[1][0][0]
448453
assert sampling_context["celery.job.task"] == "dog_walk"
449454
for i, arg in enumerate(args_kwargs["args"]):
450455
assert sampling_context[f"celery.job.args.{i}"] == str(arg)

0 commit comments

Comments
 (0)