Metrics
Chart counters, gauges and distributions sent from Sentry SDKs, aggregated over time and split by an attribute.
Metrics are numbers you emit on purpose: a counter for checkouts started, a gauge for queue depth, a distribution for request latency. axonpush stores each sample and aggregates them at read time, per environment, so you can chart one metric over any window and split it by an attribute.
Use metrics for values your code measures directly. For numbers derived from your traces (request volume, error rate, latency, tokens, cost), use Analytics instead.
Send metrics
Metrics arrive through Sentry ingest. Point a Sentry SDK at your
axonpush DSN and use its metrics API. The three supported types are
counter, gauge and distribution.
import sentry_sdk
sentry_sdk.metrics.count("checkout.started", 1, attributes={"plan": "pro"})
sentry_sdk.metrics.gauge("queue.depth", 17, unit="none", attributes={"queue": "emails"})
sentry_sdk.metrics.distribution(
"http.latency", 123.4, unit="millisecond", attributes={"route": "/checkout"}
)The exact metrics API depends on your Sentry SDK version; use the one your SDK
documents. axonpush reads the batched trace_metric envelope items those APIs
send. A sample needs a name, a numeric value, a timestamp and one of the three
types. Samples missing any of those are skipped silently. An item with no
usable sample at all is dropped and counted in
ingest outcomes.
OTLP metrics are not accepted: there is no /v1/metrics endpoint. The
axonpush SDKs do not have a metrics API either. Sentry is the only way to send
metrics today.
In the dashboard
Open Analytics and scroll to Metrics. Pick a metric from the search
box (each shows its type and unit), choose an aggregation, and optionally
Group by an attribute. The presets are Release (sentry.release), Server
(server.address), SDK (sentry.sdk.name) and User (user.id); choose
Other attribute… to type any key. The bucket size follows the selected
time range.
The default aggregation depends on the type: sum for counters, avg for
gauges, p95 for distributions.
Read metrics from the API
List the metrics seen in a window with GET /metrics/names, then read one with
GET /metrics/series.
curl -s "https://api.axonpush.xyz/metrics/names?environmentId=prod" \
-H "X-API-Key: $AXONPUSH_API_KEY"
curl -s "https://api.axonpush.xyz/metrics/series?name=http.latency&agg=p95&interval=5m&groupBy=route&environmentId=prod" \
-H "X-API-Key: $AXONPUSH_API_KEY"GET /metrics/names returns each metric’s name, type, unit, lastSeen
and count (samples in the window).
GET /metrics/series parameters:
| Parameter | Notes |
|---|---|
name | Required. The metric name. |
agg | sum (default), avg, min, max, p50, p95 or count |
interval | Bucket size: 1m, 5m, 1h (default) or 1d |
groupBy | Attribute key to split by. Only the 10 groups with the most samples are returned. |
appId | Restrict to one app |
environmentId | Environment slug or ID |
since, until | RFC3339 window. Defaults to the last 24 hours. At most 31 days. |
The response has one entry in series per group (a single entry with an empty
group when not grouped). Each point has bucket, the aggregated value and
the sample count.
The SDKs do not wrap these two operations. Call the API directly or use the
MCP tools metrics_names and metrics_series.
Limits
- One series request can return at most 1,500 buckets.
1mover 24 hours is 1,440. Use a larger interval or a shorter window, or the request fails with422. - Samples are kept for up to 30 days and follow your organisation’s retention.
- An API key bound to an app or environment only reads metrics from it. Credentials restricted by scoped access grants cannot read metrics.
Related
- Sentry, setting up the DSN
- Analytics, numbers derived from traces
- Ingest outcomes, dropped samples
- API:
metrics.names,metrics.series