Extract span attrs from RQ job object & fix tests by sentrivana · Pull Request #3786 · getsentry/sentry-python · GitHub
Skip to content

Extract span attrs from RQ job object & fix tests - #3786

Merged
sentrivana merged 9 commits into
potel-basefrom
ivana/potel/custom-sampling-context-rq
Nov 21, 2024
Merged

sentrivana merged 9 commits into
potel-basefrom
ivana/potel/custom-sampling-context-rq

Conversation

@sentrivana

@sentrivana sentrivana commented Nov 15, 2024

Copy link
Copy Markdown
Contributor
  • replace rq_job with some span attrs to populate the sampling context in traces sampler
  • make test_rq pass
  • do not use generic op like message if we already explicitly set op

This is not great since we have to serialize everything (args, kwargs, function to be executed). But it's the best we can do with span attrs.

@sentrivana sentrivana mentioned this pull request Nov 15, 2024
12 tasks
@codecov

codecov Bot commented Nov 15, 2024

Copy link
Copy Markdown

@sentrivana sentrivana changed the title Extract span attrs from RQ job object Extract span attrs from RQ job object & fix tests Nov 21, 2024
@ensure_integration_enabled(RqIntegration, old_perform_job)
def sentry_patched_perform_job(self, job, *args, **kwargs):
# type: (Any, Job, *Queue, **Any) -> bool
def sentry_patched_perform_job(self, job, queue, *args, **kwargs):

@sentrivana sentrivana Nov 21, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked that the signature of perform_job is stable in the minimal supported version and in the current release. There are actually no args and kwargs, just job and queue, but let's do it like this for forwards compat.

@sentrivana
sentrivana marked this pull request as ready for review November 21, 2024 15:28
@sentrivana

Copy link
Copy Markdown
Contributor Author

@sentrivana
sentrivana merged commit 25d311e into potel-base Nov 21, 2024
@sentrivana
sentrivana deleted the ivana/potel/custom-sampling-context-rq branch November 21, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants