You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cloudflare Instrumentation for Queues seems broken #22298
The SDK does automatically instrument queue consumers and producers for Cloudflare Workers when you use withSentry (consumer handlers) and the instrumented env object (producer bindings). The docs page you linked only covers manual spans, which is likely why it feels like automatic instrumentation is missing.
To help figure out why it isn't working for you, could you share:
The version of @sentry/cloudflare you're using.
A minimal snippet of how you're exporting your handler and initializing Sentry.
What you're observing instead of the expected spans (e.g., no queue spans, missing attributes, errors in the console).
A maintainer can take a closer look once there's a repro.
pierre is right, queues are automatically instrumented with the latest version of the SDK. But only if you have them listed as bindings in your wrangler.jsonc
import{Hono}from"hono";import{sentry}from"@sentry/hono/cloudflare";constapp=newHono();app.use(sentry(app,{dsn: "<YOUR_DSN>",dataCollection: {// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:// https://docs.sentry.io/platforms/javascript/guides/hono/configuration/options/#dataCollection// userInfo: false,// httpBodies: [],},}),);// Your routes hereexportdefaultapp;
I will also update the docs to make it a little bit clearer; as queues in general are kinda different to Cloudflare Queues as product.
Btw @JPeer264, I believe at packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.tsgetTraceData() should be appended to each json message so the consumer can continue and create a distributed trace and not just produce queue spans separately.
I'm not sure though if automatically modifying the message is the best here, as it wouldn't apply to all messages but only to json. That seems half baked. But I'll have a closer look on what is the best here.
I think the best the same as we do with context propagation with RPC calls.
btw @arthurfiorette did the instrumentation work with the given documentation? Otherwise I'd close this issue
I created a follow up ticket for trace propagation: #22309
Activity
linear-code commentedon Jul 15, 2026
JS-3056
arthurfiorette commentedon Jul 15, 2026
Sorry if this crosspost is not the right place to ask but I opened it here so that message wouldn't get lost.
sentry-pierre commentedon Jul 15, 2026
The SDK does automatically instrument queue consumers and producers for Cloudflare Workers when you use
withSentry(consumer handlers) and the instrumentedenvobject (producer bindings). The docs page you linked only covers manual spans, which is likely why it feels like automatic instrumentation is missing.To help figure out why it isn't working for you, could you share:
@sentry/cloudflareyou're using.A maintainer can take a closer look once there's a repro.
arthurfiorette commentedon Jul 15, 2026
Maybe this is a docs mismatch then? Documentation states that I need to manually instrument queues and crons .
Do I need to intentionally skip
fetchinstrumentation because when the app is hono it should be a plugin? Hono+Cloudflare docs have nothing about it.Do I need to do something like:
so withSentry doesnt instrument fetch natively and waits for hono specific plugin?
JPeer264 commentedon Jul 15, 2026
Hey @arthurfiorette thanks for the issue.
pierre is right, queues are automatically instrumented with the latest version of the SDK. But only if you have them listed as bindings in your
wrangler.jsoncThe setup for Hono+Cloudflare is listed here: https://docs.sentry.io/platforms/javascript/guides/hono/
I will also update the docs to make it a little bit clearer; as queues in general are kinda different to Cloudflare Queues as product.
arthurfiorette commentedon Jul 15, 2026
Btw @JPeer264, I believe at
packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.tsgetTraceData()should be appended to each json message so the consumer can continue and create a distributed trace and not just produce queue spans separately.JPeer264 commentedon Jul 16, 2026
I'm not sure though if automatically modifying the message is the best here, as it wouldn't apply to all messages but only to json. That seems half baked. But I'll have a closer look on what is the best here.
I think the best the same as we do with context propagation with RPC calls.
btw @arthurfiorette did the instrumentation work with the given documentation? Otherwise I'd close this issue
I created a follow up ticket for trace propagation: #22309
arthurfiorette commentedon Oct 13, 2026
Yes, it worked.