Loading…
Introducing Application Metrics: Track the signal, see the spike, jump to the trace
SentryBen Coe
Summary
Sentry launched Application Metrics to capture application signals without pre-aggregating counters or discarding high-cardinality attributes like user IDs, project IDs, and regions. The system supports counters, distributions, and gauges within the existing SDK while linking each metric event directly to trace IDs for integrated debugging. Engineers demonstrated the feature by troubleshooting a Session Replay failure that triggered silently when sessions exceeded 1,000 video segments. By instrumenting distributions for replay event counts with project and replay attributes, the team isolated seven affected occurrences, navigated to connected traces and log lines, and reproduced the issue. Application Metrics comes enabled in recent SDK versions with 5GB included per plan.
Context
Sentry encountered a Session Replay issue where replays failed in certain browsers after loading more than 1,000 video segments without reliably generating error reports. Spans were sampled, risking missed outliers, and logs lacked structure, making it difficult to pinpoint affected users and reproduce the failure.
Approach / What changed
Sentry launched Application Metrics in its SDK to capture full metric events without pre-aggregation, preserving high-cardinality attributes like user ID, project ID, and trace ID. The feature provides Counter, Distribution, and Gauge metric types. Engineers instrumented replay.eventCount and replay.videoEventCount distributions with projectId and replayId attributes, enabling them to identify specific affected sessions, trace user actions via linked trace logs, and resolve the bug.
Takeaways
- Sentry Application Metrics stores full events instead of pre-aggregated counters, preserving high-cardinality fields such as user ID, region, and project ID.
- Metrics carry trace IDs, enabling developers to navigate directly from metric anomalies and spikes to associated traces, logs, and errors.
- The tool provides three primary metric types: Counter for totals and rates, Distribution for tracking spread across values, and Gauge for current point-in-time values.
Related reading
Sentry ·
The product analytics you already have
Software engineers frequently rely on separate product analytics tools and teams to answer user behavior questions, creating disjointed data models and delayed insights. Existing debugging telemetry within tools like Sentry—specifically spans, structured logs, and application metrics—can serve as the primary source for product metrics. Developers enrich request spans with business-level attributes, record discrete business events through wide structured logs, and track KPIs with metric counters and distributions. This unified telemetry links business outcomes directly to underlying traces, errors, releases, and source code lines, enabling immediate root-cause analysis and automated alerts. While multi-session cohort and funnel aggregation remains a current tooling gap, standard telemetry solves day-to-day adoption, performance, and revenue questions.
Rahul ChhabriaSentry ·
Improved debugging for Expo apps with the React Native SDK