Commit Graph

1151 Commits

Author SHA1 Message Date
Torkel Ödegaard
3ee26df41e
PublicDashboards: Variables refactor (#73476)
Co-authored-by: Juan Cabanas <juan.cabanas@grafana.com>
Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-08-25 13:56:02 -05:00
George Robinson
bbef000202
Alerting: Add contact point for Grafana OnCall (#73733)
Add contact point for Grafana OnCall
2023-08-24 10:45:12 +02:00
github-actions[bot]
69267cd28b
Alerting: Update Swagger spec (#72568)
chore: update alerting swagger spec

Co-authored-by: rwwiv <rwwiv@users.noreply.github.com>
2023-08-22 14:35:48 -04:00
Misi
d7166f5f96
RBAC: Remove unused scope from alert.instances:read fixed role (#73268)
Fix alert.instances:read scope for fixed role
2023-08-16 09:55:49 +02:00
Yuri Tseretyan
938e26b59f
Alerting: Add new metrics and tracings to state manager and scheduler (#71398)
* add metrics and tracing to state manager

* propagate tracer to state manager

* add scheduler metrics

* fix backtesting

* add test for state metrics

* remove StateUpdateCount

* update docs

* metrics can be null

* add tracer to new tests
2023-08-16 09:04:18 +02:00
Yuri Tseretyan
90e3f516ff
Alerting: Update Discord settings to treat 'url' as a secure setting (#69588)
* make discord url secure

* support migrating unsecure settings to secure settings

* Update public/app/features/alerting/unified/utils/receiver-form.ts

Co-authored-by: William Wernert <william.wernert@grafana.com>

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
Co-authored-by: William Wernert <william.wernert@grafana.com>
2023-08-16 09:03:56 +02:00
Yuri Tseretyan
0717ec11d6
Alerting: Update state manager to change all current states in the case when Error\NoData is executed as Ok\Nomal (#68142) 2023-08-15 10:27:15 -04:00
Jean-Philippe Quéméner
2266e09f94
Alerting: optimize rules with multiple loki range queries (#73103) 2023-08-09 19:00:51 +02:00
Yuri Tseretyan
69c8200fc9
Alerting: Add more tests for state manager ProcessEvalResults (#73019)
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
2023-08-09 12:21:12 -04:00
Jo
97ba611e4c
Chore: Fix ngalert Evaluate signature change (#73084)
fix ngalert Evaluate sig change
2023-08-09 11:27:14 +02:00
Yuri Tseretyan
6b4a9d73d7
Alerting: Export contact points to check access control action instead legacy role (#71990)
* introduce a new action "alert.provisioning.secrets:read" and role "fixed:alerting.provisioning.secrets:reader"
* update alerting API authorization layer to let the user read provisioning with the new action
* let new action use decrypt flag
* add action and role to docs
2023-08-08 19:29:34 +03:00
Jean-Philippe Quéméner
2c6cf66741
Alerting: Optimize external Loki queries (#73014) 2023-08-08 15:13:41 +02:00
Yuri Tseretyan
0053b07885
Alerting: Refactor of state manager tests (#72849)
* calculate cacheID instead of literals
   * use mocked clocks
   * advance clocks with the eval results
   * use clearer timestamp aliases
   * make expected state labels be more clear to read
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
2023-08-04 13:39:49 -04:00
Serge Zaitsev
7767ab6f43
Chore: Add folder data migration, fix unique index (#72602)
* add folder data migration, fix unique index

* fix unique index

* pass a fake store in tests

* pass store into other providers in tests

* and now with alerting!
2023-08-01 09:36:37 +02:00
Yuri Tseretyan
c7598cc6fb
Alerting: Add ability to control scheduler tick interval via config (#71980)
* add ability to control scheduler interval via config
* add feature flag `configurableSchedulerTick`
2023-07-26 12:44:12 -04:00
Yuri Tseretyan
5ba164d92b
Alerting: Exclude expression refIDs from NoData state (#72219) 2023-07-26 11:42:04 -04:00
Yuri Tseretyan
78fc3bcdf4
Alerting: Fix state manager to not keep datasource_uid and ref_id labels in state after Error (#72216) 2023-07-26 11:41:46 -04:00
Matthew Jacobson
d31d175109
Alerting: Fix contact point testing with secure settings (#72235)
* Alerting: Fix contact point testing with secure settings

Fixes double encryption of secure settings during contact point testing and removes code duplication
that helped cause the drift between alertmanager and test endpoint. Also adds integration tests to cover
the regression.

Note: provisioningStore is created to remove cycle and the unnecessary dependency.
2023-07-25 10:04:27 -04:00
Arati R
20ffbbc41e
NestedFolders: Add library panels counting and deletion to folder registry (#69149)
* Expose library element service's folder service
* Register library panels, add count implementation
* Expand folder counts test
* Update registry deletion method interface
* Allow getting library elements from any folder
* Add test for library panel deletion
* Add test for library panel counting
2023-07-25 13:05:53 +02:00
github-actions[bot]
24872370b5
Alerting: Update Swagger spec (#72177)
chore: update alerting swagger spec

Co-authored-by: rwwiv <rwwiv@users.noreply.github.com>
2023-07-25 11:34:00 +02:00
Alexander Weaver
8c8b3ecb5b
Alerting: Add dashboardUID and panelID query parameters for loki state history (#72119)
* read query parameters

* Generate loki query from params
2023-07-24 23:46:46 -05:00
Matthew Jacobson
cfb1656968
Alerting: Add notification policy provisioning file export (#70009)
* Alerting: Add notification policy provisioning file export

- Add provisioning API endpoint for exporting notification policies.
- Add option in notification policy view ellipsis dropdown for exporting.
- Update various provisioning documentation.
2023-07-24 17:56:53 -04:00
Kyle Brandt
1df4d332c9
SSE: Use errutil to show better error messages in prod (#71658)
- include public message
- propagate data source query errors so they are shown as well to which fixes #70026
2023-07-21 06:38:29 -04:00
Alexander Weaver
ff48a145cc
Alerting: Add exported getters for PanelKey fields (#72064)
Add getters
2023-07-20 15:47:20 -05:00
Yuri Tseretyan
cbbbe2e6f6
SSE: DSNode to update result with names to make each value identifiable by labels (only Graphite and TestData) (#71246)
* introduce a function checkIfSeriesNeedToBeFixed to scan all value fields in the response and provide a function that updates Series so they can be uniquely identifiable. Only Graphite and TestData are checked.

* update `convertDataFramesToResults` to run this function and provide it to WideToMany
* update WideToMany to run the fix function if it is not nil
2023-07-20 14:44:12 -04:00
Matthew Jacobson
13121d3234
Alerting: Add contact point provisioning file export (#71692)
* Add contact point provisioning file export apis

* Regenerate api

* docs

* frontend

* add mock to tests

* Fix missing row-level export button on viewer role w/ prov. read

* Address review comments

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2023-07-20 14:35:56 -04:00
George Robinson
8dd3eb856d
Alerting: Improve performance of matching captures (#71828)
This commit updates eval.go to improve the performance of matching
captures in the general case. In some cases we have reduced the
runtime of the function from 10s of minutes to a couple 100ms.
In the case where no capture matches the exact labels, we revert to
the current subset/superset match, but with a reduced search space
due to grouping captures.
2023-07-20 09:07:00 +01:00
George Robinson
f1af0502db
Alerting: Add tests for matching captures (#71928)
This commit adds tests for matching captures, which we do not have
at present.
2023-07-19 12:52:26 +01:00
George Robinson
89dcaaf049
Alerting: Sort NumberCaptureValues in EvaluationString (#71927)
This commit changes extractEvalString to sort NumberCaptureValues
in ascending order of Var before building the output string. This
means that users will see EvaluationString in a consistent order,
but also make it possible to assert its output in tests.
2023-07-19 12:09:21 +01:00
Alexander Weaver
d6db9a5b3c
Alerting: Add exported constructor for panelKey (#71872)
Exported constructor for panelKey
2023-07-18 13:37:43 -05:00
Alexander Weaver
18b910e654
Alerting: Refactor annotation historian to isolate dashboard service dependency (#71689)
* Refactor annotation historian to isolate dashboard service dependency

* Export PanelKey

* Don't export parsePanelKey

* Remove commented out code
2023-07-18 08:18:55 -05:00
Will Browne
a8577c21ba
Plugins: Migrate PluginStore mock to pre-existing fakes package (#71664)
* migrate to existing fakes package

* fix imports
2023-07-17 10:21:44 +00:00
Yuri Tseretyan
541bfe636d
SSE: Support for ML query node (#69963)
* introduce a new node-type ML and implement a command outlier that uses ML plugin as a source of data.
* add feature flag mlExpressions that guards the feature
2023-07-13 20:37:50 +03:00
Yuri Tseretyan
64aa5465ac
Alerting: do not expand template for labels\annotations if value is not a template (#71492) 2023-07-12 14:53:40 -04:00
Kyle Brandt
f6a28cadbc
Alerting: (Chore/Instrumentation) Add traceID to logs with contextual logger (#71289)
Alerting: (Chore) Add traceID to logs with contextual logger
2023-07-11 10:59:52 +02:00
Matthew Jacobson
e3787de470
Alerting: Fix Alertmanager change detection for receivers with secure settings (#71307)
* Alerting: Make ApplyAlertmanagerConfiguration only decrypt/encrypt new/changed secure settings

Previously, ApplyAlertmanagerConfiguration would decrypt and re-encrypt all secure settings. However, this caused re-encrypted secure settings to be included in the raw configuration when applied to the embedded alertmanager, resulting in changes to the hash. Consequently, even if no actual modifications were made, saving any alertmanager configuration triggered an apply/restart and created a new historical entry in the database.

To address the issue, this modifies ApplyAlertmanagerConfiguration, which is called by POST `api/alertmanager/grafana/config/api/v1/alerts`, to decrypt and re-encrypt only new and updated secure settings. Unchanged secure settings are loaded directly from the database without alteration.

We determine whether secure settings have changed based on the following (already in-use) assumption: Only new or updated secure settings are provided via the POST `api/alertmanager/grafana/config/api/v1/alerts` request, while existing unchanged settings are omitted.

* Ensure saving a grafana-managed contact point will only send new/changed secure settings

Previously, when saving a grafana-managed contact point, empty string values were transmitted for all unset secure settings. This led to potential backend issues, as it assumed that only newly added or updated secure settings would be provided.

To address this, we now exclude empty ('', null, undefined) secure settings, unless there was a pre-existing entry in secureFields for that specific setting. In essence, this means we only transmit an empty secure setting if a previously configured value was cleared.

* Fix linting

* refactor omitEmptyUnlessExisting

* fixup

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2023-07-11 08:23:07 +02:00
Yuri Tseretyan
30fc075cd7
Alerting: Fix panic in backtesting API when the testing interval is not times of evaluation interval (#68727)
* add test for the bug
* update backtesting evaluators to accept a number of evaluations instead of `to` to have control over the number evaluations in one place
2023-07-06 11:21:03 -04:00
Yuri Tseretyan
ada325de2a
Alerting: Use unsafe.Slice for hashing a string during rule fingerprint calculation (#71000) 2023-06-30 14:58:23 -04:00
Alexander Weaver
f94fb765b5
Alerting: Add limit query parameter to Loki-based ASH api, drop default limit from 5000 to 1000, extend visible time range for new ASH UI (#70769)
* Add limit query parameter

* Drop copy paste comment

* Extend history query limit to 30 days and 250 entries

* Fix history log entries ordering

* Update no history message, add empty history test

---------

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
2023-06-28 13:32:28 -05:00
George Robinson
594c851d4b
Alerting: Add duration to saving alert states done (#70844) 2023-06-28 15:19:21 +01:00
Steve Simpson
21ac224c45
Alerting: Make ImageService public in NGAlert. (#70737) 2023-06-27 13:11:22 +02:00
João Calisto
1d68f5ba77
Alerting: Fix HA alerting membership sync (#70607)
* Alerting: Fix HA alerting membership sync

* Added comment about filtering duplicates
2023-06-26 17:12:10 +01:00
William Wernert
4aa477f48f
Alerting: Move rule UID from Loki stream labels into log lines (#70637)
Move rule uid into log line to reduce cardinality
2023-06-26 09:57:45 -04:00
George Robinson
7edbe72483
Alerting: Support concurrent queries for saving alert instances (#70525)
This commit adds support for concurrent queries when saving alert
instances to the database. This is an experimental feature in
response to some customers experiencing delays between rule evaluation
and sending alerts to Alertmanager, resulting in flapping. It is
disabled by default.
2023-06-23 11:36:07 +01:00
guangwu
bbe4b0d3de
chore: remove refs to deprecated io/ioutil (#70300) 2023-06-22 12:19:23 +02:00
Andreas Deininger
95b1f3c875
Fixing typos (#70487) 2023-06-22 09:43:38 +01:00
Santiago
d3bb9fbbaf
Alerting: Use only token for images in notifications (#70196)
* Alerting: Use only tokens for images in notifications

* update tests

* make linter and modfile validator happy
2023-06-21 20:53:45 -03:00
Santiago
ff9eff49bd
Alerting: Bump grafana/alerting and refactor the ImageStore/Provider to provide image URL/bytes (#70182)
* implement alerting.images.Provider interface in our ImageStore

* add URLExists() method to fakeConfigStore

* make linter happy

* update integration tests
2023-06-21 20:53:30 -03:00
Alexander Weaver
ce6f73bd32
Alerting: Add two missing tests which cover missing URLs for Loki state history (#70460)
Add two missing tests which cover individual missing URLs
2023-06-21 12:58:37 -05:00
George Robinson
8a13ee3cd4
Alerting: Add debug logs when saving instances is finished (#70447) 2023-06-21 14:19:04 +02:00
George Robinson
a1cb7319d5
Alerting: Update in app documentation for customizing message and subject (#70367) 2023-06-20 12:20:01 +02:00
George Robinson
815e98ed95
Alerting: Add debug logs for EndsAt timestamp (#70336)
This commit adds debug logs for previous_ends_at and next_ends_at
to state.go to help us debug issues where alerts are resolved in
Alertmanager due to expiration. This change is in response to a
support escalation where this information was needed but unavailable.
2023-06-20 12:13:38 +03:00
SatVeer Singh
1bfa3a0f1e
Chore: Replace go-multierror with errors package (#66432)
* code refactor and type assertions added to tests

* no-lint rule added for specific line
2023-06-19 12:29:45 +03:00
Jean-Philippe Quéméner
934ba1aaa1
Alerting: Rewrite range to instant queries if possible (#69976) 2023-06-16 19:55:49 +02:00
Yuri Tseretyan
842f33580e
SSE: Add functions that determine NodeType by UID and construct a data source struct from NodeType (#70106)
* add NodeTypeFromDatasourceUID and DataSourceModelFromNodeType()
* deprecate expr.DataSourceModel
* replace usages of IsDataSource to NodeTypeFromDatasourceUID 
* replace usages of DataSourceModel to DataSourceModelFromNodeType()
2023-06-16 13:05:06 -04:00
Yuri Tseretyan
f1d47d18a8
Alerting: Sort RefIDs in error message returned by api.validateCondition (#70198)
sort RefIDs in error message
2023-06-15 18:37:30 -03:00
Yuri Tseretyan
b963defa44
Alerting: update rules POST API to validate query and condition only for rules that changed. (#68667)
* replace condition validation with just structural validation
* validate conditions of only new and updated rules
* add integration tests for rule update\delete API

Co-authored-by: George Robinson <george.robinson@grafana.com>
2023-06-15 13:33:42 -04:00
Yuri Tseretyan
baffe83da6
Alerting: Improve performance of cache.getOrCreate (#63909)
* move expansion of labels and annotations outside of mutex lock
* propagate struct but not pointer
2023-06-15 09:37:47 -04:00
George Robinson
f085e99d3c
Alerting: Add matchers metrics to Alertmanager (#69855) 2023-06-15 09:18:01 +01:00
Santiago
ff3e028a85
Alerting: Add image URI annotation only when there's an image (#69825)
* Alerting: Add image URI annotation only when there's an image

* fix function name (changed on main branch)
2023-06-09 10:59:24 -03:00
Matthew Jacobson
ba3994d338
Alerting: Repurpose rule testing endpoint to return potential alerts (#69755)
* Alerting: Repurpose rule testing endpoint to return potential alerts

This feature replaces the existing no-longer in-use grafana ruler testing API endpoint /api/v1/rule/test/grafana. The new endpoint returns a list of potential alerts created by the given alert rule, including built-in + interpolated labels and annotations.

The key priority of this endpoint is that it is intended to be as true as possible to what would be generated by the ruler except that the resulting alerts are not filtered to only Resolved / Firing and ready to be sent.

This means that the endpoint will, among other things:

- Attach static annotations and labels from the rule configuration to the alert instances.
- Attach dynamic annotations from the datasource to the alert instances.
- Attach built-in labels and annotations created by the Grafana Ruler (such as alertname and grafana_folder) to the alert instances.
- Interpolate templated annotations / labels and accept allowed template functions.
2023-06-08 18:59:54 -04:00
Matthew Jacobson
0c688190f7
Alerting: Fix unique violation when updating rule group with title chains/cycles (#67868)
* Alerting: Fix unique violation when updating rule group with title chains/cycles

The uniqueness constraint for titles within an org+folder is enforced on every update within a transaction instead of on commit (deferred constraint). This means that there could be a set of updates that will throw a unique constraint violation in an intermediate step even though the final state is valid. For example, a chain of updates RuleA -> RuleB -> RuleC could fail if not executed in the correct order, or a swap of titles RuleA <-> RuleB cannot be executed in any order without violating the constraint.

The exact solution to this is complex and requires determining directed paths and cycles in the update graph, adding in temporary updates to break cycles, and then executing the updates in reverse topological order (see first commit in PR if curious).

This is not implemented here.

Instead, we choose a simpler solution that works in all cases but might perform more updates than necessary. This simpler solution makes a determination of whether an intermediate collision could occur and if so, adds a temporary title on all updated rules to break any cycles and remove the need for specific ordering.

In addition, we make sure diffs are executed in the following order: DELETES, UPDATES, INSERTS.
2023-06-08 18:51:50 -04:00
Will Browne
624777258b
Plugins: Refactor creation of plugin context to dedicated service (#66451)
* first pass

* fix tests

* return errs

* change signature

* tidy

* delete unnecessary fields from test

* tidy

* fix tests

* simplify

* separate error check in API

* apply nits
2023-06-08 13:59:51 +02:00
Horst Gutmann
f4c04d4055
Alerting: Update patch for #865 after #68898 (#890) 2023-06-06 13:38:37 +02:00
dsotirakis
f9c310dbaf
Require alert.notifications:write permissions to test receivers and templates (#865)
# Conflicts:
#	pkg/services/ngalert/api/authorization.go
2023-06-06 13:33:56 +02:00
Matthew Jacobson
c16f1f5e99
Alerting: Fix provisioned templates being ignored by alertmanager (#69485)
* Alerting: Fix provisioned templates being ignored by alertmanager

Template provisioning sets the template in cfg.TemplateFiles while a recent change
made it so that alertmanager reads cfg.AlertmanagerConfig.Templates instead.

This change fixes the issue on both ends, by having provisioning set boths fields and
reverts the change on the alertmanager side so that it uses cfg.TemplateFiles.
2023-06-02 15:47:43 -04:00
Arati R
6cb1a5e368
Nested folders: Add alert rule counts and deletion to folder registry (#67259)
* Let alert rule service implement registry service
* Add count method to RuleStore interface
* Add implementation for deletion of alert rules
* Rename uid to folderUID in registry methods
* Check forceDeleteRule value for registry deletion
* Register alerting store with folder service
* Move folder test functions to separate package
* Add testing for alert rule counting, deletion
* Remove redundant count method
* Fix deleteChildrenInFolder signature
* Update pkg/services/ngalert/store/alert_rule.go
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* Add tests for nested folder deletion
* Refactor TestIntegrationNestedFolderService
* Add rules store as parameter for alertng provider

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-06-02 16:38:02 +02:00
Ieva
d8b66d5c4b
RBAC: remove some IsDisabled checks (#69272)
* remove some access contorl IsDisabled() checks

* cleaning up tests

* update tests

* linting
2023-05-31 09:58:57 +01:00
Alexander Weaver
0ed5d3bdf2
Revert "Alerting: Refactor the ImageStore/Provider to provide image URL/bytes" (#69265)
Revert "Alerting: Refactor the ImageStore/Provider to provide image URL/bytes (#67693)"

This reverts commit 72a187b0be.
2023-05-30 11:33:33 -05:00
Alexander Weaver
0f88b117dc
Alerting: Skip flaky test TestRouteGetRuleStatuses (#69258)
Skip TestRouteGetRuleStatuses
2023-05-30 09:48:02 -05:00
Santiago
72a187b0be
Alerting: Refactor the ImageStore/Provider to provide image URL/bytes (#67693)
* (WIP) Refactor the ImageStore interface to work with our latest alerting repository

* update alerting package

* refactor, new URLExists method in ImageProvider

* tests for the new methods

* fix linter warnings

* use alertingImages as an alias for grafana/alerting/images

* logs about image uris and not found images

* nerf image not found logs

* extract duplicated code to getImageFromURI() method

* refactor getImageFromURI()

* add index on url

* add comment about migration log

* sync generated files
2023-05-30 11:25:55 -03:00
Ieva
d98813796c
RBAC: Remove legacy AC from HasAccess permission check (#68995)
* remove unused HasAdmin and HasEdit permission methods

* remove legacy AC from HasAccess method

* remove unused function

* update alerting tests to work with RBAC
2023-05-30 14:39:09 +01:00
Matthew Jacobson
97ae6ae6ef
Alerting: Fix flaky TestIntegrationUpdateAlertRules (#69106)
Prevents duplicate alert rule ids and 0 value for BaseInterval and IntervalSeconds
2023-05-25 16:00:06 -04:00
Yuri Tseretyan
b57ef1f2c7
Alerting: Fix TestIntegration_GetAlertRulesForScheduling to make sure rules are created in different org (#69088)
make sure rules are created in different org
2023-05-25 13:51:38 -04:00
Sladyn
a06a5a7393
Alerting: Improve log messages (#67688)
* Rename base logger and capatilize messages
* Remove cflogger from config.go
2023-05-25 18:55:01 +03:00
Yuri Tseretyan
e00260465b
Alerting: Fix provenance guard checks for Alertmanager configuration to not cause panic when compared nested objects (#69009)
* fix current settings parsed as new
* replace map comparison with cmp.Diff and log the diff
2023-05-25 11:41:11 -04:00
Jean-Philippe Quéméner
5717d8954f
Alerting: Return empty list on export if no rules exist (#69023) 2023-05-25 14:12:18 +02:00
Ieva
4980b64274
RBAC: Remove legacy ac from authorization middleware (#68898)
remove legacy AC fallback from RBAC middleware, and some unused auth logic
2023-05-24 09:49:42 +01:00
Yuri Tseretyan
ab5a3820d5
Alerting: Fix status code of successful response POST /api/alertmanager/grafana/api/v2/silences in swagger specs (#67951)
* update status code to reflect reality

* update docs
2023-05-15 11:23:30 -04:00
Emil Tullstedt
23a9963507
Chore: Upgrade Prometheus to 2.43.0 (#67853)
- github.com/prometheus/prometheus => 2.43.0 (aka 0.43.0)
- github.com/prometheus/client_golang => 1.15.1
2023-05-10 14:09:49 +02:00
Virginia Cepeda
e1ff434917
Alerting: Change text on cloud AM email addresses for contact points (#68143) 2023-05-10 10:44:17 +02:00
Matthew Jacobson
5422609fb1
Alerting: Fix broken integration test (#68140)
From https://github.com/grafana/grafana/pull/68122
2023-05-09 22:27:40 +03:00
Jean-Philippe Quéméner
8bb62a8316
Alerting: Add option for memberlist label (#67982) 2023-05-09 10:32:23 +02:00
Matthew Jacobson
91471ac7ae
Alerting: Template Testing API (#67450) 2023-04-28 15:56:59 +01:00
Yuri Tseretyan
9eb10bee1f
Alerting: Scheduler use rule fingerprint instead of version (#66531)
* implement calculation of fingerprint for ruleWithFolder
* update scheduler to use fingerprint instead of rule's version
2023-04-28 10:42:16 -04:00
Uwe Sommerlatt
dfc99cdd19
Alerting: Fix misleading status code in provisioning API (#67331)
Fixes #66249
2023-04-27 09:25:34 +01:00
Santiago
b0881daf23
Alerting: Use URLs in image annotations (#66804)
* use tokens or urls in image annotations

* improve tests, fix some comments

* fix empty tokens

* code review changes, check for url before checking for token (support old token formats)
2023-04-26 13:06:18 -03:00
Yuri Tseretyan
a8b4a4bb45
Alerting: Update alerting module to 20230418161049-5f374e58cb32 + refactoring (#66622)
* update to alerting 20230418161049-5f374e58cb32
* rename renamed structs in https://github.com/grafana/alerting/pull/73
* update ValidateContactPoint to use BuildReceiverConfiguration
* update logger factory according to changes
* rewrite integration builder
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2023-04-25 13:39:46 -04:00
Alexander Weaver
117636e8ca
Alerting: Fix panic when reparenting receivers to groups following an attempted rename via Provisioning (#67167) 2023-04-24 21:23:23 -04:00
Steve Simpson
9effb9a708
Alerting: Allow hooking into request handler functions. (#67000)
* Alerting: Allow hooking into request handler functions.

Adds a facility to AlertNG for hooking into API handlers, allowing the
replacement of request handlers for specific paths. One of goals of this
approach was to allow hooking as late as possible in the request, e.g.
after all middleware has been applied, to simplfiy usage.

* Update pkg/services/ngalert/api/hooks.go

Co-authored-by: gotjosh <josue.abreu@gmail.com>

* Update pkg/services/ngalert/api/hooks.go

Co-authored-by: gotjosh <josue.abreu@gmail.com>

* Update pkg/services/ngalert/ngalert.go

Co-authored-by: gotjosh <josue.abreu@gmail.com>

* Fixes to review comments

* Fix passing logger in

---------

Co-authored-by: gotjosh <josue.abreu@gmail.com>
2023-04-24 18:18:44 +02:00
Jean-Philippe Quéméner
bbce69f295
Alerting: Use configured headers for external alertmanager (#63819) 2023-04-21 16:16:27 +02:00
Matthew Jacobson
eddd4f4508
Alerting: Add totalsFiltered to RuleResponse for hidden by filters count (#66883)
Alerting: Add totalsFiltered to RuleResponse to facilitate hidden by filters count

Currently, when both a limit_alerts and a matcher/state filter is applied, there is not enough information to determine how many alert instances were hidden by the filters. Only enough to determine the total hidden by the limit and filter combined.

This change adds a separate totalsFiltered field alongside the AlertRule totals that will contain the count of instances after filters but before limits.
2023-04-21 09:35:12 +01:00
George Robinson
35342a3c76
Alerting: Fix DatasourceUID and RefID missing for DatasourceNoData alerts (#66733)
This commit fixes a bug where DatasourceUID and RefID annotations are
missing for DatasourceNoData alerts in Grafana 9.5. This bug affects
datasource plugins that have moved to using the data plane contract.
2023-04-20 14:38:20 +01:00
George Robinson
883dcc81c0
Alerting: Add tests for Evaluate (#66739) 2023-04-20 11:24:40 +01:00
Alexander Weaver
3634079b8f
Alerting: Attach hash of instance labels to state history log lines (#65968)
* Add instanceID which is hash of labels

* Rename field to fingerprint

* Move to prometheus style signature

* Appease linter
2023-04-19 14:22:19 -05:00
Jean-Philippe Quéméner
bc11a484ed
Alerting: Add support for running HA using Redis (#65267)
Co-authored-by: Steve Simpson <steve.simpson@grafana.com>
2023-04-19 17:05:26 +02:00
Alexander Weaver
a384194e15
Alerting: Use default page size of 5000 when querying Loki for state history (#66315)
Always specify limit of 5000
2023-04-18 14:31:29 -05:00
Alexander Weaver
cf7157f683
Alerting: Capture refID of rule's condition expression in Loki state history entries (#66419)
* Capture condition from rule

* Add test
2023-04-18 14:21:28 -05:00
Alex Moreno
f64a89727e
Alerting: Allow provenance disable in alerting provisioning API (#63650)
* Allow provenance None in alert rule update and rule group replace

* Allow provenance None in contact point update

* Allow updating policies to none by sending x-disable-provenance header

* Allow mute timings to disable provenance with x-disable-provenance header

* Allow disabling provenance by using x-disable-provenance header

* Add provenance helper to lower the cyclomatic complexity

* Do not downgrade provenance except un ReplaceRuleGroup

* Add function explanation and change error handling

* Add docs for x-disable-provenance changes (#66300)

* Add docs for x-disable-provenance changes

* Apply suggestions from code review

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update _index.md

---------

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>

* Update docs/sources/alerting/set-up/provision-alerting-resources/_index.md

Co-authored-by: George Robinson <george.robinson@grafana.com>

* Add error message check in tests

* Change docs

---------

Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: George Robinson <george.robinson@grafana.com>
2023-04-18 15:10:36 +02:00
Kyle Brandt
840fb32ad8
SSE: (Instrumentation) Add Tracing (#66700)
spans are prefixed `SSE.`
2023-04-18 08:04:51 -04:00