Metrics (Trace Connected) For JavaScript #18055
Replies: 4 comments 7 replies
-
|
Hi folks, I've just set up metrics this morning in the app I currently operate, and they're working beautifully. Two questions for you:
Both of these would really complete the package for us, in terms of using Sentry as our home base for observing our app in production. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
I'd like to request inclusion of It's also not clear from the docs what happens if we use an arbitrary unit name, instead of the "supported list". |
Beta Was this translation helpful? Give feedback.
-
|
First of all, super excited about the new Sentry.metrics APIs! The paradigm shift from tags to attributes makes total sense for long-term scalability. I am trying to implement a real-time monitoring dashboard for IoT/Client device connection status (like MQTT/WebSocket persistence) using the gauge metric, but I hit a dead-end due to the current limitations of Dashboard aggregation functions. 📈 Our Use Case & Architecture Frequency: Every 15 minutes as a heartbeat, OR immediately when the connection status changes. Value: 1.0 for Online, 0.0 for Offline. Attributes: Enclosed with device_id to identify unique hardware. JavaScript // When disconnected gracefully Mathematically, the logic for each time bucket (e.g., a 5-minute interval) should be: For each unique device_id, find its last reported value (0 or 1) within this window (or lookback window). Count how many devices have a last value equal to 1. Total Online Devices = ∑[last_value==1.0]. However, in the Sentry Dashboard / Application Metrics UI, there is no way to perform this. avg(mqtt.online) completely distorts the reality. If a device flips from 1 to 0 in the same bucket, avg returns 0.5, which means nothing for a binary state. last(mqtt.online) works if we Group by: device_id, but when we have thousands of devices, grouping by device ID crashes the UI/chart because it tries to render thousands of lines, instead of aggregating them into a single "Total Online Count" line. We desperately need a function like count_if(mqtt.online == 1, group_by=device_id) or the ability to nested-aggregate: sum(last(mqtt.online) by device_id). 💡 Suggested Solutions / Feature Requests Introduce Conditional Counter: Provide something like count_match(metric, value) or standard PromQL-like behaviors (last_over_time) for Gauges in Sentry Dashboards. Accept State/Status as a native Metrics type: If Gauges are restricted to mathematical min/max/avg, maybe we need a status type metric that understands state persistence? Would love to hear if this is on the roadmap for the upcoming Feb Dashboard overhaul! Thanks! |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Sentry is introducing metrics that let you send counters, gauges, and distributions from your code to track things like
email.sent,checkout.failed, orqueue.depth— and pivot directly into the related traces, logs, and errors when something looks off.TraceConnectedMetrics.mp4
Note
To get early access to the Sentry metrics product and to see how it works, see the announcement post.
To use the new Metric APIs to send metrics directly to Sentry, you'll have to upgrade to 10.25.0 of the JavaScript SDK or higher.
Once the SDK is initialized, you can send metrics using the
Sentry.metricsAPIs.The
metricsnamespace exposes three methods that you can use to capture different types of metric information:count,gauge, anddistribution.You can also pass additional attributes directly to
count,gauge, anddistributionvia theattributesobject.You can also set a unit on the metric
Beta Was this translation helpful? Give feedback.
All reactions