Skip to content

POC: AI sprint week - Insights page - #1674

Draft
VikaCep wants to merge 19 commits into
mainfrom
feat/insights
Draft

POC: AI sprint week - Insights page#1674
VikaCep wants to merge 19 commits into
mainfrom
feat/insights

Conversation

@VikaCep

@VikaCep VikaCep commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

New Insights tab on the Home page that surfaces aggregated data from the /sm/insights API endpoint (built by @danieljimenez in the API repo). The page shows usage stats, performance warnings, alerting gaps, and recommendations -- with inline Grafana Assistant integration for AI-powered investigation and executable actions.

What it does

Usage -- Cards showing check types, status, limits, probe distribution, and labels with linked filters.

Alerting -- Lists checks without alerts, sorted by severity (checks with performance issues first). Per-check "Set up" button proposes default alerts by check type, with individual or bulk apply.

Performance -- Paginated per-check rows for uptime warnings, flapping, latency degradation, and regional anomalies. Clicking a row opens an inline AI investigation that:

  • Streams analysis directly in the page via useInlineAssistant()
  • Uses a custom createTool to query Prometheus for real per-probe metrics mid-investigation

Recommendations -- Grouped cards for reducing frequency, consolidating overlapping targets, and cleaning up duplicates. Each card has:

  • Expandable rows showing individual checks with Disable buttons
  • "Help me consolidate" / "Help me clean up" buttons that trigger inline AI with structured JSON actions
  • AI-proposed actions render as Review/Confirm/Undo buttons

AI integration patterns used

  • useInlineAssistant() with tools parameter for inline streaming + tool calling
  • createTool() to register a Prometheus query tool the assistant calls autonomously
  • Structured json:actions blocks parsed from AI responses to render executable UI actions
  • All prompts centralised in InsightsPage.prompts.ts

Note

This is not production-ready.

Screen.Recording.2026-05-06.at.6.04.40.PM.mov

@VikaCep VikaCep self-assigned this May 6, 2026
VikaCep added 18 commits July 13, 2026 12:58
Add structured JSON actions to AI recommendations with Review/Confirm/Undo
flow. New Alerting section with deterministic per-check alert setup using
predefined defaults.
Sort checks by type by count descending. Show API reason for low-value
checks. Fix failure logs link to filter by level=error. Cap tooltip lists
at 10 items. Bump font sizes from bodySmall to body across sections.
Register a createTool that queries the SM metrics datasource with PromQL,
passed to useInlineAssistant via the tools parameter. The assistant can now
autonomously query per-probe success rates and latency during investigation
instead of guessing from aggregated data. Improve system prompt to prevent
hallucinated metric values.
Prevent assistant from hallucinating per-probe values by clarifying
mean_success_rate semantics. Add reachability vs uptime distinction.
Hint assistant to use the query tool for exact per-probe metrics.
@github-actions

Copy link
Copy Markdown

Script size changes

Name +/- Main This PR Outcome
[891.js] New file - 6,818.56 kB
[87.js] +5.03% 3,555.38 kB 3,734.15 kB ⚠️
[469.js] = 506.85 kB 506.85 kB
[datasource/module.js] +0.31% 117.74 kB 118.11 kB
[9.js] = 99.10 kB 99.10 kB
[692.js] +0.08% 67.50 kB 67.55 kB
[398.js] = 47.15 kB 47.15 kB
[module.js] = 35.04 kB 35.04 kB
[294.js] = 22.06 kB 22.06 kB
[466.js] = 5.15 kB 5.15 kB
[131.js] = 5.00 kB 5.00 kB
[845.js] = 3.25 kB 3.25 kB
[295.js] = 2.79 kB 2.79 kB
[702.js] Deleted file 6,780.69 kB -

Totals

Name +/- Main This PR Outcome
[Scripts] +1.93% 11,247.68 kB 11,464.75 kB
[Non-script Assets] = 1,465.73 kB 1,465.73 kB
[All] +1.71% 12,713.41 kB 12,930.48 kB

Generated by 🚫 dangerJS against 40eee4b

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