Skip to content

test(cloudflare): Port the tracing suites to span streaming - #24179

Draft
JPeer264 wants to merge 1 commit into
jp/cf-int-tests-span-helpersfrom
jp/cf-int-tests-tracing-streaming
Draft

test(cloudflare): Port the tracing suites to span streaming#24179
JPeer264 wants to merge 1 commit into
jp/cf-int-tests-span-helpersfrom
jp/cf-int-tests-tracing-streaming

Conversation

@JPeer264

@JPeer264 JPeer264 commented Sep 7, 2026

Copy link
Copy Markdown
Member

This PR ports the suites/tracing suites of cloudflare-integration-tests to span streaming. It removes the traceLifecycle: 'static' pin from each suite, and rewrites the assertions from transaction envelopes to span v2. 23 suites, 38 tests. The twelve tracing/propagation suites are in the PR stacked on this one.

tracing/d1 also loses its env-gated STREAMED switch and the static copy of its test, so one test now covers the streamed behaviour.

What the runs showed

Three behaviours shaped the rewrite, and each one is worth knowing before the next package is ported.

A url source segment span keeps the method only. GET /error becomes GET. Those suites now assert GET and read the route from the url.path attribute. Suites on a route source, such as /, keep the full GET / name.

The segment span can arrive in a later envelope than its children, because it ends last. opentelemetry-tracer/internal-request-handler failed on exactly that, and now uses collectStreamedSpansUntilSegment.

Start timestamps tie at millisecond resolution in workerd, so an order-based assertion over child spans is unreliable. opentelemetry-tracer/enabled matches spans by name instead of sorting them.

Two shapes for multi-isolate traces

A worker and a Durable Object each stream their own envelope for the same trace. A suite therefore has to choose how to read them.

instrument-fetcher and the Durable Object storage suites use collectStreamedSpans, which groups by trace and resolves once the whole trace is in hand. These are the first callers of the helper added in the base PR. They also exercise the observe-not-consume behaviour, because durableobject-sql and durableobject-sync-kv collect spans while a flush-marker error envelope still matches an ordered expectation.

The other suites keep one envelope expectation per isolate with .unordered(), which stays closer to the shape they already had and keeps the diff readable.

Part of #24147

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.8 kB - -
@sentry/browser - with treeshaking flags 27.11 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27 kB - -
@sentry/browser (incl. Tracing) 49.22 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 49.22 kB - -
@sentry/browser (incl. Tracing, Profiling) 52.12 kB - -
@sentry/browser (incl. Tracing, Replay) 88.76 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.95 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.44 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106.37 kB - -
@sentry/browser (incl. Feedback) 46.3 kB - -
@sentry/browser (incl. sendFeedback) 33.86 kB - -
@sentry/browser (incl. FeedbackAsync) 38.97 kB - -
@sentry/browser (incl. Metrics) 29.82 kB - -
@sentry/browser (incl. Logs) 30.09 kB - -
@sentry/browser (incl. Metrics & Logs) 30.75 kB - -
@sentry/react 30.55 kB - -
@sentry/react (incl. Tracing) 51.56 kB - -
@sentry/vue 36.05 kB - -
@sentry/vue (incl. Tracing) 51.48 kB - -
@sentry/svelte 28.83 kB - -
CDN Bundle 30.55 kB - -
CDN Bundle (incl. Tracing) 49.74 kB - -
CDN Bundle (incl. Logs, Metrics) 32.82 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.7 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.48 kB - -
CDN Bundle (incl. Tracing, Replay) 87.29 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.18 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 93.22 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.21 kB - -
CDN Bundle - uncompressed 90.46 kB - -
CDN Bundle (incl. Tracing) - uncompressed 148.17 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.03 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 154.14 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.29 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.76 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.71 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.46 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 287.4 kB - -
@sentry/nextjs (client) 54.03 kB - -
@sentry/sveltekit (client) 49.65 kB - -
@sentry/core/server 36.99 kB - -
@sentry/core/browser 13.55 kB - -
@sentry/node 127.63 kB +0.02% +21 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.58 kB - -
@sentry/node - without tracing 88.71 kB +0.03% +21 B 🔺
@sentry/node - without channel injection 106.9 kB +0.02% +18 B 🔺
@sentry/aws-serverless 97.09 kB +0.03% +24 B 🔺
@sentry/cloudflare (withSentry) - minified 201.95 kB - -
@sentry/cloudflare (withSentry) 502.67 kB - -

View base workflow run

@JPeer264
JPeer264 force-pushed the jp/cf-int-tests-tracing-streaming branch from 141f36a to 8d1812d Compare September 7, 2026 14:41
@JPeer264
JPeer264 force-pushed the jp/cf-int-tests-tracing-streaming branch from 8d1812d to 84b3d56 Compare September 7, 2026 15:19
@JPeer264
JPeer264 force-pushed the jp/cf-int-tests-tracing-streaming branch 2 times, most recently from ac2aec2 to 2f07f77 Compare September 7, 2026 15:49
Removes the `traceLifecycle: 'static'` pin from the `suites/tracing` suites, and
rewrites the assertions from transaction envelopes to span v2. The
`tracing/propagation` suites follow in a separate PR. `tracing/d1` also loses its
env-gated `STREAMED` switch and the static copy of its test, so one test now
covers the streamed behaviour.

Most suites keep the shape they had, and only the assertions change: a span
carries its name in `name` rather than `description`, its op and origin as
attributes rather than fields, and every attribute as a `{ type, value }` pair.

The gen_ai suites keep asserting the complete attribute set, so an unexpected
attribute still fails the test. Streaming adds six attributes to every span:
`sentry.trace_lifecycle`, `sentry.segment.name`, `sentry.segment.id`,
`sentry.sdk.name`, `sentry.sdk.version` and `sentry.environment`.

The runs surfaced three behaviours that shape the rewrite.

A `url` source segment span keeps the method only. `GET /error` becomes `GET`,
so those suites assert `GET` and read the route from the `url.path` attribute.

The segment span can arrive in a later envelope than its children, because it
ends last. `opentelemetry-tracer/internal-request-handler` failed on that, and
now uses `collectStreamedSpansUntilSegment`.

Start timestamps tie at millisecond resolution in workerd, so an order-based
assertion over child spans is unreliable. `opentelemetry-tracer/enabled` matches
spans by name instead.

`instrument-fetcher` uses `collectStreamedSpans`, because the worker and the
Durable Object stream their segment spans from separate isolates. The Durable
Object storage suites keep a single envelope expectation, because their spans do
arrive together.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant