Skip to content

Conversation

@chargome
Copy link
Member

Attaches a server.address attribute to all captured metrics on a serverRuntimeClient

Did this by emitting a new processMetric hook in core, that we listen to in the serverRuntimeClient. This way we do not need to re-export all metrics functions from server runtime packages and still only get a minimal client bundle size bump.

Added integration tests for node + cloudflare

closes #18240
closes https://linear.app/getsentry/issue/JS-1178/attach-serveraddress-as-a-default-attribute-to-metrics

@chargome chargome self-assigned this Nov 18, 2025
@chargome chargome requested review from AbhiPrasad, Lms24, aliu39 and andreiborza and removed request for aliu39 November 18, 2025 12:25
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

I like the pattern. As discussed, we'll likely need a hook like this one for spans and logs as well, so this makes sense to me. Naming wise, we can still add (pre|post)ProcessMetric later on should we need it, so I think this is a good naming choice (and inline with the processEvent hooks on our Integration interface).

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.62 kB - -
@sentry/browser - with treeshaking flags 23.13 kB - -
@sentry/browser (incl. Tracing) 41.37 kB - -
@sentry/browser (incl. Tracing, Profiling) 45.69 kB - -
@sentry/browser (incl. Tracing, Replay) 79.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.52 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.5 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 96.73 kB - -
@sentry/browser (incl. Feedback) 41.29 kB - -
@sentry/browser (incl. sendFeedback) 29.29 kB - -
@sentry/browser (incl. FeedbackAsync) 34.21 kB - -
@sentry/react 26.32 kB - -
@sentry/react (incl. Tracing) 43.32 kB - -
@sentry/vue 29.11 kB - -
@sentry/vue (incl. Tracing) 43.17 kB - -
@sentry/svelte 24.64 kB - -
CDN Bundle 26.95 kB +0.05% +11 B 🔺
CDN Bundle (incl. Tracing) 41.95 kB +0.03% +12 B 🔺
CDN Bundle (incl. Tracing, Replay) 78.5 kB +0.02% +8 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 83.96 kB +0.02% +10 B 🔺
CDN Bundle - uncompressed 78.95 kB +0.05% +32 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 124.33 kB +0.03% +32 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 240.36 kB +0.02% +32 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 253.13 kB +0.02% +32 B 🔺
@sentry/nextjs (client) 45.73 kB - -
@sentry/sveltekit (client) 41.76 kB - -
@sentry/node-core 50.95 kB +0.1% +47 B 🔺
@sentry/node 159.14 kB +0.04% +48 B 🔺
@sentry/node - without tracing 92.83 kB +0.06% +47 B 🔺
@sentry/aws-serverless 106.58 kB +0.05% +45 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

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,807 - 8,666 +2%
GET With Sentry 1,366 16% 1,348 +1%
GET With Sentry (error only) 6,080 69% 5,936 +2%
POST Baseline 1,218 - 1,184 +3%
POST With Sentry 528 43% 501 +5%
POST With Sentry (error only) 1,020 84% 1,040 -2%
MYSQL Baseline 3,287 - 3,255 +1%
MYSQL With Sentry 443 13% 409 +8%
MYSQL With Sentry (error only) 2,712 83% 2,673 +1%

View base workflow run

Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@chargome chargome merged commit d12ba2e into develop Nov 18, 2025
739 of 759 checks passed
@chargome chargome deleted the cg-metrics-server-attrbiutes branch November 18, 2025 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants