Skip to content

feat(triage): add yardstick proxy fallback for Grafana auto-query - #20905

Open
vbudhram wants to merge 2 commits into
mainfrom
triage-2026-07-20
Open

feat(triage): add yardstick proxy fallback for Grafana auto-query#20905
vbudhram wants to merge 2 commits into
mainfrom
triage-2026-07-20

Conversation

@vbudhram

@vbudhram vbudhram commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Because

  • Update triage skill to try to also use mzcld for grafana

This pull request

  • Adds a $GRAFANA_MODE probe (mcp | yardstick | skipped) in Phase 1F.1, testing the proxy with a localhost:3000 health check when no Grafana MCP server is present
  • Documents the yardstick HTTP-API path in Phase 2G, mapping each mcp__grafana__* step to its Grafana REST equivalent over the proxy (dashboard/query/render/deeplink)
  • Defers datasource UIDs and GMP query conventions to the yardstick:yardstick-grafana skill
  • Threads grafana_source: "yardstick" through the status table, Phase 1I choices, and report frontmatter
  • Adds Skill to allowed-tools so the skill can invoke yardstick-grafana

Issue that this pull request solves

N/A — internal agent-tooling change, no Jira ticket.

Checklist

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

Because:
- Grafana auto-query (Phase 2G) previously required the Grafana MCP server,
  which needs a Claude Code restart to load and so can't be enabled mid-run.
- The mzcld proxy already exposes Grafana at localhost:3000 in many setups.

This commit:
- Adds a $GRAFANA_MODE probe (mcp | yardstick | skipped) in Phase 1F.1.
- Documents the yardstick HTTP-API path for Phase 2G, mapping each MCP step
  to its Grafana API equivalent over the proxy, deferring datasource UIDs and
  GMP conventions to the yardstick-grafana skill.
- Threads grafana_source: "yardstick" through the status table and frontmatter.
- Adds Skill to allowed-tools so the skill can invoke yardstick-grafana.
@vbudhram
vbudhram requested a review from a team as a code owner July 22, 2026 15:40
Copilot AI review requested due to automatic review settings July 22, 2026 15:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the fxa-triage Claude skill documentation and configuration to support Grafana auto-query via a local mzcld proxy (“yardstick” fallback) when the Grafana MCP server isn’t available, and threads the resulting mode (mcp/yardstick/skipped) through the run workflow and report metadata.

Changes:

  • Adds a Phase 1 probe that sets $GRAFANA_MODE by checking Grafana MCP first, then falling back to a localhost:3000 yardstick/proxy health check.
  • Documents how Phase 2G’s MCP-based Grafana workflow maps to Grafana HTTP API calls via the proxy (dashboard fetch, query, render, deeplinks).
  • Updates status table and report frontmatter semantics to distinguish "yardstick" from "mcp"/"manual"/"skipped", and allows invoking a supporting yardstick Grafana skill.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .claude/skills/fxa-triage/SKILL.md Outdated
**Yardstick fallback (`$GRAFANA_MODE=yardstick`):** No `grafana` MCP server is configured, so query Grafana through its HTTP API over the `mzcld` proxy at `http://localhost:3000` instead. Invoke the `yardstick:yardstick-grafana` skill first for the canonical datasource UIDs and GMP query conventions. Never call `https://yardstick.mozilla.org` directly (it's behind IAP); the proxy handles auth, so no token header is needed on `localhost` calls. Map each step above to:

- **Discover panel queries** (step 1) — `GET http://localhost:3000/api/dashboards/uid/<uid>`, then read `.dashboard.panels[].targets[]`; each target's `datasource`, `expr` (Prometheus) or `rawSql` (SQL datasources) is what steps 2a/2b need.
- **Run queries** (step 2) — `POST http://localhost:3000/api/ds/query` with the same body shape already documented in 2b (works for both Prometheus and non-Prometheus targets), `from: "now-7d"`, `to: "now"`. Parse `results.A.frames` for the series.
…t, fix auth)

Because:
- The yardstick fallback was written from inference before the SRE "How to
  Use Grafana with Claude Code" doc was available, and got the auth model
  wrong: it claimed the mzcld proxy handles Grafana auth so no token is
  needed. The proxy injects only the Google IAP token; Grafana API calls
  still require a Grafana Service Account token.

This commit:
- Corrects the auth model: API calls carry Authorization: Bearer <SA token>,
  sourced from 1Password/env and never printed.
- Switches the liveness probe to the unauthenticated /api/health endpoint
  (was /api/datasources, which needs a token and gave an ambiguous signal).
- Makes gcx the preferred transport (SRE-preferred agentic CLI) with raw
  HTTP-over-proxy as fallback; keeps HTTP for dashboard-panel discovery,
  which gcx has no command for.
- Documents the mzcld proxy start command, the gcp-v2 datasource UIDs, GMP
  query caveats, and a gcx|http transport marker in grafana_notes.
Grafana auto-query (Phase 2G) has two paths. Probe them in order and record the result as `$GRAFANA_MODE`:

> **Image rendering capability:** `mcp__grafana__get_panel_image` requires the Grafana Image Renderer plugin to be installed server-side. Phase 2G uses image rendering only opportunistically — metric data from `query_prometheus` is always primary, panel PNGs are a bonus when available.
1. **MCP path (`$GRAFANA_MODE=mcp`).** Test with a minimal `mcp__grafana__list_datasources` call. If it returns the FxA datasources (the Prometheus datasource `grafana.prometheus_datasource_uid` from the operational config, or whichever current UID is in use), the Grafana MCP server is configured — Phase 2G runs via MCP tools.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, does this path work for you?

@dschom dschom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll be trying this out when I'm RO.

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.

3 participants