Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] OpenTelemetry - Link job execution to the request which queued it #1342

Open
DanielHeath opened this issue Apr 29, 2024 · 2 comments

Comments

@DanielHeath
Copy link
Contributor

OpenTelemetry can link events which are causally related, and those links are damn useful for diagnosing weird bugs. Sidekiq integrates this nicely.

To support that, I would like to store metadata in a before_enqueue hook, so that I can link the execution of the job to the request that enqueued it (and then e.g. how long it took to run). This is different from serialized_params in that the base job class should handle it.

Storing this on good_jobs as a nullable column should add no storage overhead for users who don't use it, because the null columns bitmap doesn't need to grow to store a 23rd column. I would suggest either metadata as a jsonb column, or links as an array of text.

@bensheldon
Copy link
Owner

This sounds like it could be stored in serialized_params (arbitrary data that's stored at enqueue and only used during perform). Here's an [example](https://github.com/bensheldon/good_job/discussions/901#discussioncomment-5394194) of serializing and deserializing attributes into that hash (they don't have to be passed via set` but can be grabbed via a global or wherever).

I really like OTel, but I don't see a future of adding new db columns that are solution-specific.

@tjefferson08
Copy link

@DanielHeath my application has the behavior you've described, we're using opentelemetry-ruby-contrib's provided instrumentation for ActiveJob configured with the default :link propagation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Inbox
Development

No branches or pull requests

3 participants