Skip to content

Query Usage Analyzer

The Query Analyzer gives you insight into how metrics are used across your observability environment.

It helps you explore query patterns, track usage frequency, and identify where metrics are being queried, so you can optimize cost, clean up unused data, and focus on what matters.

You can access Query Analyzer under Settings > Metric Data > Usage Analysis > Queries

Query Analyzer showing query patterns, usage counts, success rates, and locations filtered by date.

Why It matters

Over time, organizations collect large numbers of metrics, many of which may never be queried again.

The Query Analyzer helps you:

  • Identify high-value metrics versus rarely used or unused ones.
  • Detect redundant queries that increase cost or cardinality.
  • Understand which dashboards, alerts, or APIs use a given metric.
  • Support data hygiene and cost optimization decisions.

Key capabilities

FeatureDescription
Query pattern parsingNormalizes queries by replacing variable values with $var to group similar queries and reduce label noise.
Usage frequency trackingDisplays the number of times each query pattern was executed.
Status trackingShows success and failure percentages for query executions, helping identify errors or invalid queries.
Query contextLists where queries originated (e.g., Alerts, Recording Rules, API).
Date selectionView query activity for a specific date using the date selector in the top-right corner.
Comprehensive searchFilter query patterns by keyword or location.

How It works

Each metric query run in the platform is parsed, normalized, and logged before execution.

This ensures every query, successful or failed, is counted.

  • Capture: The system intercepts PromQL queries before execution.
  • Parse: Variable values are replaced with $var placeholders. Example:

    http_requests_total{job="apiserver", handler="/api/comments"}
    → http_requests_total{job=$var, handler=$var}
    
  • Aggregate: Query usage counts are rolled up daily by query pattern.

  • Display: The dashboard visualizes aggregated statistics like frequency, cardinality, and units.
  • Contextualize: (In future phases) the platform will capture the client source automatically (e.g., Dashboard, Alert, API).

Using the Query Analyzer

  1. Navigate to Settings > Metric Data > Usage Analysis > Queries.
  2. The Queries tab lists all query patterns run across your environment.
  3. Use the date selector in the top-right corner to view activity for a specific day.
  4. Review the table columns:
ColumnDescription
Query PatternNormalized query pattern with $var placeholders.
# Times UsedNumber of times this query pattern was executed on the selected date.
Last RunThe most recent timestamp for that query pattern.
StatusSuccess and failure rates for that pattern (e.g., 100% (7,560) success, 0% (0) failed).
LocationThe feature or component where the query ran (e.g., Alerts, Recording Rules).
1. Use the search bar to find queries by name or label.
2. Use the location filter to narrow down results by query origin.
3. Hover over the Last Updated timestamp to confirm data freshness, or use Share to copy a link to your filtered view.

Example: From raw query to pattern

Raw QueryParsed PatternCountLocation
avg(cpu_usage{instance="server1"}[30m]) - avg(cpu_usage{instance="server2"}[30m] offset 1h)avg(cpu_usage{instance=$var}[30m]) - avg(cpu_usage{instance=$var}[30m] offset $var)12,421Alerts

This example shows how two similar queries are grouped into one pattern, making it easier to see total usage.

Interpreting results

ScenarioWhat It MeansRecommended Action
High usage countMetric is actively queried and likely important.Keep and monitor performance.
Low or zero usageMetric is rarely or never used.Review dashboards and alerts to confirm if it can be dropped.
Frequent queries from AlertsMetric is operationally critical.Prioritize retention and optimization.
High cardinality with low query frequencyPotentially wasteful metric.Investigate label usage and aggregation strategies.

Limitations

  • Supports PromQL queries only.
  • Client context (e.g., Dashboard, API, Alert) may not appear in all cases.
  • Can only analyze one day at a time, not a range of days.

Best practices

  • Use Query Usage Analyzer periodically to identify query patterns across different sources in one place, along with their usage and success rates, to help clean up unused metrics.
  • Correlate high-usage queries with ingestion data for cost analysis.
  • Before removing a metric, verify that no critical dashboards or alerts depend on it.

Troubleshooting

IssuePossible CauseSolution
Query not shownQuery hasn’t run on the selected dayChange the day.
Missing location dataClient context not yet captured in Phase 1.Available in later releases.
Very high query countsSame query pattern runs with many label variations.Parsing is automatic; for now, infer details from the query pattern. Soon, you’ll be able to enable raw query logs for any selected pattern.