Usage intelligence
Which attributes cost bytes and nobody reads, what each metric costs, and which dashboards, alert rules, saved queries and API keys nobody uses. All numbers are estimates.
Attribute usage
The worker measures every Nth batch (N = 100 /
usage.sample_pct, envWT_USAGE_SAMPLE_PCT, default 1.0 percent, 0 turns it off), scales the counts by N and writes daily buckets toattr_bytes_1d.Every executed log or trace search and every PromQL query records the names it used (
attr_queries_1d, sourcequery,metric_usage_1d.queries). The API batches these and flushes every 60 s; a failed flush drops the batch.The janitor job
refs_refreshre-reads every alert rule and dashboard once a day and writesalertanddashboardreferences. These count only while they are less than two days old, so an edit that removed a reference clears after the next refresh.GET /v1/projects/{p}/usage/attributes?signal&unused_days=30&sort=byteslists keys withreferenced_by {queries, alerts, dashboards},last_referencedandunused.
Metric cost
usage_rollup (janitor, once a day) writes samples and series per metric for yesterday (UTC) to metric_usage_1d. GET /v1/projects/{p}/usage/metrics?group_by=metric|team&from&to multiplies samples by the measured compressed bytes per sample of metric_samples_v1 (2 bytes when it cannot be measured). The team is the metric's team label. One cost unit is one stored megabyte.
Stale resources
GET /v1/projects/{p}/stale-resources?kind=dashboard|notebook|alert_rule|saved_query|api_key&days=90. Views and executions update resource_usage through a batcher (flush 60 s, one count per resource per 5 minutes). An alert rule is used only when it fired or was viewed; evaluating does not count. API keys use last_used_at (project-scoped keys only).
Limits
Up to 10,000 keys or metrics per response, 256 names noted per query, 10,000 pending entries per flush interval. Traces: only structured attribute filters of trace search are recorded as references.