Skip to content

Commit d0377c1

Browse files
committed
.
1 parent d4fd755 commit d0377c1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

sentry_sdk/integrations/rq.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,14 @@ def _prepopulate_attributes(job, queue):
193193
if getattr(queue, prop, None) is not None:
194194
attributes[attr] = getattr(queue, prop)
195195

196-
for key in ("args", "kwargs", "func"):
196+
for key in ("args", "kwargs"):
197197
if getattr(job, key, None):
198198
attributes[f"rq.job.{key}"] = _serialize_span_attribute(getattr(job, key))
199199

200+
func = job.func
201+
if callable(func):
202+
func = func.__name__
203+
204+
attributes["rq.job.func"] = _serialize_span_attribute(func)
205+
200206
return attributes

tests/integrations/rq/test_rq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def test_traces_sampler_gets_correct_values_in_sampling_context(sentry_init):
234234
assert sampling_context["messaging.system"] == "rq"
235235
assert sampling_context["rq.job.args"] == ["Bodhi"]
236236
assert sampling_context["rq.job.kwargs"] == '{"trick": "roll over"}'
237-
assert "do_trick" in sampling_context["rq.job.func"]
237+
assert sampling_context["rq.job.func"] == "do_trick"
238238
assert sampling_context["messaging.message.id"]
239239
assert sampling_context["messaging.destination.name"] == "default"
240240

0 commit comments

Comments
 (0)