Skip to content

fix(core): Use trace_metric data category for metrics rate limits and client reports - #25606

Merged
Lms24 merged 1 commit into
developfrom
fix/trace-metric-data-category
Oct 21, 2026
Merged

Lms24 merged 1 commit into
developfrom
fix/trace-metric-data-category

Conversation

@Lms24

@Lms24 Lms24 commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

This PR changes the data category for metrics from metric to trace_metric, which fixes two bugs:

  1. Rate limits that name the trace_metric category never matched our metric category, so the SDK kept sending metrics. Global rate limits without a category still worked and were respected correctly, also for metrics.
  2. Relay has no metric category, so it treated our metric client reports as unknown.

The (metrics spec) requires trace_metric for both.

We used `metric` as the data category for metrics, but Relay only knows
`trace_metric`. Because of this, Relay treated metric client reports as
`unknown`, and `trace_metric` rate limits never matched, so the SDK kept
sending metrics while rate limited.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Lms24 Lms24 changed the title fix(core): Use trace_metric data category for metrics fix(core): Use trace_metric data category for metrics client reports Oct 21, 2026
@Lms24 Lms24 self-assigned this Oct 21, 2026
@Lms24
Lms24 marked this pull request as ready for review October 21, 2026 10:56
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 9977e5a (PR test merge using develop at 32e7a35)

Against: 32e7a35 (develop) · base run #62893

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 29.91 kB +0.01% +2 B 🔺
@sentry/browser - with treeshaking flags 28.05 kB +0.01% +2 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 27.95 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing) 52.1 kB -0.01% -2 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 52.1 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing, Profiling) 55.05 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing, Replay) 91.85 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.72 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 96.58 kB +0.01% +1 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 109.52 kB +0.01% +1 B 🔺
@sentry/browser (incl. Feedback) 47.42 kB +0.01% +1 B 🔺
@sentry/browser (incl. sendFeedback) 34.97 kB +0.01% +2 B 🔺
@sentry/browser (incl. FeedbackAsync) 40.07 kB +0.01% +1 B 🔺
@sentry/browser (incl. Metrics) 30.93 kB +0.01% +2 B 🔺
@sentry/browser (incl. Logs) 31.21 kB +0.01% +2 B 🔺
@sentry/browser (incl. Metrics & Logs) 31.84 kB +0.02% +5 B 🔺
@sentry/react 31.73 kB - -
@sentry/react (incl. Tracing) 54.41 kB +0.01% +1 B 🔺
@sentry/vue 38.07 kB +0.01% +1 B 🔺
@sentry/vue (incl. Tracing) 55.03 kB +0.01% +1 B 🔺
@sentry/svelte 29.93 kB +0.01% +2 B 🔺
@sentry/remix (Remix 3 client bundle) 57.11 kB +0.01% +3 B 🔺
CDN Bundle 31.67 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing) 52.61 kB +0.01% +1 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.87 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 54.55 kB +0.01% +2 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.79 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing, Replay) 90.28 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.21 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 96.42 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.37 kB +0.01% +2 B 🔺
CDN Bundle - uncompressed 93.29 kB - -
CDN Bundle (incl. Tracing) - uncompressed 156.14 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.84 kB +0.02% +12 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 162.11 kB +0.01% +12 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.88 kB +0.01% +12 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 276.31 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 282.26 kB +0.01% +12 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 290.01 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.96 kB +0.01% +12 B 🔺
@sentry/nextjs (client) 57.31 kB +0.01% +1 B 🔺
@sentry/sveltekit (client) 52.48 kB +0.01% +1 B 🔺
@sentry/core/server 41.8 kB - -
@sentry/core/browser 13.81 kB - -
@sentry/node 155.32 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 84.06 kB - -
@sentry/node - without tracing 96.95 kB +0.01% +2 B 🔺
@sentry/node - without channel injection 133.3 kB +0.01% +2 B 🔺
@sentry/aws-serverless 105.13 kB - -
@sentry/cloudflare (withSentry) - minified 211.11 kB - -
@sentry/cloudflare (withSentry) 523.83 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 230.74 kB - -

View base workflow run

@Lms24
Lms24 requested review from andreiborza, mydea and s1gr1d October 21, 2026 11:13
@Lms24 Lms24 changed the title fix(core): Use trace_metric data category for metrics client reports fix(core): Use trace_metric data category for metrics rate limits and client reports Oct 21, 2026

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

not related to this PR but the spec also mentions reporting trace_metric_byte, which I don't think we currently report. do you know what's the state on this?

@Lms24

Lms24 commented Oct 21, 2026 •

Copy link
Copy Markdown
Member Author

yes that's correct but I'm trying to downgrade this from a MUST to a SHOULD, because size calculations have a perf overhead that I want to avoid in SDKs for stuff we throw away anyway. THere's an internal slack conversation about this.

@Lms24
Lms24 merged commit 24f2193 into develop Oct 21, 2026
747 of 750 checks passed
@Lms24
Lms24 deleted the fix/trace-metric-data-category branch October 21, 2026 11:18
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