@sentry/cloudflare: Durable Object RPC methods drop metrics, logs and errors unless the caller propagates a trace
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 63/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- observability
Hướng nghiên cứu
Bắt đầu từ createRpcPrototypeWrapper và so sánh nhánh thiếu metadata của nó với capture-only wrapper của instrumentWorkerEntrypoint và wrapMethodWithSentry. Tái hiện một lệnh gọi RPC bên ngoài từ plain worker trong issue, sau đó xác minh rằng các lệnh gọi không có metadata chạy với một client và isolation scope, flush các metric và lỗi, đồng thời để các lệnh gọi this.method() nội bộ không được bọc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
@sentry/cloudflare: 10.74.0 (same logic ondevelop/11.0.0-beta.2)- DO wrapped with
instrumentDurableObjectWithSentry,enableRpcTracePropagation: true(the only
supported way to instrument RPC methods in v11, now thatinstrumentPrototypeMethodsis 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/distributionreturn early (no client);Sentry.captureExceptionandSentry.logger.*are dropped;- no
rpcspan 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.
- Ngôn ngữ chính
- TypeScript
- Star
- 8.7k
- Fork
- 1.9k
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 576
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry-javascript
-
Browser Bug Next.js Traces Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
getsentry/sentry-javascript#24672 · 1 bình luận ·
-
javascript
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
getsentry/sentry-javascript#24200 · 2 bình luận ·
-
javascript Task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
getsentry/sentry-javascript#24134 · 1 bình luận ·
-
Cloudflare Workers javascript Tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-javascript#24051 · 1 bình luận ·
-
Bug Bun javascript
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
getsentry/sentry-javascript#24045 · 1 bình luận ·
Tất cả issue của getsentry/sentry-javascript
Issue tương tự
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Crush Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
ElementsProject/cln-application#167 · 1 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Quantco/pnpm-licenses#17 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100