Skip to content

@sentry/cloudflare: Durable Object RPC spans are not linked to Worker request traces #19327

@camhahu

Description

@camhahu

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/cloudflare - hono

SDK Version

10.38.0

Framework Version

Hono 4.10.1, Wrangler 4.55.0

Link to Sentry event

https://enhance-labs.sentry.io/explore/traces/trace/d0a891c5ab8848c5acfd9c802c1f28af

Reproduction Example/SDK Setup

DO Sentry init:

export const MyDO = Sentry.instrumentDurableObjectWithSentry(
  (env: Env) => ({
    dsn: "...",
    tracesSampleRate: 1.0,
    enableLogs: true,
    environment: env.ENVIRONMENT,
    instrumentPrototypeMethods: true,
  }),
  MyDOBase,
);

Worker init options (which calls the DO):

{
    dsn: "...",
    sendDefaultPii: true,
    environment: env.ENVIRONMENT,
    tracesSampleRate: 1.0,
    enableLogs: true,
  }

Steps to Reproduce

  1. Instrument the Worker with withSentry(...) and tracesSampleRate: 1.0.
  2. Instrument the Durable Object with instrumentDurableObjectWithSentry(...), also with tracesSampleRate: 1.0 and instrumentPrototypeMethods: true.
  3. Use the same DSN for both Worker and DO (same behaviour occurs with different DSNs though - using a different DSN in the DO is actually ignored and sends DO traces to the Worker DSN, possibly another bug but not what I'm trying to do so I am not concerned)
  4. In Worker fetch, call a DO RPC method (e.g. stub.rpcPing()), then return a response.
  5. Run locally (wrangler dev) and call the endpoint a few times
  6. In Sentry Traces, inspect:
    • the Worker HTTP transaction/span (http.server won't have child spans for the DO RPC call)
    • the DO RPC spans will all be in a single trace for that DO (for DO lifecycle I assume) (op=rpc)

Expected Result

I would expect RPC methods to behave like DO.fetch in that the worker trace and baggage is propagated/they appear as child spans

Actual Result

Here's a trace for lots of server requests that had DO calls: https://enhance-labs.sentry.io/explore/traces/trace/ce631a8e51d74ba7b5398198b5c92778

Here's the trace where those DO calls ended up: https://enhance-labs.sentry.io/explore/traces/trace/d0a891c5ab8848c5acfd9c802c1f28af/

Additional Context

No response

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions