Skip to content

test(test-utils): Add fetchSpanAttributes to read span attributes via the sentry CLI - #24514

Merged
JPeer264 merged 1 commit into
developfrom
jp/test-utils-fetch-span-attributes
Sep 29, 2026
Merged

JPeer264 merged 1 commit into
developfrom
jp/test-utils-fetch-span-attributes

Conversation

@JPeer264

@JPeer264 JPeer264 commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

This is helpful for the stacked PR where we add a test for workers-ai

Adds fetchSpanAttributes(traceId, spanId) to @sentry-internal/test-utils/cli, so send-to-sentry E2E tests can assert span attributes and not only the span op.

sentry trace view --json looks like it returns span attributes, but it silently drops all of them for most spans: the trace-items endpoint sends int attribute values as strings, the CLI's schema (0.44.1 and 0.45.0) expects numbers, and a failed schema check only logs Could not fetch details for span. The helper calls the same endpoint through sentry api, which does no schema check. The spawn and credential handling moved into a shared runner so both helpers use the E2E token the same way.

🤖 Generated with Claude Code

@JPeer264
JPeer264 added this pull request to stack #24516 September 18, 2026 18:47
@JPeer264 JPeer264 self-assigned this Sep 18, 2026
@JPeer264
JPeer264 marked this pull request as ready for review September 18, 2026 18:49
Comment thread dev-packages/test-utils/src/cli.ts
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.24 kB - -
@sentry/browser - with treeshaking flags 27.5 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.4 kB - -
@sentry/browser (incl. Tracing) 51.15 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.17 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.18 kB - -
@sentry/browser (incl. Tracing, Replay) 90.76 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.86 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.46 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.41 kB - -
@sentry/browser (incl. Feedback) 46.76 kB - -
@sentry/browser (incl. sendFeedback) 34.3 kB - -
@sentry/browser (incl. FeedbackAsync) 39.41 kB - -
@sentry/browser (incl. Metrics) 30.25 kB - -
@sentry/browser (incl. Logs) 30.51 kB - -
@sentry/browser (incl. Metrics & Logs) 31.18 kB - -
@sentry/react 31 kB - -
@sentry/react (incl. Tracing) 53.45 kB - -
@sentry/vue 36.74 kB - -
@sentry/vue (incl. Tracing) 53.7 kB - -
@sentry/svelte 29.26 kB - -
CDN Bundle 30.93 kB - -
CDN Bundle (incl. Tracing) 51.69 kB - -
CDN Bundle (incl. Logs, Metrics) 33.2 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.92 kB - -
CDN Bundle (incl. Tracing, Replay) 89.28 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.25 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.45 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.42 kB - -
CDN Bundle - uncompressed 91.4 kB - -
CDN Bundle (incl. Tracing) - uncompressed 153.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 159.73 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.54 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 273.5 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 279.44 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.13 kB - -
@sentry/nextjs (client) 55.77 kB - -
@sentry/sveltekit (client) 51.59 kB - -
@sentry/core/server 39.95 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 137.13 kB +0.01% +9 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.8 kB - -
@sentry/node - without tracing 90.73 kB +0.02% +11 B 🔺
@sentry/node - without channel injection 115.5 kB +0.01% +10 B 🔺
@sentry/aws-serverless 99 kB +0.01% +9 B 🔺
@sentry/cloudflare (withSentry) - minified 206.62 kB - -
@sentry/cloudflare (withSentry) 514.02 kB - -

View base workflow run

@github-actions

Copy link
Copy Markdown
Contributor

👋 @mydea, @andreiborza — Please review this PR when you get a chance!

@JPeer264
JPeer264 force-pushed the jp/test-utils-fetch-span-attributes branch from 5420b4c to 4433dfc Compare September 28, 2026 08:00
Comment thread dev-packages/test-utils/src/cli.ts
… the sentry CLI

`sentry trace view --json` drops all attributes of a span when the
trace-items endpoint returns an `int` attribute, because the endpoint sends
those values as strings and the CLI's schema rejects them. Read the
attributes through `sentry api` instead, and share the CLI runner with
fetchTrace.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the jp/test-utils-fetch-span-attributes branch from 4433dfc to 9ac9641 Compare September 28, 2026 09:19
@github-actions

Copy link
Copy Markdown
Contributor

👋 @mydea, @andreiborza — Please review this PR when you get a chance!

@JPeer264
JPeer264 merged commit 841b43d into develop Sep 29, 2026
302 of 303 checks passed
@JPeer264
JPeer264 deleted the jp/test-utils-fetch-span-attributes branch September 29, 2026 11:58
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.

2 participants