Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

@sentry/cloudflare: Durable Object RPC methods drop metrics, logs and errors unless the caller propagates a trace

クローズ
#24,443 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
63/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
observability

調査の方向性

createRpcPrototypeWrapper から始め、そのメタデータがない場合のパスを instrumentWorkerEntrypoint の capture-only wrapper および wrapMethodWithSentry と比較します。issue にある plain worker からの外部 RPC 呼び出しを再現し、そのうえで、メタデータなしの呼び出しが client と isolation scope を使って実行され、メトリクスとエラーが flush され、内部の this.method() 呼び出しがラップされないことを確認します。

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

説明

Cloudflare Workers
Environment
  • @sentry/cloudflare: 10.74.0 (same logic on develop / 11.0.0-beta.2)
  • DO wrapped with instrumentDurableObjectWithSentry, enableRpcTracePropagation: true (the only
    supported way to instrument RPC methods in v11, now that instrumentPrototypeMethods is removed)
Description

createRpcPrototypeWrapper only calls wrapMethodWithSentry when the last argument carries
__sentry_rpc_meta__. Otherwise the original method runs with no client bound. Then:

  • Sentry.metrics.count/gauge/distribution return early (no client);
  • Sentry.captureException and Sentry.logger.* are dropped;
  • no rpc span is recorded, and a thrown error is not captured.

Callers send the metadata only if they are Sentry-instrumented, have an active trace, and got the stub
through get/getByName on the instrumented env (see #24442). Common cases that lose everything:

  • calls from uninstrumented workers or mixed deployments;
  • calls from code running outside the request's async context;
  • any call through jurisdiction().

WorkerEntrypoint already covers this case: instrumentWorkerEntrypoint uses a capture-only wrapper
when the metadata is missing. Durable Objects have no equivalent. fetch, alarm and webSocket* are
always wrapped, so only RPC is affected. That makes the gap easy to miss: our production data had
14 days of DO alarm spans and zero DO rpc spans.

Reproduction
class MyDO extends DurableObject {
  async ping() {
    Sentry.metrics.count('my_do.ping', 1);
    throw new Error('boom');
  }
}
export const MyDOInstrumented = Sentry.instrumentDurableObjectWithSentry(
  env => ({ dsn: env.SENTRY_DSN, tracesSampleRate: 1, enableRpcTracePropagation: true }),
  MyDO,
);
// From a plain (uninstrumented) worker:
await env.MY_DO.get(env.MY_DO.idFromName('x')).ping();

Neither the metric nor the error reaches Sentry.

Expected

External RPC calls without metadata still run inside a client and isolation scope with flush, as
WorkerEntrypoint does. Internal this.method() calls stay unwrapped.

Proposed fix

A PR with this change will follow.

主要言語
TypeScript
スター
8.7k
フォーク
1.9k
平均マージ
1日 16時間
マージ済み PR(30日)
576

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-javascript のほかの issue

getsentry/sentry-javascript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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