Improving Instrumentation for Sidekiq Iteratable Jobs #3313
hannahramadan
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The New Relic Ruby agent team would love to gather feedback on how the agent instruments jobs that use Sidekiq's Iteratable Job feature.
The Current Behavior
Currently, the agent's instrumentation model is optimized for traditional, short-lived jobs. When it encounters a Sidekiq job using iteration, it wraps the entire
performcall in a single transaction.This means a job that iterates over 10,000 records in two hours will appear in New Relic as one two-hour-long transaction. This behavior can:
Potential Solutions
We've been researching this pattern and have come up with some ideas.
Option 1: Instrument Iterations as Segments
We would keep the single transaction for the parent job, but add instrumentation to the
each_iterationhook to create a new span/segment for each iteration.Option 2: Instrument Iterations as Separate, Linked Transactions
This is a two-phase solution to treat iterations as distinct units of work.
Phase 1: We would instrument the
each_iterationhook to begin a new, distinct New Relic transaction for every single iteration.Phase 2: We would enhance Phase 1 by implementing Span Links (an OpenTelemetry concept). This would allow the parent job to create a link to each new iteration transaction it spawns.
We’re Looking for Feedback
We would love to hear from you:
Thank you for helping us improve the Ruby agent!
Beta Was this translation helpful? Give feedback.
All reactions