Skip to content

Grafana drilldown impl#132

Draft
jiekun wants to merge 6 commits intoVictoriaMetrics:masterfrom
vshulakov-sh:grafana-drilldown-impl
Draft

Grafana drilldown impl#132
jiekun wants to merge 6 commits intoVictoriaMetrics:masterfrom
vshulakov-sh:grafana-drilldown-impl

Conversation

@jiekun
Copy link
Copy Markdown
Member

@jiekun jiekun commented Apr 9, 2026

Describe Your Changes

This is for easier tracking of the progress and the related impl example.

Checklist

The following checks are mandatory:


Summary by cubic

Adds Grafana Drilldown support for Tempo by implementing the metrics query_range API and translating TraceQL metrics (including compare) to LogsQL. Enables charts, compare views, and exemplars (clickable trace links) in Grafana Explore/Drilldown.

  • New Features

    • Added /select/tempo/api/metrics/query_range endpoint with quicktemplate JSON response.
    • Translates TraceQL metrics to LogsQL: rate, count/min/max/avg/sum/histogram_over_time, quantile_over_time, by() grouping, and compare().
    • compare(): auto-discovers attributes, counts baseline vs selection per value, supports topN and an optional selection window; maps status codes to names; ranks attributes by divergence and returns per-value and total series.
    • Histogram: parses bucket JSON, converts vmrange to second-based labels; emits per-value and total series.
    • Exemplars: samples trace IDs across the time range, attaches them to series, snaps values to nearest samples, and includes trace/span IDs for Grafana links.
    • Field mapping between TraceQL and VT fields; converts samples to Tempo series; expanded tests for translator, parser, compare, and params.
    • Trace index stream now stores has_root_span; set during ingestion when parentSpanID == "" for fast root-span detection.
  • Refactors

    • lib/traceql: added metrics pipes (rate, *_over_time, quantile, compare), hint pipe with(), Tempo-style by() without explicit |; exposed MetricsComponents, HasNonHintPipe, StripHintPipes.
    • Search APIs ignore hint pipes; return empty results for malformed filters; map nestedSetParent < 0 to root spans; map status names to OTEL codes.
    • Added request metrics for the new endpoint.

Written for commit fddd701. Summary will update on new commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants