50571 Commits

Author SHA1 Message Date
f07f48616a Alerting: Fix panic when limit_alerts=0. (#86640)
Oversight in the TopK function meant if k=0, then we'd panic when checking
element zero in the heap, because no items are ever allowed into the heap.
2024-04-22 10:14:19 +02:00
45a7f649fe CMS: Create local implementation of cloud migration for dev use (#86637)
* add developer mode property to config

* create cms stub

* cleanup

* implement and wire up gcom stub

* fix errors

* don't document the flag
2024-04-20 23:51:58 -04:00
ae84d16a6f MSSQL: Simplify proxy logic (#86278)
* Simplify proxy dialer creation

- Set new dialer on connector
- Create MSSQL connector in a similar fashion to postgres

* Update test

* Fix lint

* More lint

* Use correct driver name
2024-04-19 22:03:26 +01:00
ec8dfc4dda CloudMonitoring: Correctly interpolate multi-valued template variables in PromQL queries (#86391)
* Interpolate promql queries appropriately

- Use pipes for multi-valued variables in PromQL queries
- Update tests

* Don't break betterer

* Another any

* Update public/app/plugins/datasource/cloud-monitoring/datasource.ts

Co-authored-by: Andrew Hackmann <5140848+bossinc@users.noreply.github.com>

---------

Co-authored-by: Andrew Hackmann <5140848+bossinc@users.noreply.github.com>
2024-04-19 22:07:15 +02:00
57bea68453 Chore: Remove unused functions form prometheus data source (#86461)
* remove createQuery

* remove redundant unit test

* update unit tests

* remove redundant mock

* exclude mocks from build

* remove it

* prettier
2024-04-19 16:00:26 -04:00
74ee675732 CloudMonitoring: Allow a custom group by value (#86288)
Allow a custom group by value
2024-04-19 20:56:12 +01:00
d8a8db3750 CloudMonitoring: Ensure variables can be used in all variable queries (#86377)
* Allow specifying project when querying services

* Ensure metricType is interpolated
2024-04-19 20:52:39 +01:00
d6e84dbf0a [DOC] Update the traces to profile content based upon SDK updates (#86628)
Update the traces to profile content based upon SDK updates
2024-04-19 14:17:11 -05:00
ad679c62c6 Docs: Update example docs for rename by regex (#86627)
* baldm0mma/update_regex/ update example docs

* baldm0mma/ push ts

* baldm0mma/update_regex with new exmaples

* baldm0mma/update_regex/ update images

* baldm0mma/regex_update/ update text
2024-04-19 21:04:54 +02:00
6ea97e41fb Alerting: Consistently return Prometheus-style responses from rules APIs. (#86600)
* Alerting: Consistently return Prometheus-style responses from rules APIs.

This commit is part refactor and part fix. The /rules API occasionally returns
error responses which are inconsistent with other error responses. This fixes
that, and adds a function to map from Prometheus error type and HTTP code.

* Fix integration tests

* Linter happiness

* Make linter more happy

* Fix up one more place returning non-Prometheus responses
2024-04-19 21:03:20 +02:00
9ed616a7b3 Alerting: Fix typo ('Alert manager' -> 'Alertmanager') (#86608)
* Alerting: Fix typo ('Alert manager' -> 'Alertmanager')

* fix front-end test
2024-04-19 20:53:51 +02:00
86a9533863 Chore: Replace backend platform codeownership (#86010)
* Replace backend platform codeownership

* fix go.mod with work sync

* fix go.mod

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
Co-authored-by: Dave Henderson <dave.henderson@grafana.com>
2024-04-19 19:12:59 +02:00
b5335f0910 Chore: ChangePassword - Replace VerticalGroup with Stack (#86614) 2024-04-19 17:37:51 +02:00
efa5e582cc Chore: UserProfileEditPage - Replace VerticalGroup with Stack (#86619) 2024-04-19 17:37:14 +02:00
aa73140564 Loki: Add label filters after label_format if present (#86124)
* Loki ad-hoc filters: add filters after label_format

* Chore: add comment explaining rationale

* Formatting

* Formatting
2024-04-19 17:31:38 +02:00
8f38ef70ce Chore: Replace VerticalGroup in OrgDetailsPage and BenchmarksPage (#86621) 2024-04-19 16:28:51 +01:00
db4f7cd21d Chore: UserSignup and LoginServiceButtons - Replace VerticalGroup with Stack (#86616) 2024-04-19 17:24:09 +02:00
f7b82a74ad alerting: email doc >url fix (#86574)
* url fix

* pretty
2024-04-19 17:01:42 +02:00
ddabef9895 RBAC: Add actionsets struct and write path (#86108)
* Add actionsets struct and failing test

* update from review

* review comments

* review comments update

* refactor: create interface

* actionset service

* fix tests

* move from wireoss to wire

* Apply suggestions from code review

remove unnecessary comments

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* nil for the actionsetservice

* Revert "nil for the actionsetservice"

This reverts commit e3d3cc817180c1927dea430191f1e940f5c01272.

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-04-19 15:38:14 +01:00
a057e8be06 Chore: AppNotificationList- Replace VerticalGroup with Stack (#86612) 2024-04-19 16:21:45 +02:00
e7fd2cb0fb Update dependency sass-loader to v14.2.1 2024-04-19 14:04:45 +00:00
913d7da3af Grafana UI: Text.story.tsx - Replace VerticalGroup with Stack (#86584) 2024-04-19 16:01:24 +02:00
53f5663714 Update dependency msw to v2.2.14 2024-04-19 13:46:18 +00:00
529f55cfe8 Alerting: Remove isDefault field from receivers (Alertmanager configuration) (#86605)
Alerting: Remove isDefault field from receivers in the Alertmanager configuration
2024-04-19 15:44:20 +02:00
2d733a4d77 Prometheus: Do not throw error for label_join function (#86465) 2024-04-19 08:32:26 -05:00
95ad100cb9 RolePicker: Identity Access team as codeowners (#86602) 2024-04-19 15:21:49 +02:00
309a7e7684 Alerting: Implement SaveAndApplyDefaultConfig in the remote Alertmanager struct (#85005)
* Alerting: Implement SaveAndApplyDefaultConfig in the remote Alertmanager struct

* send the hash of the encrypted configuration

* tests, default config hash in AM struct

* add missing default config to test

* restore build directory

* go work file...

* fix broken test

* remove unnecessary conversion to []byte

* go work again...

* make things work again with latest main branch changes

* update error messages in tests for decrypting config
2024-04-19 15:11:07 +02:00
1f3a85824f ephemeral instances: add workflow run id env var (#86528) 2024-04-19 09:49:03 -03:00
4a9e478a6b EmptyState: Apply completed empty state in Notifications page (#86504)
* add 'completed' variant

* apply completed empty state to notifications page
2024-04-19 13:46:03 +01:00
ec1af89a02 Chore: Bump promlib to v0.0.5 (#86596)
bump promlib to v0.0.5
2024-04-19 14:33:44 +02:00
bcc52a91c7 Update dependency marked to v12.0.2 2024-04-19 12:31:26 +00:00
c2f3bf677d Update dependency @types/react to v18.2.79 2024-04-19 11:39:32 +00:00
bc97d11220 Update dependency @types/eslint to v8.56.10 2024-04-19 11:19:10 +00:00
a2ce8fefed Alerting: Use a struct when sending a Grafana AM configuration to the remote Alertmanager (#86451)
* Alerting: Use a struct when sending a Grafana AM configuration to the remote Alertmanager

* remove '-distroless' from mimir image name
2024-04-19 13:04:18 +02:00
65afe90124 IntervalVariableEditor: Do not add current value as interval prop (#86446) 2024-04-19 13:04:01 +02:00
aa326423ed ColorPicker: Improvements to story organization (#86539) 2024-04-19 11:58:20 +01:00
9878dfb7d9 Grafana UI: EmotionPerfTest - Replace VerticalGroup with Stack (#86588) 2024-04-19 12:55:04 +02:00
7404a631f6 GrafanaUI: PageToolbar.story.tsx - Replace VerticalGroup with Stack (#86581) 2024-04-19 12:54:20 +02:00
63427ccd98 CommandPalette: Fix keyboard shortcut alignment (#86540)
* use full typography properties

* use Text component
2024-04-19 11:52:27 +01:00
21588ce7e2 EmptyState: Set a max width on the empty state component (#86569)
set a max width on the empty state component
2024-04-19 12:52:16 +02:00
5f7612834e Alerting: Refactoring in api_prometheus.go to allow code reuse. (#86575)
Preparing these functions to be used by some other part of the codebase,
which does not have a `contextmodel.ReqContext`, only the normal request
structure (`url.Values`, etc). This is slightly messy because of how
Grafana allows url parameters to be in the URL or in the request body,
so we need to make sure to invoke the form parsing logic in `ReqContext`.
2024-04-19 12:52:01 +02:00
44e1bce55a Feature toggles: Remove dashboardEmbed toggle (#86587) 2024-04-19 12:48:08 +02:00
c5ca90747d Grafana UI: TagsInput.story.tsx - Delete unnecessary VerticalGroup (#86582) 2024-04-19 12:34:49 +02:00
1ea7dc9250 Update dependency @grafana/plugin-e2e to v1.1.1 2024-04-19 10:23:52 +00:00
60e6dd56bf Change folder breadcrumb on folder change in general settings (#86342)
* Change folder breadcrumb on folder change in general settings

* tests and refactor

* refactor to fix broken tests

* fix test
2024-04-19 13:21:40 +03:00
f9a8e34b32 Prometheus: Update lezer-promql package (#85942)
* Update @lezer/lr to v1.4.0

* Update @prometheus-io/lezer-promql to v0.37.0

* Update @prometheus-io/lezer-promql to v0.38.0

* Update @prometheus-io/lezer-promql to v0.39.0

* Update @prometheus-io/lezer-promql to v0.40.0

* add jest config

* update code

* fix code to pass "handles things" test

* fix retrieving labels

* fix code to pass "handles label values" test

* fix code to pass "simple binary comparison" test

* use BoolModifier

* add changed lines as comments

* fix for ambiguous query parsing tests

* resolve rebase conflict

* fix retrieving labels, aggregation with/out labels

* add error

* fix comment

* fix "reports error on parenthesis" unit test

* fix for "handles binary operation with vector matchers" test

* fix for "handles multiple binary scalar operations" test

* fix for "parses query without metric" test

* fix indentation and import style

* remove commented lines

* add todo items and comments

* remove dependency update from tempo datasource

* apply same changes in core prometheus frontend

* prettier

* add new test case

* use old version of lezer in the root package.json

* Revert "apply same changes in core prometheus frontend"

This reverts commit 83fd6ac7

* fix indentation

* use latest version of lezer-promql v0.51.2

* Update packages/grafana-prometheus/src/querybuilder/parsing.ts

Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>

* enable native histogram test

---------

Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
pkg/promlib/v0.0.5
2024-04-19 11:54:56 +02:00
73873f5a8a Alerting: Optimize rule status gathering APIs when a limit is applied. (#86568)
* Alerting: Optimize rule status gathering APIs when a limit is applied.

The frontend very commonly calls the `/rules` API with `limit_alerts=16`. When
there are a very large number of alert instances present, this API is quite
slow to respond, and profiling suggests that a big part of the problem is
sorting the alerts by importance, in order to select the first 16.

This changes the application of the limit to use a more efficient heap-based
top-k algorithm. This maintains a slice of only the highest ranked items whilst
iterating the full set of alert instances, which substantially reduces the
number of comparisons needed. This is particularly effective, as the
`AlertsByImportance` comparison is quite complex.

I've included a benchmark to compare the new TopK function to the existing
Sort/limit strategy. It shows that for small limits, the new approach is
much faster, especially at high numbers of alerts, e.g.

100K alerts / limit 16: 1.91s vs 0.02s (-99%)

For situations where there is no effective limit, sorting is marginally faster,
therefore in the API implementation, if there is either a) no limit or b) no
effective limit, then we just sort the alerts as before. There is also a space
overhead using a heap which would matter for large limits.

* Remove commented test cases

* Make linter happy
2024-04-19 11:51:22 +02:00
5a8384a245 QueryService: Add feature toggles to better support testing (#86493) 2024-04-19 12:26:21 +03:00
8a5c0cfdc0 Plugins: Pass cancellable context during API server creation (#86545) 2024-04-19 09:22:14 +03:00
aa825f5dee Chore: Fix Swagger/OpenAPI instructions (#86541)
Update README.md
2024-04-19 09:16:38 +03:00