Skip to content

Add a Grafana incident triage starter#175

Merged
antidmg merged 3 commits intomainfrom
feat/grafana-incident-starter
Apr 3, 2026
Merged

Add a Grafana incident triage starter#175
antidmg merged 3 commits intomainfrom
feat/grafana-incident-starter

Conversation

@antidmg
Copy link
Copy Markdown
Contributor

@antidmg antidmg commented Apr 3, 2026

Summary

This adds a lightweight grafana starter template for incident triage using raw Loki and Tempo HTTP API calls via curl

Summary by CodeRabbit

  • Documentation

    • Clarified README: platform supports tool-backed APIs for any safely wrap-able CLI or SDK (including databases, search backends, observability tools).
    • Added Grafana starter README detailing Loki and Tempo read-only query tools, triage workflow, example queries, usage steps, required environment variables, and example commands.
  • New Features

    • Added Grafana incident triage starter template to help investigate errors using Loki logs and Tempo traces.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

Walkthrough

Broadened README to generalize the "tool-backed API" pattern beyond databases and clarified MCP's provision of a constrained tool surface. Added a new Grafana starter with a Debian-based Dockerfile and a detailed README describing Loki and Tempo incident-triage tools, usage, and query recipes.

Changes

Cohort / File(s) Summary
Documentation Update
README.md
Broadened messaging from database-specific to any safely wrap-able CLI/SDK, expanded "Pluggable" scope to include general CLIs/SDKs (databases, search, observability), and clarified that MCP supplies other agents the same constrained tool surface and instructions.
Grafana Starter Template
crates/statespace-templates/src/starters/grafana/Dockerfile, crates/statespace-templates/src/starters/grafana/README.md
Added a minimal Debian-based Dockerfile installing ca-certificates and curl. Added comprehensive Grafana starter README documenting two read-only incident-query tools (Loki via query_range, Tempo via TraceQL), recommended triage flow, POST recipes, required env vars, example query shapes, and local usage steps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes only the Summary section and lacks the required Changes, Testing, and Checklist sections specified in the template. Complete the pull request description by adding Changes, Testing (with the four specified test steps), and Checklist sections as required by the template.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add a Grafana incident triage starter' accurately and specifically summarizes the main change—adding a new Grafana starter template for incident triage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/grafana-incident-starter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/statespace-templates/src/starters/grafana/Dockerfile`:
- Around line 1-5: The Dockerfile currently uses the root user; modify it to
create a non-root user and switch to it before finishing the image: add steps to
create a dedicated user/group (e.g., "grafana" or "appuser"), create a home
directory, set appropriate ownership on any created directories or files from
the RUN step (ensure ca-certificates/curl artifacts are accessible), and add a
USER directive to run the container as that non-root user; ensure any subsequent
file operations in the Dockerfile use chown/chmod so the non-root user has
needed permissions.

In `@crates/statespace-templates/src/starters/grafana/README.md`:
- Around line 3-4: The frontmatter tool command arrays in the Grafana README
(the curl entries that reference $GRAFANA_TOKEN, $LOKI_QUERY_RANGE_URL, and
$TEMPO_SEARCH_URL) must not use shell-style expansions; replace those array
entries with calls to a wrapper CLI script or executable (e.g.,
./scripts/grafana_query) that resolves environment variables internally, or with
a literal command that accepts explicit placeholders (no $... usage). Update the
tool declarations to call the wrapper/script name and pass any static args, and
move the environment resolution logic into that script (or into a templating
step) so the frontmatter contains only non-shell-expanded CLI arguments.

In `@README.md`:
- Around line 128-130: The "Self-describing" feature line still says "for your
databases" and needs to be generalized to match the repo's new "tool-backed"
positioning; update the bullet "🧠 **Self-describing** — APIs are both the
documentation and the interface for your databases" to use a broader term such
as "for your tools and services" or "for your tool-backed systems" so it no
longer references only databases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3eed1f0f-ce5d-4bd5-8ad4-f9d62af1c3fc

📥 Commits

Reviewing files that changed from the base of the PR and between f2dc522 and 767393f.

📒 Files selected for processing (3)
  • README.md
  • crates/statespace-templates/src/starters/grafana/Dockerfile
  • crates/statespace-templates/src/starters/grafana/README.md

Comment thread crates/statespace-templates/src/starters/grafana/Dockerfile
Comment thread crates/statespace-templates/src/starters/grafana/README.md
Comment thread README.md
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
crates/statespace-templates/src/starters/grafana/README.md (1)

3-4: ⚠️ Potential issue | 🟠 Major

Remove shell variable expansion from frontmatter tool declarations.

The tool command arrays use $GRAFANA_TOKEN, $LOKI_QUERY_RANGE_URL, and $TEMPO_SEARCH_URL. Per the coding guideline, frontmatter tool declarations must not include shell-style expansions. Replace these with calls to a wrapper script (e.g., ./scripts/loki_query, ./scripts/tempo_search) that resolves environment variables internally, or use a non-shell-expanded approach.

As per coding guidelines: "Declare tools in page frontmatter as CLI commands in array format without shell expansion, pipes, or globbing."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/statespace-templates/src/starters/grafana/README.md` around lines 3 -
4, The frontmatter tool command arrays currently include shell-style expansions
($GRAFANA_TOKEN, $LOKI_QUERY_RANGE_URL, $TEMPO_SEARCH_URL); replace those array
entries with calls to wrapper scripts that resolve env vars internally (e.g.,
use ./scripts/loki_query and ./scripts/tempo_search instead of the curl arrays
containing $GRAFANA_TOKEN, $LOKI_QUERY_RANGE_URL, $TEMPO_SEARCH_URL) so the
frontmatter declares plain CLI commands without shell expansion or globbing;
implement and reference the wrapper scripts to perform the curl calls and
environment lookup.
README.md (1)

128-128: ⚠️ Potential issue | 🟡 Minor

Align the "Self-describing" bullet with the broadened scope.

Line 128 still references "for your databases," which conflicts with the generalized positioning introduced in this PR (lines 34, 126). Update it to match the new "tool-backed" framing.

✏️ Suggested rewording
-- 🧠 **Self-describing** — APIs are both the documentation and the interface for your databases
+- 🧠 **Self-describing** — APIs are both the documentation and the interface for your tools and services
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 128, Update the "🧠 **Self-describing**" bullet so its
ending matches the PR's broadened "tool-backed" framing: replace the phrase "for
your databases" with wording like "for your tool-backed interfaces" (or "for
your tools") so the line reads e.g. "🧠 **Self-describing** — APIs are both the
documentation and the interface for your tool-backed interfaces"; edit the
bullet starting with "🧠 **Self-describing**" to use this new phrasing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@crates/statespace-templates/src/starters/grafana/README.md`:
- Around line 3-4: The frontmatter tool command arrays currently include
shell-style expansions ($GRAFANA_TOKEN, $LOKI_QUERY_RANGE_URL,
$TEMPO_SEARCH_URL); replace those array entries with calls to wrapper scripts
that resolve env vars internally (e.g., use ./scripts/loki_query and
./scripts/tempo_search instead of the curl arrays containing $GRAFANA_TOKEN,
$LOKI_QUERY_RANGE_URL, $TEMPO_SEARCH_URL) so the frontmatter declares plain CLI
commands without shell expansion or globbing; implement and reference the
wrapper scripts to perform the curl calls and environment lookup.

In `@README.md`:
- Line 128: Update the "🧠 **Self-describing**" bullet so its ending matches the
PR's broadened "tool-backed" framing: replace the phrase "for your databases"
with wording like "for your tool-backed interfaces" (or "for your tools") so the
line reads e.g. "🧠 **Self-describing** — APIs are both the documentation and
the interface for your tool-backed interfaces"; edit the bullet starting with
"🧠 **Self-describing**" to use this new phrasing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2776c3bf-e9f4-476e-81d3-2e0bf1e08716

📥 Commits

Reviewing files that changed from the base of the PR and between 767393f and 4b4b5dc.

📒 Files selected for processing (2)
  • README.md
  • crates/statespace-templates/src/starters/grafana/README.md

@antidmg antidmg merged commit 625888e into main Apr 3, 2026
7 checks passed
@antidmg antidmg deleted the feat/grafana-incident-starter branch April 3, 2026 19:17
@coderabbitai coderabbitai bot mentioned this pull request Apr 7, 2026
4 tasks
safranchik added a commit that referenced this pull request Apr 7, 2026
* Add a Grafana incident triage starter (#175)

* docs: rewrite README hero and example

* docs: update hero copy and sync index.md with README

* docs: fix duplicate shareable bullet and add title to build it block

* docs: restructure docs, update positioning, rename and reorganize pages

* docs: refine filesystem and cli tools pages

* docs: update hero copy

* docs: fix statespace run → serve, broken anchor, double colon, add $ prompts

* docs: revert statespace serve back to statespace run

* docs: add nv link for transparent secret injection in coding agents

* feat: use default README template on statespace init

* docs: fix broken anchor in cloud deployment CLI link

---------

Co-authored-by: gavin <antidmg@proton.me>
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.

1 participant