* Alerting: Improve notification policies created during migration
Previously, migrated legacy alerts were connected to notification policies through
a `rule_uid` label in a 1:1 fashion. While this correctly mimicked pre-migration routing,
it didn't create a notification policy structure that is easy to view/modify. In addition,
having one policy per migrated alert is, in some ways, counter to the recommended approach of
Unified Alerting.
This change replaces `rule_uid`-based migrated notification policies with a private
label called `__contacts__`. This label stores a list of double quoted strings containing the names of
all contact points an AlertRule should route to (based on legacy notification channels). Finally,
one notification policy is created per contact point with each matching AlertRules via regex on this
`__contacts__` label.
The result is a simpler, clearer, and easier to modify notification policy structure, with the
added benefit that you can see which contact points an AlertRule is being routed to from the
AlertRule creation page.
* RBAC: Change the generate uid function to be deterministic so we can avoid collision
* RBAC: Use fmt.Errorf
* RBAC: Add comment
* RBAC: Export GenerateManagedRoleUID
* Theme: Inter font change with new line-height
* Add it behind feature toggle
* make buildVariant easier to read + enforce integer multiples of 2 (#56486)
* Minor update
* Update
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
* Create caching dashboard resolver
* A couple tests for dashboard resolving
* Log warning on not found
* Additional polish + review nits
* Move to singleflight instead of a plain mutex
* Store errors instead of -1 in cache and use reflection when reading
* Address linter error
* One more linter error
* initial cut at refactor - need to run more tests
* fix unit tests
* change newly unused function to test helper
* create unit tests for parsing query requests that cover a range of cases
* add some comments
* rename function to avoid dev confusion
* add api route for validating a dashboard json
* add feature flag for showDashboardValidationWarnings
* tidy up
* comments and messages
* swagger specs
* fix typo
* more swagger
* tests!
* tidy test a little bit
* no more ioutil
* api will return different status code depending on validation error
* clean up
* handle 4xx errors
* remove console.log
* fix backend tests
* tidy up
* Swagger: Exclude alpha endpoints
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* Elasticsearch: Fix calculation of trimEdges
When a value of trimEdges is set greater than 1 we need to drop both the
first and last sample of the data from the response.
* Elasticsearch: Fix reading trimEdges from the query settings
Currently the trimEdges property in the JSON panel is stored as a string
and not directly as a number.
This caused that the reading of the value failed in the go backend
because the simplejson.Int() method doesn't properly handle this case.
This failure when decoding the value goes unnoticed because of the early
return causing the trimEdges configuration to be ignored.
* Refactor castToInt to also return an error
Add a new test case that sets the `trimEdges` property as a quoted
number.
* Added nextPageToken prop
* Adding first and pageToken condition to while loop
* clean up
* revert gitignore
* fix go lint
* Added logic to builder too
* Removed pageSize - was for local testing
* gofmt
* extracted doRequest function
* extracted doRequest in query too
* Adressed filter comments
* Adressed query comments
* go fmt
* removed pageSize added for testing
* go fmt again
This PR adds an audit table for public dashboards allowing a user to view all public dashboards on an instance of grafana. The public dashboards team is working on a proposal for adding RBAC support to the audit table for 9.3
Co-authored-by: juanicabanas <juan.cabanas@grafana.com>
* LDAP: Add skip_org_role_sync option
* Document the new config option
* Nit on docs
* Update docs/sources/setup-grafana/configure-security/configure-authentication/ldap.md
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
* Docs suggestions
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Jguer <joao.guerreiro@grafana.com>
* Add test, Fix disabled user when no role
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Jguer <joao.guerreiro@grafana.com>
When testing a rule within the legacy alerting the `timeMs` field could
sometimes show negative (and/or wrongly calculated) durations. This happens if the alert evaluation crosses a second boundary. This change uses the full timestamp to compute the eval duration.
* Chore: move folder service interface into a separate package
* copy implementation into a standalone package
* move implementation and tests to the new folder package
* remove leftovers from wire
* add test doubles for folder service
* fix tests in library panels/elements
* fix provideservice in ngalert
We have received a lot of feedback regarding the ValueString in alert notifications. Perhaps one of the most frequent complaints about ValueString is that it is difficult to read because it contains a lot of information, and the information is shown as a JSON-like string. Users have often asked how it can be templated and the answer is that it can't.
Until now users have been able to add custom annotations to their alert rules which contains values via the $values variable added in previous versions of Grafana. However, these custom annotations must be added for each of the user's alert rule, instead of once in a template that all of their alerts can be notified via.
This commit adds then the much requested feature to support values in notification templates. Users can then create a single template that prints the annotations, labels and values of their alerts in a format of their choice!