feat(tempo): added grafana tempo integration#2646
Conversation
Greptile code reviewThis repo uses Greptile for automated review. Before merge, aim for Confidence Score: 5/5 with zero unresolved review threads — see CONTRIBUTING.md. Run a review — add a PR comment with: Give it ~5-10 minutes (sometimes longer) for results, then fix feedback and re-trigger until you reach Confidence Score: 5/5. Optional: automate with the greploop skill. |
|
@greptile review |
Greptile SummaryThis PR adds Grafana Tempo as a first-class standalone integration that talks directly to the Tempo HTTP API (no Grafana Cloud proxy required), using its own
Confidence Score: 5/5Safe to merge; the integration is self-contained, read-only, and all previously flagged correctness issues have been addressed in this revision. The tag-key injection path now validates keys against _VALID_TAG_KEY_RE before interpolation, the duration precision issue is fixed with float(), and _tempo_is_available correctly gates on connection_verified. The only remaining gap is the CLI setup not prompting for basic-auth credentials, which doesn't affect runtime correctness. app/integrations/cli.py (_setup_tempo is missing username/password prompts for basic-auth users) Important Files Changed
Sequence DiagramsequenceDiagram
participant Agent
participant TempoTool as query_tempo tool
participant TempoClient
participant TempoAPI as Tempo HTTP API
Agent->>TempoTool: call(action, filters, sources)
TempoTool->>TempoTool: _tempo_is_available(sources) → tempo_available_or_backend
alt connection_verified or _backend
TempoTool->>TempoClient: TempoClient(TempoConfig)
alt "action = search"
TempoClient->>TempoClient: _build_traceql(service, tags…)
TempoClient->>TempoAPI: "GET /api/search?q=…"
TempoAPI-->>TempoClient: "{traces:[…]}"
TempoClient-->>TempoTool: "{available:true, traces:[…]}"
else "action = get_trace"
TempoClient->>TempoAPI: "GET /api/traces/{id}"
TempoAPI-->>TempoClient: OTLP/JSON
TempoClient->>TempoClient: parse_otlp_trace(payload)
TempoClient-->>TempoTool: "{available:true, spans:[…]}"
else "action = list_services / list_span_names"
TempoClient->>TempoAPI: "GET /api/v2/search/tag/{tag}/values"
TempoAPI-->>TempoClient: "{tagValues:[…]}"
TempoClient-->>TempoTool: "{available:true, services:[…]}"
end
TempoTool-->>Agent: result dict
else not available
TempoTool-->>Agent: "{available:false, error:…}"
end
Reviews (4): Last reviewed commit: "feat(tempo): pr review comments" | Re-trigger Greptile |
Greptile SummaryThis PR adds Grafana Tempo as a first-class standalone integration that talks directly to the Tempo HTTP API (not through a Grafana datasource proxy), following the same patterns as the existing SigNoz integration.
Confidence Score: 3/5The feature is well-structured and largely safe, but tag keys in TraceQL expressions are not sanitized, meaning a manipulated LLM call with a crafted key could produce a broken or injected query sent to Tempo. The new app/services/tempo/client.py — specifically Important Files Changed
Sequence DiagramsequenceDiagram
participant Agent as Investigation Agent
participant Tool as query_tempo (TempoTool)
participant Client as TempoClient
participant Tempo as Tempo HTTP API
Agent->>Tool: call(action, service, trace_id, tags, ...)
alt tempo_backend injected (test)
Tool->>Tool: _dispatch(tempo_backend, ...)
else real config from _kwargs
Tool->>Tool: TempoConfig.model_validate(_kwargs)
Tool->>Client: TempoClient(config)
alt "action == get_trace"
Client->>Tempo: "GET /api/traces/{id}"
Tempo-->>Client: OTLP/JSON
Client->>Client: parse_otlp_trace()
else "action == search"
Client->>Client: _build_traceql(service, span_name, duration, tags)
Client->>Tempo: "GET /api/search?q={traceql}"
Tempo-->>Client: trace summaries
else "action == list_services / list_span_names"
Client->>Tempo: "GET /api/v2/search/tag/{tag}/values"
Tempo-->>Client: tag values
end
Client-->>Tool: result dict
end
Tool-->>Agent: "{source, action, available, ...}"
|
|
Video of opensre giving RCA via fetching from tempo : Screen.Recording.2026-05-28.at.10.14.32.PM.1.mp4 |
|
@greptile review |
|
sorry@aniketio-ctrl this needs to be closed. not assigned to you. you need to be assigned first before you work on any issues |
But it was assigned to me , #2563 (comment) |
|
Apologies I will review now |
Cool, let me know if you need any help. |
|
need to see the demo for entire flow from |

Fixes #
#2563
Describe the changes you have made in this PR -
Adds Grafana Tempo as a first-class standalone integration (not via the Grafana datasource proxy), following the SigNoz pattern. Introduces a TempoClient, a shared OTLP/JSON parser, a query_tempo tool, full integration registry wiring, CLI setup, and tests.
Demo/Screenshot for feature changes and bug fixes -
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
Checklist before requesting a review
Note: Please check Allow edits from maintainers if you would like us to assist in the PR.