Files
Dominik Prokop 91a0b312ed Add faceted labels filter for time series legend (#119918)
* Add faceted labels extraction and filtering utilities

- Add extractFacetedLabels to collect unique label values per key
- Add resolveFacetedFilterNames for OR-within/AND-across filtering
- Add FIELD_NAME_FACET_KEY constant for synthetic name facet
- Extend SeriesVisibilityChangeMode with SetExactly
- Widen onToggleSeriesVisibility signature to accept string[] | null

Made-with: Cursor

* Implement faceted labels filter UI and legend integration

- Add FacetedLabelsFilter component with "By name" and "By labels" sections,
  select/deselect all, expand/collapse, and dimmed state indicator
- Integrate filter into PlotLegend with popover and docked sidebar modes
- Add filterAction prop to VizLegend, VizLegendList, and VizLegendTable
- Add dismissOnScroll prop to Toggletip for scroll-aware popover dismissal
- Enable faceted filter in the TimeSeries panel
- Widen onToggleSeriesVisibility signature in PanelStateWrapper and ExploreGraph
- Update @grafana/scenes to canary with SetExactly support
- Add FacetedLabelsFilter component tests
- Add dev dashboard for faceted labels scenarios

Made-with: Cursor

* Add enableFacetedFilter as timeseries legend option

- Define TimeSeriesLegendOptions extending VizLegendOptions with
  enableFacetedFilter field (defaults to true)
- Add toggle in timeseries panel editor under Legend category
- Remove hardcoded enableFacetedFilter from TimeSeries component,
  let it flow via legend options spread
- Explicitly disable faceted filter in Explore graph
- Update dev dashboard with enableFacetedFilter in legend options
- Regenerate locale files

Made-with: Cursor

* Fix docked filter buttons hidden behind dimmed overlay

- Add zIndex to filterDockedActions so Clear all and Unpin
  buttons render above the dimmed FacetedLabelsFilter

Made-with: Cursor

* Guard faceted labels filter behind feature toggle

- Add vizLegendFacetedFilter experimental toggle in registry.go
- Gate panel editor option in module.tsx behind the toggle
- Gate rendering in TimeSeries.tsx behind the toggle
- Use TimeSeriesLegendOptions type for legend prop

Made-with: Cursor

* Consolidate FacetedLabelsFilter tests

Made-with: Cursor

* Restore limit support in bottom-placement legend

- Revert to InlineList for bottom placement to preserve
  the series limit feature (useLimit + "show all" button)
- filterAction is prepended before InlineList

Made-with: Cursor

* Add test for toggleAllForKey to fix coverage

- Cover Select all / Deselect all button in FacetedLabelsFilter
- Fixes Functions coverage regression for @grafana/dataviz-squad

Made-with: Cursor

* Update dev dashboard file count in search test

- Account for new timeseries-faceted-labels.json dashboard

Made-with: Cursor

* Update search test snapshot for new dev dashboard

- Add timeseries-faceted-labels to t00-all.json snapshot
- Update totalHits from 16 to 17

Made-with: Cursor

* Update search test snapshots for changed BM25 scores

- Adding a dashboard changes maxDocs which shifts IDF values
- Updated scores in all affected snapshot files

Made-with: Cursor

* Add E2E tests for faceted labels filter

- Test filter toggle, popover sections, name selection
- Test select all, clear all, pin to sidebar
- Test dimmed state when legend click conflicts with filter
- Add data-testid attributes to filter toggle and container

Made-with: Cursor

* Use gf-pin icon and move filter to left of name column

- Replace link icon with gf-pin for Pin to sidebar button
- Move filter toggle to left of name column header in table legend

Made-with: Cursor

* Bump @grafana/scenes to 7.1.5

- Replace canary version with stable 7.1.5 release

Made-with: Cursor

* Exclude node_modules from i18n extraction

- Nested node_modules under packages/ can contain .d.ts files
  that fail to parse, causing extraction to exit with error

Made-with: Cursor

* Add unit tests for PlotLegend faceted filter

- Test filter toggle visibility when enabled/disabled
- Test popover interaction and onToggleSeriesVisibility callback
- Test docked mode with clear all and unpin

Made-with: Cursor
2026-03-12 15:57:58 +01:00
..

Set up your development environment

This folder contains useful scripts and configuration so you can:

  • Configure data sources in Grafana for development.
  • Configure dashboards for development and test scenarios.
  • Set up an SMTP Server + Web Interface for viewing and testing emails.
  • Create docker-compose file with databases and fake data.

Install Docker

Grafana uses Docker to make the task of setting up databases a little easier. If you do not have it already, make sure you install Docker before proceeding to the next step.

Developer dashboards and data sources

To setup developer dashboards and data sources

./setup.sh

To remove the setup developer dashboards and data sources

./setup.sh undev

After restarting the Grafana server (make run), there should be a number of data sources named gdev-<type> provisioned as well as a dashboard folder named gdev dashboards. This folder contains dashboard and panel features tests dashboards.

Please update these dashboards or make new ones as new panels and dashboards features are developed or new bugs are found. The dashboards are located in the devenv/dev-dashboards folder.

docker-compose with databases

This command creates a docker-compose file with specified databases configured and ready to run. Each database has a prepared image with some fake data ready to use. For available databases, see docker/blocks directory. Notice that for some databases there are multiple images with different versions. Some blocks such as slow_proxy_mac or apache_proxy_mac are specifically for Macs.

make devenv sources=influxdb,prometheus,elastic5

Some of the blocks support dynamic change of the image version used in the Docker file. The signature looks like this:

make devenv sources=postgres,auth/openldap,grafana postgres_version=9.2 grafana_version=6.7.0-beta1

Notes per block

Grafana

The grafana block is pre-configured with the dev-datasources and dashboards.

Tempo

The tempo block runs loki and prometheus as well and should not be ran with prometheus as a separate source. You need to install a docker plugin for the self logging to work, without it the container won't start. See https://grafana.com/docs/loki/latest/clients/docker-driver/#installing for installation instructions.

Jaeger

Jaeger block runs both Jaeger and Loki container. Loki container sends traces to Jaeger and also logs its own logs into itself so it is possible to setup derived field for traceID from Loki to Jaeger. You need to install a docker plugin for the self logging to work, without it the container won't start. See https://grafana.com/docs/loki/latest/clients/docker-driver/#installing for installation instructions.

Graphite

version source name graphite-web port plaintext port pickle port
1.1 graphite 8180 2103 2103
1.0 graphite1 8280 2203 2203
0.9 graphite09 8380 2303 2303

MailDev

MailDev block runs an SMTP server and a web UI to test and view emails. This is useful for testing your email notifications locally.

Make sure you configure your .ini file with the following settings:

[smtp]
enabled = true
skip_verify = true
host = "localhost:1025"

You can access the web UI at http://localhost:12080/#/

Debugging setup in VS Code

An example of launch.json is provided in .vscode/launch.json. It basically does what Makefile and .bra.toml do. The 'program' field is set to the folder name so VS Code loads all *.go files in it instead of just main.go.

Troubleshooting

Containers that read from log files fail to start (Mac OS)

If you are running Mac OSX, containers that read from the log files (e.g. Telegraf, Fileabeat, Promtail) can fail to start. This is because the default Docker for Mac does not have permission to create grafana folder at the /var/log location, as it runs as the current user. To solve this issue, manually create the folder /var/log/grafana, then start the containers again.

sudo mkdir /var/log/grafana