Only create Cloudflare storage and D1 db spans when there is a parent span

Open Beginner friendly
#25,804 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@nicohrubec is already working on this.

Since Oct 29, 2026.

  • #25860 by @lazerg — closed without merging
  • #25879 by @nicohrubec — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Read the five named instrumentation files and locate their startSpan calls. Add onlyIfParent: true to those calls, then inspect the existing Cloudflare instrumentation tests and add a test showing that an operation without an active span creates no span. Done when all five instrumentations skip creating spans without a parent and the test passes.

Written by the indexing model from the issue text.

Description

Cloudflare Workers Improvement Spans

The Cloudflare D1, KV, Durable Object storage and SqlStorage instrumentations create db spans when there is no active span. Each of these spans becomes its own root span and has no context.

Pass onlyIfParent: true to the startSpan calls in:

  • packages/cloudflare/src/instrumentations/worker/instrumentD1.ts
  • packages/cloudflare/src/instrumentations/worker/instrumentKV.ts
  • packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts
  • packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts
  • packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts

Add a test that checks that an operation without an active span creates no span.

Dominant language
TypeScript
Stars
8.8k
Forks
1.9k
Avg merge
1d 21h
Merged PRs (30d)
637

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/sentry-javascript

All issues in getsentry/sentry-javascript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.