Konrad Lalik cd376cfc0e Alerting: Add instance count badges to activity workbench (#117741)
* Alerting: add instance count badges to triage workbench rows

Replace the icon-only drawer button with a "Details" button and add firing/pending
instance count badges to triage workbench rows. Instance counts are derived from
the DataFrame using the latest timestamp per (ruleUID, alertstate) and aggregated
for grouped rows. Change workbench split to 50%/50%.

- Add InstanceCounts type and instanceCounts to WorkbenchRow
- Add InstanceCountBadges component with DrawerButtonSpacer for alignment
- Replace OpenDrawerIconButton with OpenDrawerButton (text label)
- Pre-compute rule counts in dataTransform via buildRuleCountsMap
- Add tests for data transform

* Update translations

* Alerting: replace DrawerButtonSpacer with CSS Grid layout

Replace the fragile invisible Button spacer with a RowActions component
that uses a 3-slot CSS Grid (1fr 1fr 2fr) for consistent column alignment
across rule rows and group rows. Also replace magic pixel numbers with
theme.spacing().

* Alerting: prevent instance count badges from shrinking on narrow screens

* Alerting: sort triage workbench rows alphabetically

Sort alert rule rows by title and group rows by label value using
case-insensitive locale comparison. Empty groups remain at the end.

* Alerting: deduplicate instance counts in triage workbench badges

Add a separate instant query that uses last_over_time + unless to
deduplicate alert instances that transitioned between pending and
firing during the selected time range. This prevents double-counting
and ensures each instance is counted only once in its latest state.

* Alerting: use deduplicated counts for summary stats and fix chart field names

Extract buildDeduplicatedExpr helper into utils.ts and use it in both
Workbench and SummaryStats so instance/rule counts reflect the selected
time range instead of the current instant.

Add renameByRegex transformation in AlertRuleSummary to restore the
Value field name after filterByRefId, fixing broken color overrides
caused by Prometheus renaming Value to Value #A with multiple queries.

* Alerting: consolidate triage PromQL queries into a single file

Move all PromQL query builders from SummaryChart, Workbench, SummaryStats,
and AlertRuleInstances into a dedicated queries.ts catalog for easier
inspection and maintenance.

* make text and icons a tad smaller

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2026-02-16 15:49:28 +01:00
2025-09-30 09:49:23 -04:00
2025-10-29 17:17:07 +01:00
2026-02-05 14:16:34 +01:00
2025-08-20 10:08:03 +00:00

Grafana Logo (Light) Grafana Logo (Dark)

The open-source platform for monitoring and observability

License Go Report Card

Grafana allows you to query, visualize, alert on and understand your metrics no matter where they are stored. Create, explore, and share dashboards with your team and foster a data-driven culture:

  • Visualizations: Fast and flexible client side graphs with a multitude of options. Panel plugins offer many different ways to visualize metrics and logs.
  • Dynamic Dashboards: Create dynamic & reusable dashboards with template variables that appear as dropdowns at the top of the dashboard.
  • Explore Metrics: Explore your data through ad-hoc queries and dynamic drilldown. Split view and compare different time ranges, queries and data sources side by side.
  • Explore Logs: Experience the magic of switching from metrics to logs with preserved label filters. Quickly search through all your logs or streaming them live.
  • Alerting: Visually define alert rules for your most important metrics. Grafana will continuously evaluate and send notifications to systems like Slack, PagerDuty, VictorOps, OpsGenie.
  • Mixed Data Sources: Mix different data sources in the same graph! You can specify a data source on a per-query basis. This works for even custom datasources.

Get started

Unsure if Grafana is for you? Watch Grafana in action on play.grafana.org!

Documentation

The Grafana documentation is available at grafana.com/docs.

Contributing

If you're interested in contributing to the Grafana project:

Share your contributor experience in our feedback survey to help us improve.

Get involved

This project is tested with BrowserStack.

License

Grafana is distributed under AGPL-3.0-only. For Apache-2.0 exceptions, see LICENSING.md.

Description
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
Readme AGPL-3.0 2.8 GiB
Languages
TypeScript 52.5%
Go 44.9%
CUE 0.7%
Rich Text Format 0.4%
JavaScript 0.4%
Other 0.9%