Skip to content

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 8, 2026

Applies scope attributes to metrics, analogously to how we apply them to logs (see #18184). Added unit and integration tests.

closes #18160

@Lms24 Lms24 changed the title feat(core): Apply scope attributes to logs feat(core): Apply scope attributes to metrics Jan 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.84 kB - -
@sentry/browser - with treeshaking flags 23.34 kB - -
@sentry/browser (incl. Tracing) 41.59 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.18 kB - -
@sentry/browser (incl. Tracing, Replay) 80.16 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.9 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.84 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 97.1 kB - -
@sentry/browser (incl. Feedback) 41.57 kB - -
@sentry/browser (incl. sendFeedback) 29.53 kB - -
@sentry/browser (incl. FeedbackAsync) 34.53 kB - -
@sentry/browser (incl. Metrics) 25.94 kB +0.07% +16 B 🔺
@sentry/browser (incl. Logs) 26.08 kB - -
@sentry/browser (incl. Metrics & Logs) 26.75 kB +0.04% +10 B 🔺
@sentry/react 26.58 kB - -
@sentry/react (incl. Tracing) 43.82 kB - -
@sentry/vue 29.3 kB - -
@sentry/vue (incl. Tracing) 43.4 kB - -
@sentry/svelte 24.86 kB - -
CDN Bundle 27.37 kB +0.02% +4 B 🔺
CDN Bundle (incl. Tracing) 42.35 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing, Replay) 79.06 kB +0.01% +5 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 84.52 kB +0.02% +11 B 🔺
CDN Bundle - uncompressed 80.33 kB +0.03% +24 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 125.72 kB +0.02% +24 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 242.25 kB +0.01% +24 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 255.04 kB +0.01% +24 B 🔺
@sentry/nextjs (client) 46.18 kB - -
@sentry/sveltekit (client) 41.96 kB - -
@sentry/node-core 51.71 kB - -
@sentry/node 161.95 kB - -
@sentry/node - without tracing 93.14 kB - -
@sentry/aws-serverless 108.65 kB +0.01% +1 B 🔺

View base workflow run

@Lms24 Lms24 changed the base branch from develop to lms/ref-core-metrics-logs-unify January 8, 2026 14:25
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,671 - 8,796 -1%
GET With Sentry 1,686 19% 1,689 -0%
GET With Sentry (error only) 5,994 69% 5,873 +2%
POST Baseline 1,187 - 1,171 +1%
POST With Sentry 582 49% 580 +0%
POST With Sentry (error only) 1,040 88% 1,051 -1%
MYSQL Baseline 3,306 - 3,182 +4%
MYSQL With Sentry 466 14% 427 +9%
MYSQL With Sentry (error only) 2,708 82% 2,606 +4%

View base workflow run

@Lms24 Lms24 requested a review from chargome January 8, 2026 14:41
@Lms24 Lms24 force-pushed the lms/feat-core-metrics-scope-attributes branch from 05093f8 to 0c36d47 Compare January 9, 2026 10:35
@Lms24 Lms24 requested a review from a team as a code owner January 9, 2026 10:35
@Lms24 Lms24 force-pushed the lms/feat-core-metrics-scope-attributes branch from 0c36d47 to 219e1ef Compare January 9, 2026 10:37
Base automatically changed from lms/ref-core-metrics-logs-unify to develop January 9, 2026 10:41
@Lms24 Lms24 force-pushed the lms/feat-core-metrics-scope-attributes branch from 219e1ef to 3c13f13 Compare January 9, 2026 10:43
Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this!


// Enrich metric with contextual attributes
const enrichedMetric = _enrichMetricAttributes(beforeMetric, client, currentScope);
const { user, attributes: scopeAttributes } = getCombinedScopeData(getIsolationScope(), currentScope);
Copy link
Member

Choose a reason for hiding this comment

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

q: user is always defined?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was also surprised but yes 😅

@Lms24 Lms24 force-pushed the lms/feat-core-metrics-scope-attributes branch from 3c13f13 to 4b4d0d3 Compare January 9, 2026 14:51
@Lms24 Lms24 self-assigned this Jan 9, 2026
@Lms24 Lms24 enabled auto-merge (squash) January 9, 2026 15:07
@Lms24 Lms24 merged commit 8eb1d44 into develop Jan 9, 2026
405 of 408 checks passed
@Lms24 Lms24 deleted the lms/feat-core-metrics-scope-attributes branch January 9, 2026 15:47
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.

Apply scope attributes to metrics

3 participants