Skip to content

feat: SLO integration drawer with create, link, delete, and query-match banners - #1669

Draft
ckbedwell wants to merge 14 commits into
mainfrom
feat/slo-integration
Draft

feat: SLO integration drawer with create, link, delete, and query-match banners#1669
ckbedwell wants to merge 14 commits into
mainfrom
feat/slo-integration

Conversation

@ckbedwell

@ckbedwell ckbedwell commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Problem

Users have no way to manage SLOs associated with their Synthetic Monitoring checks from within the SM app. They must navigate to the separate SLO app to create, view, link, or delete SLOs — even when the SLO clearly belongs to a specific check. Additionally, SLOs matched only by query (job label) have no way to be explicitly linked to a check, and SLOs linked to a different check can appear under the wrong check with no warning.

Solution

Adds a full SLO integration drawer accessible from each check's dashboard header:

  • Create SLO: Opens the SLO wizard inline within the drawer, pre-populated with the check's metrics and labels.
  • SLO detail tab: Shows SLI, remaining error budget, and burn rate stat cards alongside objective, labels, and a link to the SLO dashboard.
  • Link to check: When an SLO is matched by query only (no sm_check_id label), a banner prompts the user to explicitly link it. A second banner variant warns when an SLO is linked to a different check but query-matches the current one.
  • Delete SLO: A destructive button with a confirmation modal calls the SLO plugin's deleteSlo API. SLOs with readOnly.status.type === 'deleting' are filtered out immediately so the count and drawer reflect the deletion.
  • Edit SLO: Opens the SLO wizard inline for editing an existing SLO.

All features are wired through the grafana-slo-app/slo-api/v1 extension point using usePluginFunctions and managed via React Query for caching and invalidation.

Testing

Integration tests cover:

  • Drawer opening, tab switching, and SLO count display
  • Query-match and linked-to-other-check banner rendering
  • Link-to-check action calling updateSlo and invalidating queries
  • Delete confirmation flow calling deleteSlo and invalidating queries
  • SloDetailTab stat cards, labels, dashboard link, edit, and delete button states
  • getMatchingSlosForSmCheck filtering out deleting SLOs
  • linkSloToCheck stripping readOnly and setting sm_check_id

Adds a "Create a SLO" button to the check detail dashboard that opens the
grafana-slo-app wizard pre-populated with the check's job/target metrics.
@github-actions github-actions Bot added the feature A feature added to the application. label Apr 28, 2026
@github-actions

github-actions Bot commented Apr 28, 2026

Copy link
Copy Markdown

Script size changes

Name +/- Main This PR Outcome
[702.js] = 6,689.61 kB 6,689.61 kB
[87.js] +1.66% 3,594.68 kB 3,654.22 kB
[469.js] = 506.85 kB 506.85 kB
[datasource/module.js] = 119.00 kB 119.00 kB
[9.js] = 99.10 kB 99.10 kB
[692.js] = 67.50 kB 67.50 kB
[398.js] = 48.57 kB 48.57 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

Totals

Name +/- Main This PR Outcome
[Scripts] +0.53% 11,198.59 kB 11,258.13 kB
[Non-script Assets] = 1,469.61 kB 1,469.61 kB
[All] +0.47% 12,668.19 kB 12,727.74 kB

Generated by 🚫 dangerJS against 89b6a58

…ginFunctions

Centralise app-plugin availability detection in ExternalDependenciesProvider
(isAppPluginInstalled per dependency, testable via overrides). Wire SLO
linkage through grafana-slo-app/slo-api/v1 function extension instead of
direct getBackendSrv calls, consuming the wrapped dispatch API (Option B).

Add LinkedSlosIndicator to check dashboard header showing linked SLO count.
Improve CreateSLOButton with drawer, labels, and initialValues contract.
…t and burn rate

Drop the default SLO component in favour of a custom SloDetailTab that
queries SLO recording rules (grafana_slo_success_rate_5m, grafana_slo_sli_5m,
grafana_slo_objective) directly via the Prometheus API. The new component
shows three threshold-coloured stat cards (SLI, Remaining Error Budget,
Current Burn Rate) alongside the existing target/window metadata, labels
and action buttons. The title heading is removed as it is redundant with
the drawer tab label.
…to SLO drawer

Add ability to link SLOs to checks via sm_check_id, delete SLOs with
confirmation, and distinguish between unlinked query matches and SLOs
linked to a different check. Filter out SLOs with deleting status.
@ckbedwell ckbedwell changed the title feat: add Create SLO button to check dashboard header feat: SLO integration drawer with create, link, delete, and query-match banners May 12, 2026
ckbedwell added 4 commits May 12, 2026 10:06
SLO is an acronym (Service Level Objective) and should be written as
SLO, not Slo. Renames 11 files, all types/interfaces, exported
functions, local variables, and hook return wrappers to use the
uppercase form. External grafana-slo-app plugin API keys (getSlos,
updateSlo, deleteSlo) are preserved as-is since they are an external
contract. Documents the convention in AGENTS.md.
Drop the sm_check_id label-based linkage in favour of a query-matcher-only
approach using a global bidirectional link map (SLOCheckLinkMap). This fetches
all SLOs and checks once, joins them via PromQL parsing, and exposes thin
hooks (useSLOsForCheck, useChecksForSLO) for consumers.

- Rename useSmCheckSLOs.* to useSLOCheckLinks.* per AGENTS.md casing
- Add buildSLOCheckLinkMap pure function with table-driven tests
- Extract useAllSLOs, useSLOCheckLinkMap, useUpdateSLO, useDeleteSLO
- Remove sm_check_id from wizard labels and SLO creation flow
- Migrate SLOIntegration.tsx to the new hooks
- Remove banner UI for dual-source-of-truth linkage status
- Delete unused label-based utilities (filterSLOsByLabel, isSLOLinkedByLabel,
  linkSLOToCheck, getMatchingSLOsForSMCheck)
@VikaCep

VikaCep commented May 22, 2026

Copy link
Copy Markdown
Contributor

Is this one ready to review?

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Signed commits report

8 of 14 commits between main and feat/slo-integration could not be fully verified:

Commit Author Reason Message
87e2a6bb Chris Bedwell unsigned feat: add Create SLO button to check dashboard header
4caa2897 Chris Bedwell unsigned feat: add ExternalDependenciesProvider and SLO integration via usePluginFunctions
637ccbe2 Chris Bedwell unsigned feat: replace SLO detail tab with stat cards showing SLI, error budget and burn rate
9ae47b22 Chris Bedwell unsigned feat: add link-to-check, delete SLO, and query-match banner variants to SLO drawer
a3f940c0 Chris Bedwell unsigned Merge branch 'main' into feat/slo-integration
0be38a4a Chris Bedwell unsigned refactor: capitalise SLO acronym in identifiers and filenames
e83703dc Chris Bedwell unsigned refactor(slo): replace per-check SLO fetching with global link graph
c11f9672 Chris Bedwell unsigned Merge branch 'main' into feat/slo-integration

This repository requires all commits to be signed. See GitHub docs on commit signature verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A feature added to the application.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants