Skip to content

Conversation

k-fish
Copy link
Member

@k-fish k-fish commented Oct 7, 2025

Summary

This allows the js sdk to send in new trace metric protocol items, although this code is experimental since the schema may still change. Most of this has been copied from logs so some parts may need to be modified / removed later (eg. api, buffer) but this should allow us to start on UI work by sending in larger amounts of data from sentry js app to test grouping / aggregations etc.

This allows the js sdk to send in new trace metric protocol items, although this code is experimental since the schema may still change. Most of this has been copied from logs so some parts may need to be modified / removed later (eg. buffer) but this should allow us to start on UI work by sending in larger amounts of data from sentry js app to test grouping / aggregations etc.
@k-fish k-fish requested review from AbhiPrasad and a team October 7, 2025 14:54
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

github-actions bot commented Oct 7, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.41 kB +0.61% +146 B 🔺
@sentry/browser - with treeshaking flags 22.9 kB +0.6% +135 B 🔺
@sentry/browser (incl. Tracing) 40.62 kB +0.43% +172 B 🔺
@sentry/browser (incl. Tracing, Replay) 78.98 kB +0.21% +159 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 68.63 kB +0.22% +150 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 83.69 kB +0.23% +188 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 95.82 kB +0.14% +128 B 🔺
@sentry/browser (incl. Feedback) 41.11 kB +0.34% +139 B 🔺
@sentry/browser (incl. sendFeedback) 29.06 kB +0.52% +150 B 🔺
@sentry/browser (incl. FeedbackAsync) 33.98 kB +0.39% +130 B 🔺
@sentry/react 26.11 kB +0.54% +138 B 🔺
@sentry/react (incl. Tracing) 42.56 kB +0.33% +139 B 🔺
@sentry/vue 28.92 kB +0.53% +151 B 🔺
@sentry/vue (incl. Tracing) 42.39 kB +0.32% +132 B 🔺
@sentry/svelte 24.44 kB +0.63% +153 B 🔺
CDN Bundle 26.64 kB +3.36% +865 B 🔺
CDN Bundle (incl. Tracing) 41.15 kB +2.04% +821 B 🔺
CDN Bundle (incl. Tracing, Replay) 77.45 kB +1.14% +866 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 82.91 kB +1.01% +824 B 🔺
CDN Bundle - uncompressed 78.2 kB +3.78% +2.84 kB 🔺
CDN Bundle (incl. Tracing) - uncompressed 122.2 kB +2.38% +2.84 kB 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 237.36 kB +1.22% +2.84 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 250.12 kB +1.15% +2.84 kB 🔺
@sentry/nextjs (client) 44.58 kB +0.37% +160 B 🔺
@sentry/sveltekit (client) 40.98 kB +0.29% +115 B 🔺
@sentry/node-core 50.74 kB +0.35% +174 B 🔺
@sentry/node 154.37 kB +0.12% +176 B 🔺
@sentry/node - without tracing 92.59 kB +0.19% +174 B 🔺
@sentry/aws-serverless 106.32 kB +0.18% +185 B 🔺

View base workflow run

Copy link
Contributor

github-actions bot commented Oct 7, 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,808 - 8,994 -2%
GET With Sentry 1,378 16% 1,430 -4%
GET With Sentry (error only) 6,177 70% 6,248 -1%
POST Baseline 1,201 - 1,205 -0%
POST With Sentry 545 45% 555 -2%
POST With Sentry (error only) 1,044 87% 1,068 -2%
MYSQL Baseline 3,348 - 3,329 +1%
MYSQL With Sentry 442 13% 505 -12%
MYSQL With Sentry (error only) 2,699 81% 2,716 -1%

View base workflow run

@chargome chargome self-requested a review October 8, 2025 07:03
* @param value - The value of the metric attribute.
* @returns The serialized metric attribute.
*/
export function metricAttributeToSerializedMetricAttribute(value: unknown): SerializedMetricAttributeValue {
Copy link
Member

Choose a reason for hiding this comment

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

nit: We can move this into a shared util with logs


captureSerializedMetric(client, serializedMetric);

client.emit('afterCaptureMetric', metric);
Copy link
Member

Choose a reason for hiding this comment

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

q: Why no beforeCaptureMetric hook?

@chargome chargome self-assigned this Oct 8, 2025
@chargome
Copy link
Member

chargome commented Oct 8, 2025

@k-fish looks good! I'll hijack your PR so we can land this today

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

type: 'trace_metric',
item_count: items.length,
content_type: 'application/vnd.sentry.items.trace-metric+json',
} as MetricContainerItem[0],
Copy link

Choose a reason for hiding this comment

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

Bug: Metric Type Mismatch Causes Processing Issues

The createMetricEnvelope test expects the envelope item header type to be 'metric', but the createMetricContainerEnvelopeItem function correctly sets it to 'trace_metric'. This test expectation mismatch points to a potential ambiguity in the system regarding the canonical envelope item type for metrics, which could affect processing if 'trace_metric' is internally mapped to 'metric' in data category handling.

Additional Locations (2)

Fix in Cursor Fix in Web

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