Metric types
Counter
Tracks how many times something happened. Supports
increment(). Use for counting events like successful payments, cache hits, or feature flag evaluations.Gauge
Tracks the current value of something that goes up and down. Reports min, max, last, sum, and count. Use for queue depth, active connections, or memory usage.
Distribution
Records the statistical distribution of values. Supports percentile queries (p50, p75, p95, p99). Use for request durations, payload sizes, or DB query times.
Set
Counts unique occurrences. Use for counting unique users who triggered an event or unique session IDs in a time window.
Emitting metrics via the SDK
Metric units
When emitting a distribution, you can specify a unit to improve chart readability:| Category | Examples |
|---|---|
| Duration | nanosecond, microsecond, millisecond, second, minute, hour, day, week |
| Information | bit, byte, kilobyte, megabyte, gigabyte, terabyte |
| Fraction | ratio, percent |
| Custom | Any string — displayed as-is in the UI |
Metrics Explorer
The Metrics Explorer in Sentry lets you visualize and query your custom metrics:- Select a metric by name and type
- Choose an aggregation:
sum,count,avg,p50,p75,p95,p99,min,max - Apply tag filters to narrow the data
- Group by one or more tags to create multi-series charts
- Set the time range and granularity
Metric alerts
You can create metric alerts based on your custom metrics in the same way as performance metric alerts:- Go to Alerts → Create Alert → Metric Alert.
- Select Custom Metrics as the data source.
- Choose your metric name and aggregation function.
- Set warning and critical thresholds.
- Add notification actions.