Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Fechada
#24,443 2 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
63/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
observability

Direção de pesquisa

Comece em createRpcPrototypeWrapper e compare seu caminho de metadados ausentes com o wrapper somente de captura de instrumentWorkerEntrypoint e wrapMethodWithSentry. Reproduza uma chamada RPC externa a partir do plain worker na issue e, em seguida, verifique se as chamadas sem metadados são executadas com um client e um isolation scope, fazem flush das métricas e dos erros e deixam as chamadas internas a this.method() sem wrapper.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
8.7k
Forks
1.9k
Merge médio
1d 16h
PRs com merge (30d)
576

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de getsentry/sentry-javascript

Todas as issues de getsentry/sentry-javascript

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.