585 Commits

Author SHA1 Message Date
643dee6739 Prometheus: Refactoring in datasource.ts (#107208)
* start cleanup

* update vars

* prettier
2025-06-27 11:00:25 +01:00
de0ce87fd4 Prometheus: Apply limit to metadata request (#107068)
* use limit when calling metadata endpoint

* request metadata with limit

* betterer
2025-06-26 17:04:04 +00:00
2e9c4a76c4 Prometheus: Migrate remaining selectors to data-testid (#106564) 2025-06-26 10:22:42 +00:00
0b5d1a0e51 Prometheus: Fix adding metric name to matcher (#107214)
check metric name before pushing
2025-06-26 02:16:07 +02:00
d872a74d1c I18n: Download translations from Crowdin (#107160)
New Crowdin translations by GitHub Action

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-25 09:54:27 +01:00
6e28464981 Prometheus: Reinstate variable interpolation for getTagKeys() and getTagValues() (#107171)
add interpolation to prom getTagKeys() and getTagValues()
2025-06-25 11:36:36 +03:00
2578c7cdc7 Update dependency @hello-pangea/dnd to v18 (#107120)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-24 17:23:58 +01:00
38fc06a6ff Internationalisation: Mark up panel edit options (#107051)
* markup timeseries panel edit

* mark up matchers ui

* mark up bar chart

* mark up stat panel

* mark up gauge

* mark up bar gauge

* mark up table component

* mark up pie chart

* mark up state timeline

* mark up heatmap

* mark up status history

* mark up histogram

* mark up text panel

* mark up alert list

* mark up dashboard list

* mark up news panel

* mark up annolist

* mark up logs panel

* mark up node-graph

* mark up traces

* mark up trend

* mark up xychart

* fix build
2025-06-24 12:55:55 +01:00
e99e879fe1 Prometheus: Introduce series limit configuration (#107038)
* introduce series limit configuration

* add docs
2025-06-21 15:40:52 +02:00
f27098a976 Chore: Remove limit as '0' (#107040)
remove limit as '0'
2025-06-20 16:34:59 +00:00
18cb131a2a Chore: Refactor some of the prometheus data source types (#107031)
* refactor the types

* more refactoring

* fix import
2025-06-20 12:02:41 +00:00
704d91f2be Prometheus: Fix utf8 label value handling (#106963)
* clean up

* fix tooltip

* adjust label values query for utf8 label names

* fix series call with utf8 label

* remove commented code

* fix test
2025-06-20 10:12:42 +00:00
aecac275f5 Update dependency uuid to v11.1.0 (#106999)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-19 17:20:12 +01:00
17ad7af3b8 Prometheus: Use new language provider methods for code completions and query hints (#106383)
* refactor language provider

* update tests

* more tests

* betterer and api endpoints

* copilot updates

* betterer

* remove default value

* prettier

* introduce new methods

* provide unit tests for labelValues

* update metadata fetch

* move all cache related stuff in caching.ts

* provide interface

* provide deprecation messages

* unit tests for new interface

* separation of concerns

* update tests

* fix unit test

* fix some types

* Revert "fix some types"

This reverts commit 7e64b93b5faf253bbde62e9b9ce330a63d07aebd.

* revert interface usage

* betterer

* use PrometheusLanguageProviderInterface in everywhere

* introduce resource clients

* unit tests

* act accordingly with the feature toggle

* some more unit tests

* add feature toggle

* Revert "add feature toggle"

This reverts commit 5c93ac324f9bba37a0da26d59c7b1d6d63ab9fd3.

* remove feature toggle

* update tests

* backward compatibility

* fix scope issues

* comment update

* stronger types

* prettier

* betterer

* use new methods in metrics browser and query field

* always return data

* Revert "always return data"

This reverts commit 38e493c189d627ee7fd1ef9b551059ea64d6eff0.

* Revert "Revert "always return data""

This reverts commit b5d3b5d2b0e915a510a5cf044177e57277669ce2.

* handle error

* lint

* use new method in query builder

* fix metrics modal tests too

* use labelValues method while searching in combobox

* update metrics modal regex search

* lint

* fix unit test

* introduce resource clients and better refactoring

* prettier

* type fixes

* betterer

* no empty matcher for series calls

* better matchers

* add additional tests

* proper match string for series

* introduce series cache

* introduce series cache for series label values

* lint

* cache values too

* utf8 safe label values query with series endpoint

* fix unit tests

* caching for labels api client

* betterer

* support new language provider methods in variable editor

* use queries and adhoc filters to extract matchers

* filter out __name__

* improve match string in series query label value calls

* update unit tests

* betterer

* use new language provider methods in completions and query hints

* betterer
2025-06-18 20:57:16 +02:00
f273c1c373 Prometheus: Use new language provider methods for variable handling (#106277)
* refactor language provider

* update tests

* more tests

* betterer and api endpoints

* copilot updates

* betterer

* remove default value

* prettier

* introduce new methods

* provide unit tests for labelValues

* update metadata fetch

* move all cache related stuff in caching.ts

* provide interface

* provide deprecation messages

* unit tests for new interface

* separation of concerns

* update tests

* fix unit test

* fix some types

* Revert "fix some types"

This reverts commit 7e64b93b5faf253bbde62e9b9ce330a63d07aebd.

* revert interface usage

* betterer

* use PrometheusLanguageProviderInterface in everywhere

* introduce resource clients

* unit tests

* act accordingly with the feature toggle

* some more unit tests

* add feature toggle

* Revert "add feature toggle"

This reverts commit 5c93ac324f9bba37a0da26d59c7b1d6d63ab9fd3.

* remove feature toggle

* update tests

* backward compatibility

* fix scope issues

* comment update

* stronger types

* prettier

* betterer

* use new methods in metrics browser and query field

* always return data

* Revert "always return data"

This reverts commit 38e493c189d627ee7fd1ef9b551059ea64d6eff0.

* Revert "Revert "always return data""

This reverts commit b5d3b5d2b0e915a510a5cf044177e57277669ce2.

* handle error

* lint

* use new method in query builder

* fix metrics modal tests too

* use labelValues method while searching in combobox

* update metrics modal regex search

* lint

* fix unit test

* introduce resource clients and better refactoring

* prettier

* type fixes

* betterer

* no empty matcher for series calls

* better matchers

* add additional tests

* proper match string for series

* introduce series cache

* introduce series cache for series label values

* lint

* cache values too

* utf8 safe label values query with series endpoint

* fix unit tests

* caching for labels api client

* betterer

* support new language provider methods in variable editor

* use queries and adhoc filters to extract matchers

* filter out __name__

* improve match string in series query label value calls

* update unit tests

* betterer

* betterer
2025-06-18 20:36:13 +02:00
7e5122d580 Prometheus: Use new language provider methods in visual query builder (#106204)
* refactor language provider

* update tests

* more tests

* betterer and api endpoints

* copilot updates

* betterer

* remove default value

* prettier

* introduce new methods

* provide unit tests for labelValues

* update metadata fetch

* move all cache related stuff in caching.ts

* provide interface

* provide deprecation messages

* unit tests for new interface

* separation of concerns

* update tests

* fix unit test

* fix some types

* Revert "fix some types"

This reverts commit 7e64b93b5faf253bbde62e9b9ce330a63d07aebd.

* revert interface usage

* betterer

* use PrometheusLanguageProviderInterface in everywhere

* introduce resource clients

* unit tests

* act accordingly with the feature toggle

* some more unit tests

* add feature toggle

* Revert "add feature toggle"

This reverts commit 5c93ac324f9bba37a0da26d59c7b1d6d63ab9fd3.

* remove feature toggle

* update tests

* backward compatibility

* fix scope issues

* comment update

* stronger types

* prettier

* betterer

* use new methods in metrics browser and query field

* always return data

* Revert "always return data"

This reverts commit 38e493c189d627ee7fd1ef9b551059ea64d6eff0.

* Revert "Revert "always return data""

This reverts commit b5d3b5d2b0e915a510a5cf044177e57277669ce2.

* handle error

* lint

* use new method in query builder

* fix metrics modal tests too

* use labelValues method while searching in combobox

* update metrics modal regex search

* lint

* fix unit test

* introduce resource clients and better refactoring

* prettier

* type fixes

* betterer

* no empty matcher for series calls

* better matchers

* add additional tests

* proper match string for series

* introduce series cache

* introduce series cache for series label values

* lint

* cache values too

* utf8 safe label values query with series endpoint

* fix unit tests

* caching for labels api client

* betterer

* fix errors
2025-06-18 19:05:16 +02:00
4ba09df7dd Prometheus: Use new language provider methods in metrics browser and query field (#106163)
* refactor language provider

* update tests

* more tests

* betterer and api endpoints

* copilot updates

* betterer

* remove default value

* prettier

* introduce new methods

* provide unit tests for labelValues

* update metadata fetch

* move all cache related stuff in caching.ts

* provide interface

* provide deprecation messages

* unit tests for new interface

* separation of concerns

* update tests

* fix unit test

* fix some types

* Revert "fix some types"

This reverts commit 7e64b93b5faf253bbde62e9b9ce330a63d07aebd.

* revert interface usage

* betterer

* use PrometheusLanguageProviderInterface in everywhere

* introduce resource clients

* unit tests

* act accordingly with the feature toggle

* some more unit tests

* add feature toggle

* Revert "add feature toggle"

This reverts commit 5c93ac324f9bba37a0da26d59c7b1d6d63ab9fd3.

* remove feature toggle

* update tests

* backward compatibility

* fix scope issues

* comment update

* stronger types

* prettier

* betterer

* use new methods in metrics browser and query field

* always return data

* Revert "always return data"

This reverts commit 38e493c189d627ee7fd1ef9b551059ea64d6eff0.

* Revert "Revert "always return data""

This reverts commit b5d3b5d2b0e915a510a5cf044177e57277669ce2.

* handle error

* lint

* introduce resource clients and better refactoring

* prettier

* type fixes

* betterer

* no empty matcher for series calls

* better matchers

* add additional tests

* proper match string for series

* introduce series cache

* introduce series cache for series label values

* lint

* cache values too

* utf8 safe label values query with series endpoint

* fix unit tests

* import fixes

* more import fixes

* fix unit tests
2025-06-18 18:24:55 +02:00
6d9475127c Prometheus: Use PrometheusLanguageProviderInterface instead of legacy PromQlLanguageProvider (#105988)
* refactor language provider

* update tests

* more tests

* betterer and api endpoints

* copilot updates

* betterer

* remove default value

* prettier

* introduce new methods

* provide unit tests for labelValues

* update metadata fetch

* move all cache related stuff in caching.ts

* provide interface

* provide deprecation messages

* unit tests for new interface

* separation of concerns

* update tests

* fix unit test

* fix some types

* Revert "fix some types"

This reverts commit 7e64b93b5faf253bbde62e9b9ce330a63d07aebd.

* revert interface usage

* betterer

* use PrometheusLanguageProviderInterface in everywhere

* introduce resource clients and better refactoring

* prettier

* type fixes

* betterer

* no empty matcher for series calls

* better matchers

* import fixes
2025-06-18 16:24:07 +02:00
c7e338342a Prometheus: Introduce resource clients in language provider (#105818)
* refactor language provider

* update tests

* more tests

* betterer and api endpoints

* copilot updates

* betterer

* remove default value

* prettier

* introduce resource clients and better refactoring

* prettier

* type fixes

* betterer

* no empty matcher for series calls

* better matchers

* addressing the review feedback
2025-06-18 15:31:49 +02:00
c463e3a6e4 Update dependency @grafana/plugin-ui to v0.10.7 (#106910)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-18 13:08:56 +01:00
7070da073e Drawer: Include divider and close button when passing a custom title element (#106896)
* make drawer title behaviour more consistent

* fix linting errors
2025-06-18 12:52:32 +01:00
5448e8fb22 I18n: Download translations from Crowdin (#106866)
New Crowdin translations by GitHub Action

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-18 02:32:30 +02:00
f6e330b3d7 Alerting: Allow disabling recording rules write for a data source in the UI (#106664)
Adds a new "Allow as recording rules target" toggle to Prometheus datasource configuration that controls whether the datasource can be selected as a target for writing recording rules.
---------

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
Co-authored-by: Konrad Lalik <konradlalik@gmail.com>
2025-06-17 22:55:45 +02:00
6fcfa5f9e4 Internationalisation: Scope package translation keys (#106844)
* fix grafana-prometheus markup

* fix grafana-sql package translations

* Revert "fix grafana-sql package translations"

This reverts commit 3a85160debb9ef8e4e3de923ffc9f5d9c5096da8.

* fix grafana-sql translations
2025-06-17 15:43:32 +01:00
1dfbd215cd I18n: Add rollup plugin to handle dynamic imports in prom package (#106837)
I81n: Add rollup plugin to handle dynamic imports in prom package
2025-06-17 15:06:53 +01:00
c65ef07635 Prometheus: Facilitate tree shaking with exports and bundler mode (#105575)
* feat: bundler mode

* refactor: simplify singleton modeller

* refactor: isolate state

* refactor: decouple query rendering from modeller

* fix: remove unused var

* build: configure declaration files

* refactor!: configure exports

* fix: remove unused file

* fix: use shared utils only

* refactor: avoid confusing singleton

* fix: avoid ReDoS

see https://github.com/grafana/grafana/security/code-scanning/2883 for details

* fix: avoid catastrophic backtracking

see https://github.com/grafana/grafana/security/code-scanning/2884 for details

* fix: circular dep

* fix: make rollup happy by restoring declarationDir

* fix: import

* fix: circular dep

* chore: remove superfluous file

* fix: remove duplicate modeller code

* chore: remove superfluous comment

* fix: handle subpaths in exports

* fix: add missing ignore

* fix: correctly ignore assertion

* refactor: improve clarity

* refactor: promote clarity, be explicit

* refactor: more sensible filter

* fix: add missing devDep

* fix: circular import

* refactor: avoid type assertions where possible

* fix: linting

* chore: remove subpath exports for now

* chore: prefer forthcoming solution for arbitrary exports

* chore: undo erroneous change after merge

* refactor: prefer snake_case

* fix: linting

* refactor: simplify
2025-06-17 07:40:43 -04:00
9a17e9abd6 Chore: Bump node to v22.16.0 (#106758) 2025-06-16 17:29:07 +02:00
e33ef2885f Chore: Remove rollup-plugin-dts (#106442)
* chore(packages): remove rollup dts plugin

* build(packages): add rollup copy plugin settings to copy ts declarations to esm and cjs builds

* build(packages): remove copy settings as result doesnt pass attw cli checks

* build(packages): use single types output in dist/types directory

* ci(packages): update prepare and validate scripts for single type builds

* fix(grafana-schema): copy raw types to dist/esm directory for grafana/scenes support
2025-06-12 15:25:16 +02:00
0879479c15 Internationalisation: Mark up @grafana/prometheus package (#105861)
* scaffolding for grafana-prometheus i18n

* markup

* extract translations

* fix tests

* add loadResources + fix object properties

* fix typo + prettier

* remove useTranslate

* update workflow to trigger on changes to grafana-sql/grafana-prometheus packages
2025-06-12 11:29:33 +01:00
184d0ef72f Update dependency @prometheus-io/lezer-promql to v0.304.1 (#106332)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-04 20:55:52 +02:00
4e3e774dad Update dependency @floating-ui/react to v0.27.12 (#106307)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-04 10:25:23 -04:00
41926dcfd5 Update dependency @floating-ui/react to v0.27.9 (#106048)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-27 12:55:38 +03:00
b1636c3f9d Docs: Add some jsdoc style comments to prometheus utf8 support for better clarity (#105862)
* add some jsdoc style comments for better clarity

* Update utf8_support.ts
2025-05-23 16:18:08 +03:00
1a9e948830 Update dependency @prometheus-io/lezer-promql to v0.304.0 (#105940)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-23 13:53:54 +02:00
12d103a425 Update dependency semver to v7.7.2 (#105753)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-22 09:36:36 +01:00
a3c6b7c28d Update dependency rxjs to v7.8.2 (#105351)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-21 14:34:29 +00:00
7361537253 Update dependency @grafana/plugin-ui to v0.10.6 (#105715)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-21 11:53:11 +02:00
7108f82cc4 Prometheus: removes props mutation (#105650) 2025-05-20 14:01:17 +02:00
32bd9e22ee prometheus: use getSeriesValues in metrics selector (#105361)
When we have labels selected and want to refresh the list of metrics that match this grafana would use an expensive
/api/v1/series call instead of /api/v1/label/__name__/values with matchers, even if the datasource is configured to be
ble to use matchers in label values calls.

Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
2025-05-20 12:09:08 +02:00
d80cfce798 Revert "Prometheus: Remove series endpoint call from Metrics Explorer" (#105104)
Revert "Prometheus: Remove series endpoint call from Metrics Explorer (#104263)"

This reverts commit 89198bb749c247fa0fd394172bb939c3d79be3da.
2025-05-19 23:06:39 +02:00
7da1c9073e Prometheus: Mectircs browser refreshes metrics when series limit changes (#104101)
* refetch when series limit is changed

* when series limit is empty use the default series limit

* tests for timerange handling

* attempt to reduce the test file size

* remove ineffective memory tests

* update test

* clearer tests

* update help text

* update limit tooltip
2025-05-13 14:32:13 +02:00
1e13f48172 Prometheus library: Replace data-test-id with data-testid (#105269)
Add data-testid
2025-05-13 10:38:26 +02:00
a9b6d098e9 Chore: Add eslint no-restricted-globals rule (#104519)
* Chore: Add no-restricted-globals eslint rule

* Fix eslint warnings

* Revert some changes

* Update

* Feedback
2025-05-12 12:38:26 +03:00
9156149960 Prometheus: Move to new annotation support as the old one is deprecated (#104578)
* remove deprecated annotation support and introduce the new one

* create annotations.test.ts

* convert the old annotations to new format

* don't override query if it has necessary fields

* a better implementation

* remove comment

* fix

* fix react errors

* unit tests for annotation query editor

* two more tests
2025-05-08 13:32:42 +02:00
1058a1a3f1 CI: Fix json parsing in levitate workflows (#104853)
* ci(levitate): remove backticks and escaping to fix json parsing

* ci(levitate): use code tag over escaping backticks - HTML FTW

* chore(prometheus-package): dummy commit to test levitate changes

* ci(levitate): use actions/github-script@v7 everywhere
2025-05-05 13:05:03 +02:00
90f628abff Prometheus: Fix semver import path (#104756)
chore(prometheus): import from semver so consumers builds dont break with esm
2025-05-05 10:47:19 +03:00
be15e85434 Update dependency @floating-ui/react to v0.27.8 (#104373)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-25 15:55:42 +01:00
f7216db6bc Chore: bump version to 12.1.0-pre (#104468)
bump version to 12.1.0-pre
2025-04-24 15:47:14 +01:00
7a9fdf8609 Chore: Move getOriginalMetricName to the place where it's used (#104379)
remove getOriginalMetricName from datasource as it's used only in metric_find_query
2025-04-23 18:57:02 +02:00
0d400c3413 Chore: Remove alignRange function from prometheus frontend as it was moved to backend (#104378)
remove alignRange as it was moved to backend
2025-04-23 17:16:40 +02:00