debug-with-grafana

Diagnose service errors and latency using Grafana metrics, logs, and traces.

1|Updated May 25, 2020
One-click install
npx skills add https://github.com/titaneric/dotfiles --skill debug-with-grafana-titaneric
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debug-with-grafana
Source: https://github.com/titaneric/dotfiles/tree/main/dot_agents/skills/debug-with-grafana
Command: npx skills add https://github.com/titaneric/dotfiles --skill debug-with-grafana-titaneric

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? When a service returns HTTP 500s, latency spikes, or appears down, engineers often jump between Grafana dashboards, Prometheus, Loki, and Tempo without a clear method. This Skill provides a structured 7-step diagnostic workflow that correlates metrics, logs, and traces through the gcx CLI to pinpoint root causes. ## Core Features & Use Cases - Structured 7-step workflow: Discover datasources, confirm data availability, query error rates and latency, correlate logs and traces, check dashboards and alerts, then summarize findings. - Multi-signal correlation: Combines Prometheus metrics, Loki logs, and Tempo traces with correct PromQL, LogQL, and TraceQL syntax, including common pitfalls like attribute scoping and label matchers. - Error recovery guidance: Reference docs cover auth failures, datasource-not-found, empty results, timeouts, and malformed query syntax. - Use Case: A user reports "my API started returning 500 errors 30 minutes ago" — the Skill walks through finding datasource UIDs, charting the 5xx rate, checking P95 latency, pulling error logs, and listing firing alerts to identify the root cause. ## Quick Start Ask the assistant to debug why your service is returning 500 errors using Grafana, and it will run the gcx-based diagnostic workflow step by step.

Frequently Asked Questions about debug-with-grafana

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug HTTP 500 errors using Grafana?

Follow the 7-step workflow: list datasource UIDs with gcx datasources list, confirm the service is scraped via the up metric, query the 5xx error rate over the incident window, check P95 latency, then pull matching error logs from Loki and review firing alert rules.

How do I correlate Prometheus metrics with Loki logs during an incident?

First identify the incident start time from the error-rate range query in Prometheus, then query Loki with a stream selector like {job="service"} |= "error" over the same window. Matching log timestamps to the metric spike reveals the failing code path or dependency.

Does gcx support querying Tempo traces with TraceQL?

Yes, gcx traces query accepts TraceQL expressions against a Tempo datasource UID. Attributes must be scoped, such as resource.service.name or span.http.status_code, and gcx traces get <trace-id> --llm retrieves a single trace in a token-efficient format.

Why does my Loki query return an empty result set?

Empty results usually mean the label selector matches no streams, the time range falls outside retention, or filters are too restrictive. Verify stream labels with gcx logs labels, broaden the time range, and simplify the selector to confirm data exists.

What should I do when gcx returns a 401 or 403 error?

A 401 or 403 indicates an expired, missing, or under-privileged API token. Run gcx config view to inspect the active context, switch contexts with gcx config use-context if needed, and update the token via gcx config set before retrying.

Why does my TraceQL query fail with a parse error on service.name?

Tempo requires scoped attribute names, so unscoped dotted names like service.name are rejected. Use resource.service.name for resource attributes and span.http.status_code for span attributes, or trace:rootService for root-span filtering.