getsentry / getsentry/sentry-javascript

Add trace id in Sentry Event when `tracesSampleRate` is set to 0 in Cloudflare

未关闭
#22,214 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Cloudflare Workers Feature
主要语言
TypeScript
星标
8.7k
派生
1.8k
平均合并
1 天 17 小时
30 天内合并 PR
523

描述

### Problem Statement

A new option called `Tracing` has been added in Cloudflare Wrangler types v5:

```js
export interface Tracing {
enterSpan(
name: string,
callback: (span: Span, ...args: A) => T,
...args: A
): T;
startActiveSpan(
name: string,
callback: (span: Span, ...args: A) => T,
...args: A
): T;
Span: typeof Span;
}
export declare abstract class Span {
get isTraced(): boolean;
setAttribute(key: string, value?: boolean | number | string): void;
end(): void;
}
```

This will be added when tracing has been enabled by the wrangler config. When `tracesSampleRate` is set to 0 the Error triggered from Sentry has no trace id. When there is a trace drain from Cloudflare to Sentry then this error won't be attached properly. It'd work when the Error/Event would have a trace id attached.

### Solution Brainstorm

Based on the the type there is no trace id, so let's see if there is any way to retrieve it, or only Tailworker have access to it (since they have a `SpanContext` attached in their type

### 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.

贡献指南

打开贡献指南

调研方向

The issue does not name files or tests. Start by locating the Cloudflare runtime integration and Sentry event construction, then determine whether the Wrangler tracing APIs expose a trace ID when tracesSampleRate is 0. Done means Cloudflare-drained errors are attached to the corresponding Sentry trace, with coverage for the supported behavior.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
observability-sre
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。