getsentry / getsentry/sentry-javascript

@sentry/cloudflare: stubs from namespace.jurisdiction() bypass Durable Object instrumentation

クローズ 初心者向け
#24,442 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
Bug Cloudflare Workers Spans
主要言語
TypeScript
スター
8.7k
フォーク
1.8k
平均マージ
1日 17時間
マージ済み PR(30日)
523

説明

### Environment
- `@sentry/cloudflare`: 10.74.0 (also present on `develop` and `11.0.0-beta.2`)
- Caller wrapped with `Sentry.withSentry()`, `enableRpcTracePropagation: true`
- Durable Object namespace restricted to a jurisdiction (`env.MY_DO.jurisdiction('eu')`)

### Description
`instrumentDurableObjectNamespace` wraps `get` and `getByName` so the returned stub gets fetch spans and
RPC trace propagation. Every other function on the namespace, including `jurisdiction`, goes through
`value.bind(target)`, so a jurisdiction-restricted namespace is the raw binding. Stubs from it get
no fetch span and never append `__sentry_rpc_meta__`.

That applies to every Durable Object call from an app that uses data-location jurisdictions (for
example EU residency). The traces break at the Durable Object boundary. Combined with the receiver-side gap in #24443, the receiver
also loses all of its telemetry.

### Reproduction
```ts
const ns = env.MY_DO.jurisdiction('eu');
const stub = ns.get(ns.idFromName('x'));
await stub.someRpcMethod('a'); // receiver sees no __sentry_rpc_meta__; no caller-side span
```
Compare with `env.MY_DO.get(env.MY_DO.idFromName('x'))`, which does propagate.

### Expected
`jurisdiction()` returns a namespace instrumented the same way, i.e.
`instrumentDurableObjectNamespace(value.apply(target, args), propagateRpcTrace)`.

### Code
`packages/cloudflare/src/instrumentations/instrumentDurableObjectNamespace.ts`: the `get` trap only
special-cases `get`/`getByName`.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start in packages/cloudflare/src/instrumentations/instrumentDurableObjectNamespace.ts, where the get trap currently special-cases get and getByName. Trace how other namespace functions are bound, then verify that jurisdiction() returns a recursively instrumented namespace with RPC trace propagation. Done means stubs obtained through a jurisdiction-restricted namespace produce the same fetch spans and __sentry_rpc_meta__ behavior as direct namespace calls.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
observability
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
86/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。