Skip to content

Commit 866fcd5

Browse files
.
1 parent b74bc10 commit 866fcd5

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

  • sentry_sdk/integrations

sentry_sdk/integrations/rq.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ def setup_once() -> None:
6565

6666
@functools.wraps(old_perform_job)
6767
def sentry_patched_perform_job(
68-
self: "Any", job: "Job", *args: "Queue", **kwargs: "Any"
68+
self: "Any", job: "Job", queue: "Queue", *args: "Any", **kwargs: "Any"
6969
) -> bool:
7070
client = sentry_sdk.get_client()
7171
if client.get_integration(RqIntegration) is None:
72-
return old_perform_job(self, job, *args, **kwargs)
72+
return old_perform_job(self, job, queue, *args, **kwargs)
7373

7474
with sentry_sdk.new_scope() as scope:
7575
scope.clear_breadcrumbs()
@@ -93,18 +93,14 @@ def sentry_patched_perform_job(
9393
"sentry.origin": RqIntegration.origin,
9494
"sentry.span.source": SegmentSource.TASK,
9595
SPANDATA.MESSAGING_MESSAGE_ID: job.id,
96+
SPANDATA.MESSAGING_DESTINATION_NAME: queue.name,
9697
},
9798
parent_span=None,
9899
) as span:
99100
if func_name is not None:
100101
span.set_attribute(SPANDATA.CODE_FUNCTION_NAME, func_name)
101102

102-
if args:
103-
span.set_attribute(
104-
SPANDATA.MESSAGING_DESTINATION_NAME, args[0].name
105-
)
106-
107-
rv = old_perform_job(self, job, *args, **kwargs)
103+
rv = old_perform_job(self, job, queue, *args, **kwargs)
108104
else:
109105
transaction = continue_trace(
110106
job.meta.get("_sentry_trace_headers") or {},
@@ -121,12 +117,9 @@ def sentry_patched_perform_job(
121117
transaction,
122118
custom_sampling_context={"rq_job": job},
123119
) as span:
124-
if args:
125-
span.set_data(
126-
SPANDATA.MESSAGING_DESTINATION_NAME, args[0].name
127-
)
120+
span.set_data(SPANDATA.MESSAGING_DESTINATION_NAME, queue.name)
128121

129-
rv = old_perform_job(self, job, *args, **kwargs)
122+
rv = old_perform_job(self, job, queue, *args, **kwargs)
130123

131124
if self.is_horse:
132125
# We're inside of a forked process and RQ is

0 commit comments

Comments
 (0)