Usage intelligence

Embed
Preview of the card
<a href="https://forumulate.com/p/watchtower/docs/usage-intelligence"><img src="https://forumulate.com/api/public/orgs/watchtower/spaces/docs/pages/8c01fea5-a9cb-4057-9194-bdd5c9a7e26b/social-card.svg?v=3e7ae33eec8b" alt="Usage intelligence" width="600" height="315"></a>

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, env WT_USAGE_SAMPLE_PCT, default 1.0 percent, 0 turns it off), scales the counts by N and writes daily buckets to attr_bytes_1d.

  • Every executed log or trace search and every PromQL query records the names it used (attr_queries_1d, source query, metric_usage_1d.queries). The API batches these and flushes every 60 s; a failed flush drops the batch.

  • The janitor job refs_refresh re-reads every alert rule and dashboard once a day and writes alert and dashboard references. 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=bytes lists keys with referenced_by {queries, alerts, dashboards}, last_referenced and unused.

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.

Updated