Skip to content

feat: Add BullMQ attributes and metrics - #690

Open
JPeer264 wants to merge 11 commits into
mainfrom
jp/bullmq-attributes
Open

JPeer264 wants to merge 11 commits into
mainfrom
jp/bullmq-attributes

Conversation

@JPeer264

@JPeer264 JPeer264 commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Description

This registers the attributes and metrics that the BullMQ integration of the JavaScript SDK sends (getsentry/sentry-javascript#21777). It also adds the OTel attribute messaging.client.id (the BullMQ Worker ID) and the OTel metric messaging.process.duration (in seconds). The metrics are recommended. The SDK sends them only with enableMetrics: true, and then it sends all of them.

Naming decisions

The keys are the BullMQ names with a messaging. prefix, like messaging.kafka.*, with snake_case where BullMQ separates words with dots (messaging.bullmq.worker.do_not_wait_active). The metrics get the same prefix. bullmq.job.status (BullMQ before 5.81.2) is sent as messaging.bullmq.job.state, its BullMQ 6 name.

The SDK does not send these, so they are not registered: the attributes it maps to messaging.*, the JSON.stringify() attributes (bullmq.job.options, bullmq.queue.options, bullmq.worker.options, bullmq.job.progress), and bullmq.job.finished.timestamp, which BullMQ deprecated for bullmq.job.attempt_finished_timestamp.

Scrubbing decisions

apply_scrubbing is auto for values from user code (messaging.bullmq.job.deduplication.key, messaging.bullmq.job.key) and manual for all others.

PR Checklist

  • I have run yarn test and verified that the tests pass.
  • I have run yarn generate to generate and format code and docs.

If an attribute was added:

  • The attribute is in a namespace (e.g. nextjs.function_id, not function_id)
  • I have used the correct value for apply_scrubbing (i.e. manual or auto. Use never only for values that should never be scrubbed such as IDs)

If an attribute was deprecated:

@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-conventions Ready Ready Preview Oct 21, 2026 1:43pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Attributes

  • Remove next_trace from the sentry.link.type values by s1gr1d in #739
  • Add server_request as a sentry.link.type value by s1gr1d in #738
  • Add LCP and INP subpart attributes by logaretm in #712
  • Add message_origin as a sentry.link.type value by JPeer264 in #724
  • Add aws.lambda.resource_mapping.id attribute by pabloDeputter in #710
  • Add object to the sentry.category values by pabloDeputter in #721
  • Add http.request.duration by loewenheim in #697

Names

  • Add span name rules for rpc spans by pabloDeputter in #714
  • Add queue.publish/create/receive/process/settle to messaging span names by pabloDeputter in #705

Other

  • (descriptions) AWS Lambda function descriptions by pabloDeputter in #720
  • (gen_ai) Add tool call result size attribute by obostjancic in #679
  • (ops) Add object.copy op by pabloDeputter in #706
  • Add BullMQ attributes and metrics by JPeer264 in #690
  • Add view.render op by alexander-alderman-webb in #699

Bug Fixes 🐛

  • (attributes) Apply consistent scrubbing across deprecations by mjq in #692

Documentation 📚

  • (cache) Define cache.ttl for fractional and per-read TTLs by s1gr1d in #726
  • Clarify cache.ttl for 0, no expiry, and reads by s1gr1d in #725

Internal Changes 🔧

Deps

  • Bump nanoid to 3.3.20 by Lms24 in #737
  • Bump vite from 8.2.1 to 8.3.5 by dependabot in #735
  • Bump markdown-it from 15.0.2 to 15.0.3 by dependabot in #736

Other

  • (attributes) Scrub S3 object keys by default by pabloDeputter in #713
  • (repo) Update CODEOWNERS to include @giortzisg by Lms24 in #708
  • Deprecate gen_ai.responses in favor of gen_ai.chat by alexander-alderman-webb in #703
  • Add deprecated messaging ops set by the Python SDK by alexander-alderman-webb in #693
  • Add view.response.render op, deprecated in favor of view.render by alexander-alderman-webb in #700
  • Add event.django op, deprecated in favor of function by alexander-alderman-webb in #698

🤖 This preview updates automatically when you update the PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the jp/bullmq-attributes branch from b2de364 to fc9eb9d Compare October 9, 2026 09:30
@JPeer264 JPeer264 changed the title feat(attributes): Add BullMQ attributes feat: Add BullMQ attributes and metrics Oct 9, 2026
@JPeer264
JPeer264 marked this pull request as ready for review October 9, 2026 10:20
Comment thread javascript/sentry-conventions/src/attributes.ts Outdated
@JPeer264

JPeer264 commented Oct 20, 2026 •

Copy link
Copy Markdown
Member Author

Little update. After discussing with @Lms24 we decided to prefix everything with messaging. this is also true for the metrics. On top, every span attribute that had any object in any form as value was not added, as they need to be stringified - it is easier to add it if needed than removing/adapting to an actual object in case this is being added in the future (the PR description should reflect the latest code changes)

@Lms24 Lms24 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I made a deep pass over the attributes and metrics and unfortunately still found a bunch of inconsistencies. Fully aware that they come from bullmq but I think we should adjust them so that our telemetry model is more consistent.

Sorry for not flagging these earlier! If it helps or there are still open things to discuss, feel free to split up the attributes and metrics part so that these can get merged faster.

Comment thread model/metrics/messaging/messaging__bullmq__job__duration.json Outdated
Comment thread model/attributes/messaging/messaging__bullmq__worker__id.json Outdated
Comment thread model/attributes/messaging/messaging__bullmq__job__status.json Outdated
Comment thread model/attributes/messaging/messaging__bullmq__worker__do__not__wait__active.json Outdated
Comment thread model/attributes/messaging/messaging__bullmq__worker__rate__limit.json Outdated
Comment thread model/attributes/messaging/messaging__bullmq__queue__rate__limit.json Outdated
Comment thread model/attributes/messaging/messaging__bullmq__queue__event__max__length.json Outdated
Comment thread model/attributes/messaging/messaging__bullmq__job__processed__timestamp.json Outdated
Comment thread model/attributes/messaging/messaging__bullmq__job__finished__timestamp.json Outdated
@JPeer264

Copy link
Copy Markdown
Member Author

If it helps or there are still open things to discuss, feel free to split up the attributes and metrics part so that these can get merged faster.

Maybe in the future I'll split these up to keep the PRs smaller and review more efficient, but from my POV I need both anyways, so it's ok to have it in one.

I made a deep pass over the attributes and metrics and unfortunately still found a bunch of inconsistencies. Fully aware that they come from bullmq but I think we should adjust them so that our telemetry model is more consistent.

You brought up amazing points. I addressed all of them, I also checked for other inconsistencies. I just wonder if it would make sense to have these findings somehow in a BUGBOT.md or anything to catch these in the future.

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One last note about requirement level of metrics, but once that's sorted, feel free to merge!

"instrument": "counter",
"unit": "none",
"is_in_otel": false,
"requirement_level": "opt_in",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l: Unfortunately, the requirement_level property here is a bit confusing because we never send metrics by default. Users have to opt into sending auto instrumented metrics, so the requirement level here should be interpreted from the perspective of users having opted in already.

I tried to explain this better here and asked Giannis to clarify this for the metric specs.

So I think this metric, as well as most others in this PR that have no potential of becoming super noisy should rather get level "recommended" instead.

Suggested change
"requirement_level": "opt_in",
"requirement_level": "recommended",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I applied that to all metrics

This branch was successfully deployed

1 active deployment
Preview — bae9d7c3 Deployed Oct 21, 2026 by vercel[bot]
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.

4 participants