Skip to content

feat(browser): Replace element timing spans with metrics#19869

Draft
logaretm wants to merge 2 commits intodevelopfrom
awad/js-1678-element-timing-metrics-integration
Draft

feat(browser): Replace element timing spans with metrics#19869
logaretm wants to merge 2 commits intodevelopfrom
awad/js-1678-element-timing-metrics-integration

Conversation

@logaretm
Copy link
Member

@logaretm logaretm commented Mar 19, 2026

Removes element timing span creation from browserTracingIntegration (deprecates enableElementTiming option, introduces a new standalone elementTimingIntegration that emits Element Timing API data as Sentry distribution metrics instead of spans.

Emits element_timing.render_time and element_timing.load_time metrics with element.identifier and element.paint_type attributes. I believe users can query by the element identifier if they are interested in metrics for a specific element.

Me and Lukas think this is a safe change because it was never documented, even then I made sure to export NO-OP replacement functions to stub them out.

Reasoning for the change

Element Timing values (renderTime, loadTime) are point-in-time timestamps, not durations. Modeling them as spans required awkward workarounds (zero-duration spans, arbitrary start times) that didn't produce meaningful trace data. Metrics are the correct abstraction here.

See discussion in #19261 for full context.

Usage

Sentry.init({
  integrations: [
    Sentry.browserTracingIntegration(),
    Sentry.elementTimingIntegration(),
  ],
});

closes #19260

…ne integration

Remove element timing span creation from browserTracingIntegration and
introduce a new elementTimingIntegration that emits Element Timing API
data as Sentry distribution metrics instead of spans.

Element timing values (renderTime, loadTime) are point-in-time timestamps,
not durations, making metrics a better fit than spans. The new integration
emits `element_timing.render_time` and `element_timing.load_time` metrics
with `element.identifier` and `element.paint_type` attributes.

refs JS-1678

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@linear-code
Copy link

linear-code bot commented Mar 19, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (browser) Replace element timing spans with metrics by logaretm in #19869
  • (remix) Server Timing Headers Trace Propagation by onurtemizkan in #18653

Bug Fixes 🐛

Deps

  • Bump devalue 5.6.3 to 5.6.4 to fix CVE-2026-30226 by chargome in #19849
  • Bump file-type to 21.3.2 and @nestjs/common to 11.1.17 by chargome in #19847
  • Bump unhead 2.1.4 to 2.1.12 to fix CVE-2026-31860 and CVE-2026-31873 by chargome in #19848
  • Bump flatted 3.3.1 to 3.4.2 to fix CVE-2026-32141 by chargome in #19842
  • Bump tar 7.5.10 to 7.5.11 to fix CVE-2026-31802 by chargome in #19846
  • Bump hono 4.12.5 to 4.12.7 in cloudflare-hono E2E test app by chargome in #19850
  • Bump undici 6.23.0 to 6.24.1 to fix multiple CVEs by chargome in #19841

Other

  • (deno) Clear pre-existing OTel global before registering TracerProvider by sergical in #19723
  • (node-core) Recycle propagationContext for each request by Lms24 in #19835

Internal Changes 🔧

  • (deps) Bump next from 16.1.5 to 16.1.7 in /dev-packages/e2e-tests/test-applications/nextjs-16 by dependabot in #19851
  • (react) Add gql tests for react router by chargome in #19844
  • (release) Switch from action-prepare-release to Craft by BYK in #18763

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.64 kB - -
@sentry/browser - with treeshaking flags 24.14 kB - -
@sentry/browser (incl. Tracing) 42.09 kB -1.24% -528 B 🔽
@sentry/browser (incl. Tracing, Profiling) 46.69 kB -1.26% -592 B 🔽
@sentry/browser (incl. Tracing, Replay) 80.87 kB -0.68% -550 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.47 kB -0.74% -524 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 85.57 kB -0.65% -552 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 97.85 kB -0.54% -522 B 🔽
@sentry/browser (incl. Feedback) 42.45 kB - -
@sentry/browser (incl. sendFeedback) 30.31 kB - -
@sentry/browser (incl. FeedbackAsync) 35.36 kB - -
@sentry/browser (incl. Metrics) 26.92 kB - -
@sentry/browser (incl. Logs) 27.07 kB - -
@sentry/browser (incl. Metrics & Logs) 27.74 kB - -
@sentry/react 27.39 kB - -
@sentry/react (incl. Tracing) 44.4 kB -1.24% -555 B 🔽
@sentry/vue 30.08 kB - -
@sentry/vue (incl. Tracing) 43.98 kB -1.14% -505 B 🔽
@sentry/svelte 25.66 kB - -
CDN Bundle 28.28 kB - -
CDN Bundle (incl. Tracing) 43.02 kB -1.12% -485 B 🔽
CDN Bundle (incl. Logs, Metrics) 29.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 43.87 kB -1.1% -486 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 68.21 kB - -
CDN Bundle (incl. Tracing, Replay) 79.87 kB -0.58% -465 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 80.76 kB -0.58% -471 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 85.39 kB -0.56% -480 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.3 kB -0.54% -465 B 🔽
CDN Bundle - uncompressed 82.62 kB - -
CDN Bundle (incl. Tracing) - uncompressed 127.62 kB -0.74% -939 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.49 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 130.49 kB -0.72% -939 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.12 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 244.47 kB -0.39% -939 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 247.33 kB -0.38% -939 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 257.38 kB -0.37% -939 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 260.23 kB -0.36% -939 B 🔽
@sentry/nextjs (client) 46.81 kB -1.19% -561 B 🔽
@sentry/sveltekit (client) 42.55 kB -1.22% -522 B 🔽
@sentry/node-core 56.38 kB +0.06% +31 B 🔺
@sentry/node 173.19 kB +0.02% +31 B 🔺
@sentry/node - without tracing 96.37 kB +0.03% +28 B 🔺
@sentry/aws-serverless 113.37 kB +0.03% +30 B 🔺

View base workflow run

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.

ElementTiming span timestamp uses render time

1 participant