* Support delete endpoint for folders
* Include authorizer
* Add test for delete verb
* Add delete command to delete options
* Pass query string to context to admission
* Dont support nested folder deletion for now
* Skip test if feature flag is present
* Add test case
* Remove comment
* Only rely on the storage type config to run alerting tests
* Dont change legacy subpath
* Remove unised function
* Add test case when an editor can delete alert rules
* Lint
* created config doc, made initial changes
* initial draft of config doc completed
* additional edits
* moved config doc into directory, renamed
* made additional updates
* template variables updates/cleanup
* cleaned up intro page, some more minor edits
* edited and re-formatted configure the data source doc
* final edits
* more edits
* minor changes prior to PR
* fix typo
* Update docs/sources/datasources/influxdb/_index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/_index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/_index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/_index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/_index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/query-editor/index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/query-editor/index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/template-variables/index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/query-editor/index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/configure-influxdb-data-source/_index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Update docs/sources/datasources/influxdb/query-editor/index.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* updates based on feedback
* ran prettier
---------
Co-authored-by: Irene Rodríguez <irene.rodriguez@grafana.com>
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Merge in default threshold base if exists
* Fix tests to not expect default threshold
* Add config from query example to gdev
* Add a test around the merging of thresholds
* Revert "Add config from query example to gdev"
This reverts commit a239224ebb.
* update gdev
* Add note about keeping the base threshold
* Update public/app/features/transformers/docs/content.ts
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
* Merge in generated code
---------
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
* test: add skeleton for initial unit tests
* test: add basic tests for DataTrailsHome
* test-wip: add tests for recent metrics functionality, but need to move from DataTrailsHome.test to DataTrailsRecentMetrics.test
* wip: tests for DataTrailBookmarks
* test: add tests for recent metrics; refactor: make DataTrailsRecentMetrics accept onSelect as prop rather than whole trail; test: add tests for DataTrailCard (WIP)
* test: add test for truncates long list of labels after 3 lines in recent explorations
* refactor: make DataTrailBookmarks take in onSelect and onDelete as props rather than a whole trail and onDelete; test: add tests for bookmarks (WIP)
* remove deprecated style
* fix import issues
* fix getTrailForBookmark tests by returning a trail, clean up tests
* chore: delete notes to self
---------
Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
* Add github app token generation in pipelines that use GITHUB_TOKEN
* ci?
* clone gh repo using x-access-token user
* address linting issues
* use mounted volume for exporting token
* remove unused github_token env var swagger gen step
* replace pat on release_pr pipepline
* cleanup GH PAT references
* linting
* Update scripts/drone/steps/lib.star
* make drone
---------
Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
* add new option for multi variables to lock value list wip
* WIP - lock option list
* tests
* fix
* fixes + canary scenes
* wip
* wip
* fix snapshot
* bump scenes
* Dashboards: Add possibility to lock adhoc variables options list (#96077)
* Lock list of options flag for ad hoc
* refactor
* fix snapshot
* Refactor OAuthToken service
* introduce user.SessionAwareIdentityRequester
* replace login.UserAuth parameters with user.SessionAwareIdentityRequester
* Add nosec G101 to fake ID tokens
* Opt 2, min changes
* Revert a change to the current version
This patch marks ID tokens as not required when initalising a gRPC
Authenticator to be used in `cloud` mode. ID Tokens are still enabled in
`cloud` mode, but the `Required` option is set to `false`.
This is needed for MT services like Cloud API Server to authenticate
against gRPC services like Resource Store with only an Access Token.
Signed-off-by: Prem Kumar <prem.saraswat@grafana.com>
* Update existing property once we save the new rule data and stay in the same page
* prettier
* use cache invalidation for updating the existing property
* fix cloud usecase
* add group mapping UID returned mapped roles
* request mapped roles from the frontend, but don't attempt to update mapped roles
* lock mapped roles and show a pop-up message about why a role is locked
* update role selectors to not allow deselecting a mapped role
* swagger gen
* simplify and set mapped as bool instead of mapping UID array
* swagger gen
* Dashboard: Panel edit and support for more layout items
* It's working
* Fix discard issue
* remove unused file
* Update
* Editing for responsive grid items now work
* Update
* Update
* Review fix
* optimize tokens count from service accounts query
* add unit tests for tokens count
* skip broken test
* fix lint error
* rename Tokens to TokenCount
* Move TraceQL metrics queries to backend
* Add tests for TransformMetricsResponse
* Add tests for createMetricsQuery
* Refactor, detect metric queries and throw error for search queries
* Remove unneeded types
* Don't add start and end if they are 0. Return on err
* lint
* Fix pre-alloc of frames
* Address PR comments
* Explore: store displayedFields in URL state
* Displayed fields: reset when queries change
* Add test
* LogRowMessageDisplayedFields: pass logRowMenuIcons props to component
* LogsMetaRow: use primary outline for reset button
* Logs: clear displayedFields from URL
* fix pseudo locale and add simple e2e test
* add comment
* update test and add comments
* fix unit test
* try 5 instead of 6?
* clear input
* only check pseudo in dev mode
* don't check pseudo in CI
* don't test pseudo locale
* isolate language changes
* move waits around
* only wait for preferences on first visit
* add proper loading state
* bit of tidy up
* hook up ids correctly
* use disabled/isLoading instead of skeleton
* set props on Field
* Support undefined value
* Check truthiness of value instead
* check falsy
* Conditional typing for clearing value
* Less restrictive default typing
* simplify props
* Add tests for autosizing
* Write failing test case
* Add list of falsy values
* Check if nullish
* Check nullish in itemToString
* Nvm, it doesn't matter here
* Add support for autoFocus
* Pick from InputProps
* Move docstring
* Solve type issues in Storybook
* Fix failing story
feat: inject server-timing header to match initial loads with client-side telemetry
Faro Web SDK can read the server-timing info and
correlate the initial request with the client side telemetry gather from navigation timings.
* Rename method applyTemplateVariables so it used by backend
* Zipkin: Move query running to backend
* Fix error source
* Hndle invalid query and return error response
* create a new state and set at the end
* propagate labels datasource_uid and ref_id from current state if it's error
* copy the state when apply to all
* add note that support for Auth0 audience feature is not available
* Update docs/sources/setup-grafana/configure-security/configure-authentication/generic-oauth/index.md
Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
---------
Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
Certain combinations of KeepLast state transition annotations exceed the current
limit of 25 characters. This increases the column size limit to be able to
handle the longest combination (27) with some extra space for comfort.
* Fix toDTO
* Remove conversion function for folder dto
* Convert toDTO to a standalone function
---------
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
* rewriting installation docs and including info about airgapped environments
* Changing example to lokieexplore app
* run prettier
* adding corrections
* running prettier
---------
Co-authored-by: Irene Rodriguez <irene.rodriguez@grafana.com>
* Remove reducer when using a non complex query that is instant
* remove reducer when changing data source
* Fix whenField
* use DataSourceType instead of string literal
* add reducer when using range
* add tests
* use an object for SimpleCondition refids identifiers
* fix threshold expression to point to B after switching back to range
* address pr review comments
* refactor: extract reducer optimization to the reducer
* fix tests
* fix snapshot
* rename constants
* add a warning for components when they exceed the recommended options amount
* Update packages/grafana-ui/src/components/Combobox/Combobox.tsx
Co-authored-by: Tobias Skarhed <1438972+tskarhed@users.noreply.github.com>
* Update packages/grafana-ui/src/components/Combobox/Combobox.tsx
Co-authored-by: Tobias Skarhed <1438972+tskarhed@users.noreply.github.com>
* log faro
* log once with flag
* log in setItems
* move logOptions to utils and write tests
* import function, update betterer for combobox
* Fix lint errors
* log once without the try
* fix tests
---------
Co-authored-by: Tobias Skarhed <1438972+tskarhed@users.noreply.github.com>
Co-authored-by: joshhunt <josh@trtr.co>
* initial passwordless client
* passwordless login page
* Working basic e2e flow
* Add todo comments
* Improve the passwordless login flow
* improved passwordless login, backend for passwordless signup
* add expiration to emails
* update email templates & render username & name fields on signup
* improve email templates
* change login page text while awaiting passwordless code
* fix merge conflicts
* use claims.TypeUser
* add initial passwordless tests
* better error messages
* simplified error name
* remove completed TODOs
* linting & minor test improvements & rename passwordless routes
* more linting fixes
* move code generation to its own func, use locationService to get query params
* fix ampersand in email templates & use passwordless api routes in LoginCtrl
* txt emails more closely match html email copy
* move passwordless auth behind experimental feature toggle
* fix PasswordlessLogin property failing typecheck
* make update-workspace
* user correct placeholder
* Update emails/templates/passwordless_verify_existing_user.txt
Co-authored-by: Dan Cech <dcech@grafana.com>
* Update emails/templates/passwordless_verify_existing_user.mjml
Co-authored-by: Dan Cech <dcech@grafana.com>
* Update emails/templates/passwordless_verify_new_user.txt
Co-authored-by: Dan Cech <dcech@grafana.com>
* Update emails/templates/passwordless_verify_new_user.txt
Co-authored-by: Dan Cech <dcech@grafana.com>
* Update emails/templates/passwordless_verify_new_user.mjml
Co-authored-by: Dan Cech <dcech@grafana.com>
* use & in email templates
* Update emails/templates/passwordless_verify_existing_user.txt
Co-authored-by: Dan Cech <dcech@grafana.com>
* remove IP address validation
* struct for passwordless settings
* revert go.work.sum changes
* mock locationService.getSearch in failing test
---------
Co-authored-by: Mihaly Gyongyosi <mgyongyosi@users.noreply.github.com>
Co-authored-by: Dan Cech <dcech@grafana.com>
* Set CoreServices as codeowners for SQL Expressions
* Set CoreServices as CodeOwners for ALL SSEs
Don't limit to SQL Expressions alone, but take all of the
Server Side Expressions
* updated kiosk behaviour
* Removed TV mode and updated Normal mode
* Updated kiosk mode and other small edits
* Removed dashboard controls from playlist controls section and reformatted
* Added playlist controls behaviour in kiosk mode
* Updated Use dashboards image and descriptions
* Docs: Clean up basic auth, anonymous access and main pages for auth configuration
* Fix the typo
* Prettier should fix this
* fix minor typo
* Update docs/sources/setup-grafana/configure-security/configure-authentication/_index.md
Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
---------
Co-authored-by: Irene Rodríguez <irene.rodriguez@grafana.com>
Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
* Move the configuration options to the bottom and extend it
* Improve assertion mapping docs for Okta
* fix typo
* Update index.md
---------
Co-authored-by: Irene Rodríguez <irene.rodriguez@grafana.com>
* Use 0 for window functions if value does not exist
* Simplify logic, add test
* Fix tests, have first value count as 0 if null as well
* evaluate entire array instead of individual values
* Adjust logic, move prior results back
* add docs describing what GAS is and how it can be configured
* Update configure-group-attribute-sync.md
* Update configure-group-attribute-sync.md
---------
Co-authored-by: Aaron Godin <aaron.godin@grafana.com>
* Postgresql: Support tables from non-default schema
- Add support for schema-qualified table names.
- Partially resolve an issue where the column type of a table from the
wrong schema with the same table name was incorrectly used. Now
limited to tables of schemas within the search_path.
* Support schema in raw query editor
---------
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
* Rename from AllowedKubernetesNamespace to Namespace
* Use a sync hook to always set namespace for Identity.
* format
* Don't set uid when authenticating as user
* Refactor basic usage with stateReducer
This is a combination of 3 commits.
This is the 1st commit message:
more wip
This is the commit message #2:
even more wip
This is the commit message #3:
got basic usage working well with stateReducer
remove unrelated change
todo tests
* fix behaviour for async
* clean up dev stuff
* story
* Fix options being cleared for non-async combobox
* Fill out tests!
* put story back
* clean up metriccombobox test
* show selected value as placeholder while menu is open
* properly fallback placeholder to the prop
* Hide `Instances` field in RuleDetails view for recording rules
* Alerting UI: add `helpLink` to Recording Rules docs
* Make the Metric input placeholder more explicit for recording rules
* adding ignoreUrls param to EchoSrvTransport
* adding test for ignore urls
* linting
* cleaning up
* adding a new error message to the list of ignored errors
* check error for source and check http status for source
* refactor
* add source to health check status code as well
* remove error where it will be nil
* Use different threshold x/y coordinates depending on orientation
* invert wording / semantics
---------
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
* Move server init into server package
* map store name to id
* refactor model loading
* pass namespace into reconcilers and collectors
* refactor
* Extend authz server with Read and Write methods
* use new read/write in reconciler
* implement server side read and write
* Sync permissions for every org
* handle namespace in check and list
* split read and write
* provide conditions
* Fix client implementation
* fix nil conditions
* remove unused client code
* use lock for store access
* move type translators to common package
* fix folder collector
* fix store creation
* remove unused AuthorizationModelId
* fix server tests
* fix linter
* Remove collectors
* Remove zanzana search check, we need to rewrite that part to the new schema
* Only use generic resource schema and cleanup code we don't want to keep / need to re-write
* useRef instead of create ref for functional components, pass function to close popper if needed
* Cleanup, hide on save as well
* add comment about when hidePopper is available to content
* try to enable cache on golangci linter
* bump version
* exclude G115
* reduce timeout
* remove deprecated linter
* bump linter version in bingo
* try a different syntax for workspace modules
* try another command
* add apps to linter path
* try disabling cue codegen
* skip some linting in devenv
* exclude dirs and try again
* try workaround for pkg
* try path instead of dir
* make it one line
* replace package prefix
* exclude xorm
* exclude wire
* file-based aproach to nolint in workspaces
* missing quote
* simplify command line
* change ownership
* Zipkin: Run health check through backend
* Mark some errors as downstream
* Update pkg/tsdb/zipkin/zipkin.go
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
* Use errors.New where error formatting is not needed
* Remove executable in plugin.json
* Fix joining the path
* Keep logger as global and then create from context
* Close the res body
---------
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
* Intro: simplify `Architecture`. Add a new guideline
* Define `Notification policies` as an advanced option
* Intro: include about "Notification messages"
* Minor copy changes
* Check if sidecar is used
* Update packages/grafana-runtime/src/services/SidecarService_EXPERIMENTAL.ts
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
---------
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
* WIP - build tenant indexes concurrently
* adds local dev seeders and readme for indexer
* update logging and adds locking in getShard()
* update logs
* Adds Namespaces func. Initializes index after ResourceServer is created.
* fixes Count() and updates test lint issues
* Initialize index separately. Don't do it when creating the resource server. Makes testing really awkward.
* fix lint error
* handles error when getting namespaces
* updates test and index helper funcs
* handle regex matchers with flags
* add test in alertmanager.test.ts
* refactor to use the same matching functions
* lint
* lint again
* move matchers functions to matchers.ts
---------
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
* Prometheus: Fix escaping of quotation marks for non-regex variables
* Prometheus: Fix escaping of double quotation marks for regex variables
* Prometheus: Add escaping for adhoc filter label queries
* initial logs integration
* rename back to Integrations
* remove comments
* connect related logs in metrics with logsIntegration service
* rename
* remove comments
* feat: related logs with loki expr
* fix: layout & var updates
* refactor: prefer scene state to context
* fix: limit DS select to relevant loki DSes
* refactor: use existing utils
* refactor: types
* fix: tests and types
* refactor: simplify
* refactor: prefer precise data updates
* refactor: prefer variable for key
* refactor: simplify panel search
* refactor: remove unnecessary short-circuit
* fix: ensure single network request for logs
* fix: add missing limit to fetched log lines
* refactor: add clarity
* refactor: organize imports
* feat: messaging for No Related Logs case
* fix: add missing space
* chore: add `exploreMetricsRelatedLogs` feature toggle
* feat: link to Explore Logs app
* fix: i18n
* fix: use sentence case consistent with design system
* style: avoid competing with metricscene buttons
* fix: capitalization for names
* fix: a11y
* refactor: clean up and document utils
* fix: formatting
* chore: run `make i18n-extract`
* test: improve coverage
* test: fix module resolution side-effects
* extract only the first rule
refactor: organize imports
* remove unnecessary test files
---------
Co-authored-by: Nick Richmond <nick.richmond@grafana.com>
* Alerting docs: Update `Create alert rules from panels`
* Remove screenshots except when the panel displays alert status
* Further changes sync with Brenda
* minor changes
* Relocate admonition
* Specify `dashboardUId` and `panelId` must be set together
* Update docs/sources/alerting/alerting-rules/link-alert-rules-to-dashboards.md
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
* change title
* change URL
* fix spell error
---------
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
* refactor breakdown scene
* refactor BreakdownScene along with LayoutSwitcher
* rename
* don't pass default layout
* better type handling
* betterer
* add @bsull/augurs
* implement LabelBreakdownScene
* integrate SortByScene in LabelBreakdownScene
* move to new directory
* introduce BreakdownSearchScene
* integrate searchScene
* cleaning
* initialize @bsull/augurs
* add interaction
* use new breakdown scene
* resolve merge conflicts
* ugrade @bsull/augurs
* update import
* update css
* update tooltip text
* refine sorting
* fix unit test
* fix
* implement outlier detector
* support wasm
* jest testing fix
* localization fix
* use unknown instead of any
* update i18n
* update betterer
* fix locales
* update test
* fix tests maybe
* prettier
* chore: update jest config
* chore: create mock for @bsull/augurs (#92156)
chore: create mock for bsull/augurs
@bsull/augurs assumes it will be running as an ESM, not
a CommonJS module, so can't be loaded by Jest (specifically
because it contains a reference to import.meta.url).
This PR provides a mock implementation which gets tests passing
again.
Ideally we'd be able to load the actual @bsull/augurs module
in tests so this is just a stopgap really, until a better
solution appears.
* fix unit tests
* remove unused BreakdownScene.tsx
* set outliers as undefined if an error occurs
* Add labels
* betterer
* reset event implemented
* fix controls positioning
* update augurs
* betterer
* i18n
* conflict fixes
* update texts
---------
Co-authored-by: Matias Chomicki <matyax@gmail.com>
Co-authored-by: Ben Sully <ben.sully@grafana.com>
* Alerting: Keep state manager cache during cache warm-up
Instead of overwriting the state manager cache during warm-up,
we update the data in the cache if it is not there yet. If the cache
already contains a state entry with the same key, we do not overwrite it.
* indexer integration tests WIP
* make protobuf
* Adds a few more integration test cases to cover the basics. Use Limit instead of Size param from SearchRequest.
* skip if testing.Short()
* adds test comments
* Scan direction: add experimental badge
* Logs model: keep data when the response contains errors
* SupplementaryResultError: extend behaviors
* LogsVolumePanel: add custom message for partial shard data
* SupplementaryResultError: add size prop
* SupplementaryResultError: remove size prop and adjust sizes
* Infinite scroll: disable when direction is scan
* Fix lint issues
* logsModel: add logs volume test
* chore: unfocus test
* modifyQuery: add function to add drop statement to queries
* Shard query splitting: split metric queries
* Shard query splitting: drop stream shard from metric queries
* Fix tests
* logsModel: skip coverage data when the direction is scan
* Add getter to FolderAPIBuilder so that we can access it in admission
* Remove deprecated return
* Fix test
* Update pkg/registry/apis/folders/register_test.go
Co-authored-by: maicon <maiconscosta@gmail.com>
* Fix maxNested folder test
* Remove log
---------
Co-authored-by: maicon <maiconscosta@gmail.com>
* Uses Combobox in Prometheus for the metrics select, behind feature toggle
* switch to new async combobox api
* clean up MetricCombobox, add in dev slowness
* wip
* reset combobox changes to other pr https://github.com/grafana/grafana/pull/95191
* restore placeholder
* wip
* tests :)
* remove history comment
* use main import
* add new otel grouping variables
* add call for resource attributes for a metric
* add function to update variables for otel join
* interpolate metric in match param
* update group left when starting trail
* process the group left before setting the metric and showing the metric scene
* add attributes to metric overview list
* change label name to attributes because it contains resource attributes and metric attributes
* add resource attributes to label breakdown select
* add otel resource attribute to filters from label breakdown
* add otel flag for rudderstack event when breakdown label selected
* for translations
* add test for new variable in datatrail spec
* add test for filtering otel resource attributes
* update documentation
* add tests for updating the join query with group left resource attributes
* use Nick and Ismail's suggestions, return early, space and no type needed for timerange
* remove unused import
* wip: homepage (new user)
* fix: spacing between button and text; wip refactor: separating bookmarks and recent metrics from home page
* feat: new user homepage; wip: need to clean up code
* fix: change rocket icon to svg
* wip feat: rendering recent metrics
* chore: add comments to understand code, will need to delete / cleanup later / pare down into documentation comments
* wip: new recent metric card design
* wip: display recent metrics cards in rows of 3 (height still incorrect)
* feat: apply conditional styling to remainder recent metrics exploration cards (any cards that are not a complete row of 3)
* fix: render new recent metrics explorations without refresh
* style: render recent metrics explorations in rows of 3 using grid instead of flex; fix: remove remainder card styling
* fix: remove delete button from recent metrics exp cards
* style: make background color for each card take up the entire card/grid space; make height of cards for each row the tallest card
* chore: clean up code
* fix: fix eslint errors
* style: implement recent metrics card header styling
* style: in recent metrics exp cards, format datasource line
* fix: add initial value for _lastModified to fix eslint err
* style: format date correctly; chore: clean up code; wip: get date to render properly on bottom left
* style: make inner card height match outer card height; style: add date footer; style: wrap last metric name; style: wrap labels
* style: adjust font for label name and label value
* style: truncate singular label if value is greater than 35 characters
* style: truncate singular long labels at 44 characters; style: truncate multiple labels at 3 lines; style: correct the border width and radius
* style: make background border radius match the border
* style: correct gap between rows and columns of cards; style: correct padding inside card
* chore: clean up code
* refactor: apply new card UI to DataTrailCard component
* feat: add bookmarks (not formatted correctly), only render section if there are bookmarks, hook up delete functionality
* style: add horizontal line above bookmarks header; style: add bookmarks header
* style: add additional padding above bookmarks divider; chore: delete unused code
* style: add carrot button to bookmarks; style: format heading font style
* refactor: separate bookmarks into functional component; feat: make bookmarks section collapsed by default; feat: allow toggle to expand bookmarks section
* style: position delete button for bookmarks in bottom right of card
* fix: only render recent metrics and bookmarks headings if there are any
* style: add show more button (not functional); style: fix padding around show more button
* chore: delete unused code
* fix: add back gap underneath bookmarks header
* feat: implement show more/less button for recent metrics
* fix: do not show select metric card if user does not actually select a metric
* chore: preliminary code clean up
* chore: delete console.logs, comments
* chore: clean up styling
* Update public/app/features/trails/DataTrailCard.tsx
Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
* fix: add i18nKey to Trans tags
* fix: attempt to remove go.work.sum changes that are unrelated to my PR
* fix: add Trans tags
* refactor: sepearate recent metrics into functional component; chore: delete unused code; fix: add Trans tags
* chore: generate translation json
* trigger drone
* trigger drone
* fix: add trans tag to date
* chore: abbreviate descriptive key, regenerate json
* Update public/app/features/trails/DataTrailBookmarks.tsx
Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
* Update public/app/features/trails/DataTrailsRecentMetrics.tsx
Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
* Update public/app/features/trails/DataTrailBookmarks.tsx
Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
* fix: revert trans tag on date created to fix formatting
* chore: return null immediately if no recent metrics
* style: add margin between bookmarks header and carrot toggle button
* style: adjust margin to 8px between bookmarks header and carrot toggle button
* style: make margins multiples of 4
* Update public/app/features/trails/DataTrailBookmarks.tsx
Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
* style: fix light mode styles; style: fix border radius
* fix: save select metric view as recent metric card if labels are applied
* Update public/app/features/trails/DataTrailCard.tsx
Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
* refactor: move rocket svgs into assets folder
* chore: add back accidentally deleted console log
* Update public/app/features/trails/DataTrail.tsx
Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
* Update public/app/features/trails/DataTrailBookmarks.tsx
Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
* chore: revert lastModified related changes since behavior appears to remain the same
* fix: add back lastModified changes because they make the recent metrics show more functionality work
---------
Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
* add user ID API translation
* add uid to user frontend
* use users' UIDs in admin pages
* fix ldapSync page
* use global user search for user by UID
* remove active org filtering
* remove orgID params
* sandboxfy alerting tutorial part 2
* format
* format2
* added frontmatter
* all pretty no pity
* added setup, login
* link
* STEPS
* login link
* update steps
* improve visibility of part 2
* link
* new diagram image
* img
* all pretty, no pity
* Activate parents of query runner when using dashboard ds
* Set plugin loading util to fix test because activating the ancestors of the query runner needs to be able to load the plugin for the panel
* Rename activateInActiveParents -> activateSceneObjectAndParentTree
* Add back but deprecate activeInActiveParents
* Improves initial indexing speed. Makes params configurable.
* fix linter errors
* removes kind param
* updates index test
* remove println from test
* removes error check in test
* adds log for high index latency ands updates max goroutine var with workers config var
* fix test timing out - set worker limit
* set the batch size
---------
Co-authored-by: Scott Lepper <scott.lepper@gmail.com>
* updated steps
* update before you begin
* updated title
* update title 2
* elaborated on 'Sample logs' section
* updates to improve visibility
* updated links
* format
* updated link
* links and steps
* updated call-to-action boxes
* updated box
* title
* format
* steps
* format
* Made docs live in the now
* all pretty, no pity
* Activate parents of query runner when using dashboard ds
* Set plugin loading util to fix test because activating the ancestors of the query runner needs to be able to load the plugin for the panel
* WIP - Restructure recording rule pages
* Add more `Recording rules` use cases
* Update `Intro > Alert rules`. Minor style changes and updates to the recording rules section
* Minor verb change
* Switch `aliases` and fix broken link
* Bold for clarity
* Complete `Create recording rules in Grafana Alerting`
* Complete data source-managed recording rules
* Final update
* LogsPanel: add props to prepend or append icons to the log row menu
* LogsPanel: add test and type guard
* LogsPanel: add test
* Fix addonBefore position
* Refactor to be an array of ReactNode
* Remove comment
* chore: add docs
* Linting issues
* Rename to CheckObject
* Implement authz.AccessClient
* Move folder tree to reconciler and use new schema
* Move shared functionality to common package
* Add reconciler for managed permissions and resource translations
* Add support for folder resources
* Fix folder status error message
* Add test for folder creation response message
* Add TestFoldersCreateAPIEndpointK8S fixes
* Fix message returned when user has no permissions
* Only enable Faro if origins are the same in iframe
* Handle non-iframe case
* Remove console logs
* Use try catch to identify cross origin iframe
* Only disable transport
* WIP: setup to test folders GetAuthorizer
* Setup test
* Extract authorizer fn for tests
* Setup internal test fn
* Better define test inputs
* Add FolderAPI builder to the test
* First test passing
* Test getAuthorize for the create method
* Change authorizerFunc's signature
* [REVIEW] code readability
* Name error
* [REVIEW] add one more test case. Lint
* Remove empty line
* Implement initial check with schema for generic resources
* Implement List and add tests
* Add namespace type and change to folder_resource name
* Handle namespace grants for typed resources
* Run tests as integration tests
* Add support for verb in list requests
* build(webpack): set publicpath and process urls to resolve assets correctly
* build(webpack): add back --progress to build
* Add local cdn
(cherry picked from commit 7a19523fa476fd5ff2d7669d116f5be462b100f5)
* chore(devenv): fix local_cdn path in ngnix conf
* chore(codeowners): add frontend-ops as owners of local_cdn docker block
---------
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
* FIX: Remove the checks for lbac rules inside of datasources
* Remove json validation for lbac rules
* Preserve lbac rules in updates
* Refactored test to remove the table structure
* refactor: change to allow naming and concise override instead of complex branching
* refactor to make sure we set an empty field for updates
* bugfix
* check for datasources.JsonData
* fix merge
* add datasource to check for field presence only
* add function call for readability
* Combobox async: Invalidate using timestamp instead of value
* Simulate keyboard delay in test
* Use a counter instead of timestamps
* Fix feedback
* Expand tests to include case discussed on PR
---------
Co-authored-by: Joao Silva <joao.silva@grafana.com>
* Introduce new models RoutingTree, RouteDefaults and Route and api-server to serve them that is backed by provisioning notification policy service.
* update method UpdatePolicyTree of notification policy service to return route and new version
* declare new actions alert.notifications.routes:read and alert.notifications.routes:write and two corresponding fixed roles.
---------
Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
* ref: ds picker events added
* ref: track opendropdown only on click
* ref: update/update all payload added to the event
* ref: configure more ds button event path to from path
* ref: result count fix, enable/disable track
* ref: debounce search tracks
* ref: track connections_plugin_card_clicked
* ref: call tracking from the child comp with result count
* ref: change event names, add creator_team and schema version
* Add installed and latest version information
* get latest changelog for changelog tab from gcom
* fix displaying signature type
* fix integration test
* add translations
* remove gcom request at local changelog method
* extracted in-proc mode to #93124
* allow insecure conns in dev mode + refactoring
* removed ModeCloud, relying on ModeGrpc and stackID instead to discover if we're running in Cloud
* remove the NamespaceAuthorizer would fail in legacy mode. It will be added back in the future.
* use FlagAppPlatformGrpcClientAuth to enable new behavior, instead of legacy
* extracted authz package changes in #95120
* extracted server side changes in #95086
---------
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: gamab <gabriel.mabille@grafana.com>
Co-authored-by: Dan Cech <dcech@grafana.com>
* Transformations: Add field from calc - avoid frame joining in some cases
* Add test for multiple query, 1 field, replace all
* omit frames that had no binary ops performed on them
---------
Co-authored-by: drew08t <drew08@gmail.com>
* fix: Change users permissions search to use a consistent key without collisions
* Move HashString to cacheutils
* Change error handling logic for what to do with a cache key
* Add a test that confirms search cache key consistency
* ds-querier: return QDR instead of k8s error
After parseQuery we know the request is a valid k8s request but we don't
know if the query is valid, therefore this change returns a QDR that
other systems, e.g. alerting ruler, can de-serialize properly.
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
* ds-querier: fix tests
Co-authored-by: Sarah Zinger <sarah.zinger@grafana.com>
* tweak status
* refactor refID to empty
---------
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
Co-authored-by: Sarah Zinger <sarah.zinger@grafana.com>
* no orgname
* format code
* update unit test
* delete contextSrv
* fix unit test
* run prettier
---------
Co-authored-by: Laura Benz <laura.benz@grafana.com>
* add admin permissions upon creation of a folder w. SA
* Update pkg/services/folder/folderimpl/folder.go
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
* Grant service account permissions for creation of dashboards
* Grant service account admin permissions upon creating a datasource
* fetch user using the userservice with the userid
* Revert "fetch user using the userservice with the userid"
This reverts commit 23cba78752.
* revert back to original datasource creation
---------
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
* handle button focus between states
* fix focus when closing the overlay menu from the close button
* move into a separate hook
* properly feature toggle the hook
* use constants
* All objects should have an UID
* Now with a different error message
* Simplify create on DW 2: use the same object to write to both storages
* Run only one test
* Add check for status code
* Add name if it's not present in mode2
* Populate UID in legacy
* Remove logs and commented code
* Change dualwriter1
* Remove commented code
* Fix list test
* remove get on update from dualwriter 2
* Get object before updating. Better var renaming
* Finish rebasing
* Comment test
* Uncomment tests
* Update legacy first. Add preconditions
* Remove preconditions
* Fix update test
* copy RV from unified to legacy objects
* revert changes to playlist xorm store
* Improve logging. Add go routines for mode3
* Add tests for async funcs in mode3
* Lint
* Lint
* Lint. Start to fix tests
* Fix watcher tests
* Fix store tests
* Fiinish fixing watcher tests
* Fix server tests
* add name check
* Update pkg/apiserver/rest/dualwriter_mode1.go
Co-authored-by: Bruno Abrantes <bruno.abrantes@grafana.com>
* All objects should have an UID
* Now with a different error message
* Simplify create on DW 2: use the same object to write to both storages
* Run only one test
* Add check for status code
* Add name if it's not present in mode2
* Populate UID in legacy
* Remove logs and commented code
* Change dualwriter1
* Remove commented code
* Fix list test
* remove get on update from dualwriter 2
* Get object before updating. Better var renaming
* Finish rebasing
* Comment test
* Uncomment tests
* Fix update test
* revert changes to playlist xorm store
* Improve logging. Add go routines for mode3
* Lint
* Fix watcher tests
* Fiinish fixing watcher tests
* Add mode 5 with etcd test case. Add early check to fail on populated RV in payload
* we can't set RV to the found object when updating
* Lint
* Don't fail on update playlists
* Name should not be different when updating and it should be not empty on creating
* Fix tests
* Update pkg/apiserver/rest/dualwriter_mode2.go
Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
* Lint
* Fix mode 5 tests
* Lint
* Add generateName condition on every mode. Fix tests
* Lint
* Add condition on where name or generate name have to be set
* Fix test
* Lint
* Fix folders test
* We dont need to send name for mode1
* Fail if UID is not present
* Remove change from not running test
* Remove unused line
* Lint
* Update pkg/storage/unified/apistore/store.go
Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
* Improve error message
* Fix broken watcher test
* Fail on name mismatch on update
* Remove log
* Make sure UIDs match on create in both stores
* Lint
* Write first to unified storage
* Remove uid setting
* Remove RV only in mode2
* Fix test. Remove log line
* test
* No need to asser on RV in mode3
* Remove RV check due to race condition
* Update dualwriter.go
Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
* Update pkg/storage/unified/client.go
* remove unused parameter
* log an error for object is missing UID instead of returning an error
* remove obj.SetResourceVersion("")
* log an error for object is missing UID instead of returning an error
* FInalise merge
* Move RV check to where it was
* Remove name check
* Remove server check for backwards compatibility
* Remove unused fn
* Move test checks for another PR
* Dont commit go work sum changes
* Only log error if RV is present for now.
---------
Co-authored-by: Todd Treece <todd.treece@grafana.com>
Co-authored-by: Bruno Abrantes <bruno.abrantes@grafana.com>
Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
Previously all receiver modifications were denied with alertingApiServer
enabled. This allows pure creates and deletes through as these specific
cases can be handled simply and without risk of rbac shenanigans.
* Fix: Fix panic when json data are nil
* Use Interface()
* Feedback
Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
* Need to check inside the if statement
---------
Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
* Implement uidToResourceID
* add middleware
* Move uidToResourceID to alerting package
* Only hash uid if it's too long
* Use hashed uid in access control
* Move ReceiverUidToResourceId to ScopeProvider
* resolve uid in middleware only if param exists
* Tests
* Linting
---------
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
This solves problems on Linux distros like NixOS and BSDs like FreeBSD that don't provide `/bin/bash`, while also
maintaining support for all other distros out there (AFAIK? even Alpine with its Busybox has /usr/bin/env).
* adds metric for watch latency
* registers storage metrics when creating a new ResourceServer
* defines the latency (in milliseconds) as the diff between now and the RV. Still need to wait until PR for switching RV to millisecond timestamp is rolled out.
* should be micro seconds not milli
* for watch latency, use diff between now and resource version and convert to seconds
* fix typo
* Loki query editor: update CompletionDataProvider time range when it changes
* CompletionDataProvider: update test and add regression
* Formatting
* Completion Data Provider: clear cache when the time range changes
* Completion Data Provider: specifically test for undefined values vs empty string
* Transforms raw US resource into an intermediate IndexableResource and indexes that. Pulls index mapping code out into different file. For now, we will hardcode which spec fields are indexed, per resource.
* Fixes a few bugs with field casing and timestamps not being formatted right (or not existing).
* adds readme section for using search with US
* extracts to function to transform from search hit to IndexedResource
* get folders when building index
* Remove SettingProvider settings from SSO interactions
* Mock Settings Provider for SSO Settings test
* Ignore error from SettingsProvider
* Add test for backend
* start on tokens
* more error messages
* more handling
* rephrased with suggestions from Daniel
* separate gms parse method
* use translation
* refactor initial idea to use error obj
* use error dto result
* handle gms client
* clean logs and comments
* fix tests
* tests for gms
* test and lint
* lint
* one more handling from gms
* typing in fe
* use error interface
* use validation error
* remove unused gms error
* use errorlib and helper function in fe
* regen api
* use same error util
* one more error to handle
* Also validate folder on provisioning update
* Move folder check before auth check
When checking for the existence of a folder we go through the folder
service which requires auth. Doing so prevents an unprivileged user from
accessing information about whether a particular folder exists or not.
* move query library + share buttons to toolbar
* add share text to button
* need spacer when not in singleTopNav
* fix unit tests
* use secondary button styling when singleTopNav is enabled
* Request trace by id using v2, fallback for v1 when 404
* Show partial traces badge in Trace View
* update go work sum
* Fix tests
* some linting
* Fix tests and try to ignore linter
* Move no lint
* nolint:bodyclose
* merge main
* Fix null tags in array
* Fix test
* Update go.sum
* Update go.sum
* Build: Fix docker manifest create not using correct IMAGE_TAG
* Support publishing security versions of NPM packages
---------
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
Co-authored-by: Kevin Minehart <kmineh0151@gmail.com>
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
* Use a enable configuration to enable frontend sandbox
* Modify settings to load enableFrontendSandbox
* Check for signature type
* Update commment
* Fix e2e tests for the frontend sandbox
* Modify logic so a custom check function is used instead of a list of checks
* Fixes flaky test
* fix comment
* Update comment
* Empty commit
* Empty commit
* Update texts for gm rr in the form
* fix translations
* Fix test
* address review comments
* address review comments - part2
* translations
* update docs for new term: output
* Rewrite zanzana collector to fetch all available pages
* Register access control as a background service
* If zanzana is enabled we run Syncs and start Reconciliation job
* Update pkg/services/authz/zanzana/client/client.go
Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>
* Use server lock when doing performing reconciliation
* start on loading the error code
* error code to message mapping
* use resource code type
* use defined error code
* partial updates from comments
* i18nKey gen
* fixed t
* fixed translations
* typing
* CloudMigrations: create snapshot for Notification Policy
* CloudMigrations: add notification policy constants and components
* CloudMigrations: add uid to resources that have it
* Add streamingEnabled to Tempo ds docs
* Update docs/sources/datasources/tempo/configure-tempo-data-source.md
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
---------
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Tidy and update types
* Tidy up comments
* More tidy up
* Simplify logic and reduce repitition in autocomplete
* Simplify logic
* Add and support new intrinsics
* Only retrieve intrinsics from language provider
* Move generateQueryFromFilters to languageProvider
* Initial async
* Set value
* Update story
* Ignore older returned requests
* Add tests
* Update async test
* Support custom value
* Fix ignore late responses test
* Add act to test
* Fix final test
* Remove comment and fix type error
* refactor async story to look more like api call
* allow consumers to pass in a value with a label, for async
* compare story to async select
* Move 'keep latest async value' into seperate hook
* remove null fn from useLatestAsyncCall
* remove commented assertion
* move custom value to top
* before/afterAll & useRealTimers
* create a user
* no useless await
---------
Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: joshhunt <josh@trtr.co>
* run service account creation DB queries in transaction
* extract the signed in user from the context
* undo unneeded change
* don't error out if a user is not found
* Update pkg/services/serviceaccounts/manager/service.go
Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
* Update pkg/services/serviceaccounts/manager/service.go
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
---------
Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
* Fixes#94296
* format code
* format code
* remove the timezone
* fix bug
* format code
* update unit test
* modified csv data order
* format code
* delete csv change
* build(webpack): extract css imports into files including node_modules
* feat(webassets): add cssfiles to entrypoint assets for extracted css files
* feat(views): add entrypoint css link tags to html templates
* feat(webassets): set CDN prefix for CSS files
* test(webassets): trim down sample-assets-manifest, fix failing snapshot tests
* Update pkg/api/webassets/webassets_test.go
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* build(webpack): remove css module loader
---------
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* CloudMigrations: create snapshot for Contact Points
* CloudMigrations: add contact point copies and components in frontend
* CloudMigrations: temporarily use bell for all alerts resources
* feat(frontend): introduce project.json for every workspace to improve caching
* refactor(frontend): use nx tags for grafana dependson
* refactor(frontend): clean up nx tags for packages and plugins
* build(nx): make grafana dependent on cacheable generate icons command
* build(nx): clean up project files
* introduce appPlatformGrpcClientAuth (renamed appPlatformAccessTokens which is not used)
* re-run toggles gen
---------
Co-authored-by: gamab <gabriel.mabille@grafana.com>
* Added Query hints for Prometheus query code editor
* ES Lint fixes
* Remoed displayName from queryEditorHints as it was unused
* Added the logic on button click to difference function
* extracted data to constants from props
* added css style to hints
* Use advanced options when query params are not transformable
* Update public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
---------
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
* Publish event when one or more rules are changed
* Publish affected rules
* Use a fake bus to test publish event without listening
* Wire alerting store into provisioning service
* Combobox: Measure text of longest label for dropdown width
* remove commented out code
* add story to compare to Select
* move magic numbers to constants to reference, and calculate the scrollbar width
* look at first 100,000 items
* Extract shared add to dashboard flow
* Change how we save and add the new panels
* More cleanup
* Began updating tests
* Move and update tests
* set time range
* Fix lint / ts issues
* Fix time history step issue
* fix test
* Update betterer
* remove more tests that are now not needed
* work around cyclic dep
* Update
* Fixes
* fix lint
* remove unused type
* Require create permissions when creating folder
* Test folder create permissions
* Add test for nested folder permissions on creation
* Replace hardcoded verbs
* Remove traceQLStreaming feature flag from docs
* Apply suggestions from code review
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
* Updates from prettier
---------
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
`GuranteedUpdate` method of `apistore.Storage` had a bug, where it would
errorneously conclude that the object is unchanged, in case a
`tryUpdate` function is passed that modifies the existing object itself
(as it is the case in many core types in K8s upstream).
The modified `existingObj` was compared with `updatedObj`, which would
essentially be same and this lead to the update being skipped.
This patch fixes this by always passing a copy of the `existingObj`.
Signed-off-by: Prem Kumar <prem.saraswat@grafana.com>
* Use epoch with microsecond resolution as RV
* fix backend tests
* Add solution for when the clock goes back
* Add solution for when the clock goes back
* generate mocks
* go lint
* remove comment
* Use Greatest instead of max in msyql and postgres
* update tests
* Update pkg/storage/unified/sql/sqltemplate/dialect_sqlite.go
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
* cast to bigint
* add additional round trip
* increment the RV using 2 sql round trips instead of 3
* cleanup comments
* cast unix timestamp to integer
* fix postgres query
* remove old increment test data
* remove greatest
* cast unix_timestamp to signed
* Use statement_timestamp instead of clock_timestamp
---------
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
* refactor: remove FE feat toggle from BE
* refactor: remove FE toggle and adjust roles
* refactor: replace feat toggle in tracking events
* refactor: remove FE feat toggle
* refactor: remove FE feat toggle
* fix: autogenerated file
* ref: pass tracer to plugin factory func
* fix: add tracer to coreplugin
* test: fix test, generate wire
* test: ignore trace field in loader_test
* ref: pass tracer as dependency, don't store in plugin
* ref: wrap tracer with tracer provider to satisfy WithTracerProvider
* ref: use otel trace.Tracer type for tracer
* scenes error when options not set
* add all of the options that are updated in onOptionsChange
* add options to all the other places we are building timeseries panels
* Update public/app/features/trails/AutomaticMetricQueries/graph-builders/percentiles.ts
Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
* remove activation handlers and unused code
* Update public/app/features/trails/AutomaticMetricQueries/graph-builders/simple.ts
Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
* Update public/app/features/trails/AutomaticMetricQueries/graph-builders/percentiles.ts
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
---------
Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
* Open dashboard list when a scope is selected
* refactor
* test
* remove localstorage key
* add checks on open/close methods
* remove redundant statement
* improve dashboards listing
* Pass parent folder as a contextual tuple in Check request
* Search by listing folders and dashboards
* skip dashboards listing if limit reached
* remove unused
* add some comments
* only add ContextualTuples if parent provided
* Remove parent relation for dashboards from schema and perform separate checks
* resource-api: Loosen name validation to match K8s requirements
This patch modifies some of the requirements for name validation of
objects in Resource API to match Kubernetes.
The limit we have on characters in name is 64, but some resources allow
upto 253 characters. Similarly we also include `:` in the regex, as many
objects in default K8s setup use it in the name (the group
`system:masters` for example)
Signed-off-by: Prem Kumar <prem.saraswat@grafana.com>
* Update the name column length in migrator and update e2e test to verify
---------
Signed-off-by: Prem Kumar <prem.saraswat@grafana.com>
* Support getting full path of UIDs
* Use full path to set parents field
* Update get folder test
* Add folder store test for getting with full path UIDs
* Add test for parsing parent titles
* Test nested folder create payload
* Update dependency @grafana/scenes to v5.20.0
* bump scenes-react as well
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
* wip
* add simple scenes object with logs panel
* return hardcoded log message from runtime ds
* simplify log entry
* use log in links registry
* wired the log together.
* wip
* Connected the extensions log to the runtime datasource to steam logs
* wired the other registies.
* implemented child function.
* set right field type on labels
* set meta type
* using the logger in various places.
* added type of onclick.
* removed time picker.
* removed imports.
* passing log to functions where they are needed.
* moved scene into admin page.
* minor improvement to the message.
* added possibility to update query with values based on the data.
* added filter suppoert.
* wip
* wip
* fixed so extension points are displayed.
* use log level from grafana data
* fixed bugs with the filtering.
* Fixed some logs.
* only register extensions page in development mode.
* fixed filtering.
* added on click debug log.
* PluginExtensions: Add debug log to Grafana (Rewrite to scenes-react) (#93954)
* refactoring.
* simplify it even more.
* Update public/app/features/plugins/extensions/logs/LogViewer.tsx
Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
* used VizGridLayout instead of VizGrid component.
* Fixed feedback and fixed bug in filtering logic.
* fixed another nit.
* empty string instead of title.
* Added tests and fixed error.
* added test file.
* regenerated yarn.lock
* Update public/app/features/plugins/extensions/logs/filterTransformation.test.ts
Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
* fixed nit.
* more nits.
* added more test cases.
* simplified filtering logic.
* removed unused dep.
* defined broadcast channel in jest setup.
* added tests for datasource.
* fixed failed tests.
* fixed tests.
* fixing go lint issue.
* silent go lint.
* fixed lint issue.
---------
Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
* adds Filter gRPC and make protobuf
* adds route for querying the filter gRPC
* wires up Filter gRPC call
* [WIP] index from start
* renames gRPC endpoint to "Search"
* adds /apis/search route into k8s routes. Hacky for now.
* updates readme - wrong casing
* adds feature toggle for unified storage search
* hides US search behind feature flag. Clean up print statements.
* removes indexer - will be added in another PR
* Search: Add API Builder
* adds required method
* implementing UpdateAPIGroupInfo (WIP)
* adds groupversion
* commenting out for now
* remove unneeded code from experimenting and update register.go to match interface required
* list resources and load into index
* pass context
* namespaces search route
* lint
* watch
* add todo
* add todo
* merge
* cleanup
* add todo
* gen protobuf
* lint; fix migration issue
* Updates index mapping function to map unified storage object Value
* Changes Index() to pointer receiver - fixes panic
* add delete
* cleanup
* gets search/browse functioning. Results show up as base64 encoded. Still a WIP.
* Doesnt json re-encode gRPC response in search handler
* add kind to SearchRequest proto
* Updates query interface to be more generic. Make proto. Parses query params in api server.
* make protobuf
* removes unused method and imports
* Returns all indexed fields in search results. Adds pagination support (limit + offset).
* remove comment
* remove unused struct
* gets tenant in search k8s api handler
* adds hardcoded spec field mappings - starting with playlists
* adds all spec fields to search results
* moved helper function for field mappings into index
* only includes allowed spec fields in search results
* cleans up error handling
* removes debug log
---------
Co-authored-by: leonorfmartins <leonorfmartins@gmail.com>
Co-authored-by: Todd Treece <todd.treece@grafana.com>
Co-authored-by: Scott Lepper <scott.lepper@gmail.com>
* Fix detail view not showing instances nor history tab
* small refactor
* Update public/app/features/alerting/unified/hooks/useCombinedRule.ts
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
* refactor
---------
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
// need to ignore emotion's `css` prop, see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md#rule-options
- **Alerting:** Make context deadline on AlertNG service startup configurable [#96135](https://github.com/grafana/grafana/pull/96135), [@fayzal-g](https://github.com/fayzal-g)
- **MigrationAssistant:** Restrict dashboards, folders and datasources by the org id of the signed in user [#96345](https://github.com/grafana/grafana/pull/96345), [@leandro-deveikis](https://github.com/leandro-deveikis)
- **User:** Check SignedInUser OrgID in RevokeInvite [#95490](https://github.com/grafana/grafana/pull/95490), [@mgyongyosi](https://github.com/mgyongyosi)
### Bug fixes
- **Alerting:** Fix escaping of silence matchers in utf8 mode [#95347](https://github.com/grafana/grafana/pull/95347), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Fix overflow for long receiver names [#95133](https://github.com/grafana/grafana/pull/95133), [@gillesdemey](https://github.com/gillesdemey)
- **Alerting:** Fix saving advanced mode toggle state in the alert rule editor [#95981](https://github.com/grafana/grafana/pull/95981), [@alexander-akhmetov](https://github.com/alexander-akhmetov)
- **Alerting:** Fix setting datasource uid, when datasource is string in old version [#96273](https://github.com/grafana/grafana/pull/96273), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Force refetch prom rules when refreshing panel [#96125](https://github.com/grafana/grafana/pull/96125), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Anonymous User:** Adds validator service for anonymous users [#94994](https://github.com/grafana/grafana/pull/94994), [@leandro-deveikis](https://github.com/leandro-deveikis)
- **Anonymous User:** Adds validator service for anonymous users (Enterprise)
- **Azure Monitor:** Support metric namespaces fallback [#95155](https://github.com/grafana/grafana/pull/95155), [@aangelisc](https://github.com/aangelisc)
- **CloudWatch:** Interpolate region in log context query [#94990](https://github.com/grafana/grafana/pull/94990), [@iwysiu](https://github.com/iwysiu)
- **Dashboard datasource:** Return annotations as series when query topic is "annotations" [#95971](https://github.com/grafana/grafana/pull/95971), [@kaydelaney](https://github.com/kaydelaney)
- **Dashboard:** Append orgId to URL [#95963](https://github.com/grafana/grafana/pull/95963), [@bfmatei](https://github.com/bfmatei)
- **Dashboards:** Fixes performance issue expanding a row [#95321](https://github.com/grafana/grafana/pull/95321), [@torkelo](https://github.com/torkelo)
- **Flame Graph:** Fix crash when it receives empty data [#96211](https://github.com/grafana/grafana/pull/96211), [@yincongcyincong](https://github.com/yincongcyincong)
- **Folders:** Add admin permissions upon creation of a folder w. SA [#95365](https://github.com/grafana/grafana/pull/95365), [@eleijonmarck](https://github.com/eleijonmarck)
- **Folders:** Don't show error pop-up if the user can't fetch the root folder [#95600](https://github.com/grafana/grafana/pull/95600), [@IevaVasiljeva](https://github.com/IevaVasiljeva)
- **Migration:** Remove table aliasing in delete statement to make it work for mariadb [#95232](https://github.com/grafana/grafana/pull/95232), [@kalleep](https://github.com/kalleep)
- **Service Accounts:** Run service account creation in transaction [#94803](https://github.com/grafana/grafana/pull/94803), [@IevaVasiljeva](https://github.com/IevaVasiljeva)
- **Table:** Fix text wrapping applying to wrong field [#95425](https://github.com/grafana/grafana/pull/95425), [@codeincarnate](https://github.com/codeincarnate)
- **Unified Storage:** Use ssl_mode instead of sslmode [#95662](https://github.com/grafana/grafana/pull/95662), [@chaudyg](https://github.com/chaudyg)
<!-- 11.3.1 END -->
<!-- 11.2.4 START -->
# 11.2.4 (2024-11-19)
### Features and enhancements
- **Alerting:** Make context deadline on AlertNG service startup configurable [#96133](https://github.com/grafana/grafana/pull/96133), [@fayzal-g](https://github.com/fayzal-g)
- **MigrationAssistant:** Restrict dashboards, folders and datasources by the org id of the signed in user [#96344](https://github.com/grafana/grafana/pull/96344), [@leandro-deveikis](https://github.com/leandro-deveikis)
- **Folders:** Add admin permissions upon creation of a folder w. SA [#95416](https://github.com/grafana/grafana/pull/95416), [@eleijonmarck](https://github.com/eleijonmarck)
- **Migration:** Remove table aliasing in delete statement to make it work for mariadb [#95231](https://github.com/grafana/grafana/pull/95231), [@kalleep](https://github.com/kalleep)
- **ServerSideExpressions:** Disable SQL Expressions to prevent RCE and LFI vulnerability [#94959](https://github.com/grafana/grafana/pull/94959), [@samjewell](https://github.com/samjewell)
<!-- 11.2.4 END -->
<!-- 11.1.9 START -->
# 11.1.9 (2024-11-19)
### Features and enhancements
- **Alerting:** Make context deadline on AlertNG service startup configurable [#96132](https://github.com/grafana/grafana/pull/96132), [@fayzal-g](https://github.com/fayzal-g)
- **User:** Check SignedInUser OrgID in RevokeInvite [#95488](https://github.com/grafana/grafana/pull/95488), [@mgyongyosi](https://github.com/mgyongyosi)
### Bug fixes
- **Alerting:** Force refetch prom rules when refreshing panel [#96123](https://github.com/grafana/grafana/pull/96123), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Anonymous User:** Adds validator service for anonymous users [#94992](https://github.com/grafana/grafana/pull/94992), [@leandro-deveikis](https://github.com/leandro-deveikis)
- **Anonymous User:** Adds validator service for anonymous users (Enterprise)
- **Azure Monitor:** Support metric namespaces fallback [#95153](https://github.com/grafana/grafana/pull/95153), [@aangelisc](https://github.com/aangelisc)
- **Migration:** Remove table aliasing in delete statement to make it work for mariadb [#95230](https://github.com/grafana/grafana/pull/95230), [@kalleep](https://github.com/kalleep)
- **ServerSideExpressions:** Disable SQL Expressions to prevent RCE and LFI vulnerability [#94969](https://github.com/grafana/grafana/pull/94969), [@scottlepp](https://github.com/scottlepp)
<!-- 11.1.9 END -->
<!-- 11.0.8 START -->
# 11.0.8 (2024-11-19)
### Features and enhancements
- **Alerting:** Make context deadline on AlertNG service startup configurable [#96131](https://github.com/grafana/grafana/pull/96131), [@fayzal-g](https://github.com/fayzal-g)
- **User:** Check SignedInUser OrgID in RevokeInvite [#95487](https://github.com/grafana/grafana/pull/95487), [@mgyongyosi](https://github.com/mgyongyosi)
### Bug fixes
- **Anonymous User:** Adds validator service for anonymous users [#95151](https://github.com/grafana/grafana/pull/95151), [@leandro-deveikis](https://github.com/leandro-deveikis)
- **Anonymous User:** Adds validator service for anonymous users (Enterprise)
- **Azure Monitor:** Support metric namespaces fallback [#95152](https://github.com/grafana/grafana/pull/95152), [@aangelisc](https://github.com/aangelisc)
- **Migration:** Remove table aliasing in delete statement to make it work for mariadb [#95229](https://github.com/grafana/grafana/pull/95229), [@kalleep](https://github.com/kalleep)
- **Alerting:** Make context deadline on AlertNG service startup configurable [#96058](https://github.com/grafana/grafana/pull/96058), [@fayzal-g](https://github.com/fayzal-g)
- **Alerting:** Allow linking to silence form with `__alert_rule_uid__` value preset [#93526](https://github.com/grafana/grafana/pull/93526), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Hide query name when using simplified mode in the alert rule [#93779](https://github.com/grafana/grafana/pull/93779), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Limit and clean up old alert rules versions [#89754](https://github.com/grafana/grafana/pull/89754), [@igloo12](https://github.com/igloo12)
- **Alerting:** Style nits for the simple query mode [#93930](https://github.com/grafana/grafana/pull/93930), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Update texts in annotations step [#93977](https://github.com/grafana/grafana/pull/93977), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Use useProduceNewAlertmanagerConfiguration for contact points [#88456](https://github.com/grafana/grafana/pull/88456), [@gillesdemey](https://github.com/gillesdemey)
- **Auth:** Attach external session info to Grafana session [#93849](https://github.com/grafana/grafana/pull/93849), [@mgyongyosi](https://github.com/mgyongyosi)
- **Auth:** Replace jmespath/go-jmespath with jmespath-community/go-jmespath [#94203](https://github.com/grafana/grafana/pull/94203), [@mgyongyosi](https://github.com/mgyongyosi)
- **CloudMigrations:** Add support for migration of Library Elements (Panels) resources [#93898](https://github.com/grafana/grafana/pull/93898), [@macabu](https://github.com/macabu)
- **Explore Logs:** Preinstall for onprem Grafana instances [#94221](https://github.com/grafana/grafana/pull/94221), [@svennergr](https://github.com/svennergr)
- **ExploreMetrics:** Ensure compatibility with Incremental Querying [#94355](https://github.com/grafana/grafana/pull/94355), [@NWRichmond](https://github.com/NWRichmond)
- **FieldConfig:** Add support for Actions [#92874](https://github.com/grafana/grafana/pull/92874), [@adela-almasan](https://github.com/adela-almasan)
- **Plugin Extensions:** Require meta-data to be defined in `plugin.json` during development mode [#93429](https://github.com/grafana/grafana/pull/93429), [@leventebalogh](https://github.com/leventebalogh)
- **Reporting:** Display template variables in the PDF (Enterprise)
- **Tempo:** Add deprecation notice for Aggregate By [#94050](https://github.com/grafana/grafana/pull/94050), [@joey-grafana](https://github.com/joey-grafana)
### Bug fixes
- **Alerting/Chore:** Fix TimeRangeInput not working across multiple months [#93622](https://github.com/grafana/grafana/pull/93622), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Fix default value for input in simple condition [#94248](https://github.com/grafana/grafana/pull/94248), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron)
- **Alerting:** Fix eval interval not being saved when creating a new group [#93821](https://github.com/grafana/grafana/pull/93821), [@tomratcliffe](https://github.com/tomratcliffe)
- **Alerting:** Fix incorrect permission on POST external rule groups endpoint [CVE-2024-8118] [#93940](https://github.com/grafana/grafana/pull/93940), [@alexweav](https://github.com/alexweav)
- **Alerting:** Fix panics when attempting to create an Alertmanager after failing [#94023](https://github.com/grafana/grafana/pull/94023), [@santihernandezc](https://github.com/santihernandezc)
- **DashboardScene:** Fixes url issue with subpath when exiting edit mode [#93962](https://github.com/grafana/grafana/pull/93962), [@torkelo](https://github.com/torkelo)
- **Dashboards:** Enable scenes by default [#93818](https://github.com/grafana/grafana/pull/93818), [@ivanortegaalba](https://github.com/ivanortegaalba)
- **Dashboards:** Fixes view & edit keyboard shortcuts when grafana is behind a subpath [#93955](https://github.com/grafana/grafana/pull/93955), [@torkelo](https://github.com/torkelo)
- **ElasticSearch:** Fix errorsource in newInstanceSettings [#93859](https://github.com/grafana/grafana/pull/93859), [@iwysiu](https://github.com/iwysiu)
- **Reporting:** Fix reports on multi-org instance (Enterprise)
- **SubMenu:** Fix expanding sub menu items on touch devices [#93208](https://github.com/grafana/grafana/pull/93208), [@yincongcyincong](https://github.com/yincongcyincong)
<!-- 11.3.0 END -->
<!-- 11.2.3 START -->
# 11.2.3 (2024-10-22)
### Bug fixes
- **Alerting:** Fix incorrect permission on POST external rule groups endpoint [CVE-2024-8118] [#93947](https://github.com/grafana/grafana/pull/93947), [@alexweav](https://github.com/alexweav)
- **Canvas:** Allow API calls to grafana origin [#94129](https://github.com/grafana/grafana/pull/94129), [@adela-almasan](https://github.com/adela-almasan)
- **Folders:** Correctly show new folder button under root folder [#94712](https://github.com/grafana/grafana/pull/94712), [@IevaVasiljeva](https://github.com/IevaVasiljeva)
- **OrgSync:** Do not set default Organization for a user to a non-existent Organization [#94549](https://github.com/grafana/grafana/pull/94549), [@mgyongyosi](https://github.com/mgyongyosi)
- **ServerSideExpressions:** Disable SQL Expressions to prevent RCE and LFI vulnerability [#94959](https://github.com/grafana/grafana/pull/94959), [@samjewell](https://github.com/samjewell)
<!-- 11.2.3 END -->
<!-- 11.2.2+security-01 START -->
# 11.2.2+security-01 (2024-10-17)
### Bug fixes
- **SQL Expressions**: Fixes CVE-2024-9264
<!-- 11.2.2+security-01 END -->
<!-- 11.2.1+security-01 START -->
# 11.2.1+security-01 (2024-10-17)
### Features and enhancements
### Bug fixes
- **SQL Expressions**: Fixes CVE-2024-9264
<!-- 11.2.1+security-01 END -->
<!-- 11.1.8 START -->
# 11.1.8 (2024-10-22)
### Bug fixes
- **Alerting:** Fix incorrect permission on POST external rule groups endpoint [CVE-2024-8118] [#93948](https://github.com/grafana/grafana/pull/93948), [@alexweav](https://github.com/alexweav)
- **OrgSync:** Do not set default Organization for a user to a non-existent Organization [#94551](https://github.com/grafana/grafana/pull/94551), [@mgyongyosi](https://github.com/mgyongyosi)
- **ServerSideExpressions:** Disable SQL Expressions to prevent RCE and LFI vulnerability [#94969](https://github.com/grafana/grafana/pull/94969), [@scottlepp](https://github.com/scottlepp)
<!-- 11.1.8 END -->
<!-- 11.1.7+security-01 START -->
# 11.1.7+security-01 (2024-10-17)
### Bug fixes
- **SQL Expressions**: Fixes CVE-2024-9264
<!-- 11.1.7+security-01 END -->
<!-- 11.1.6+security-01 START -->
# 11.1.6+security-01 (2024-10-17)
### Bug fixes
- **SQL Expressions**: Fixes CVE-2024-9264
<!-- 11.1.6+security-01 END -->
<!-- 11.0.6+security-01 START -->
# 11.0.6+security-01 (2024-10-17)
### Bug fixes
- **SQL Expressions**: Fixes CVE-2024-9264
<!-- 11.0.6+security-01 END -->
<!-- 11.0.5+security-01 START -->
# 11.0.5+security-01 (2024-10-17)
### Bug fixes
- **SQL Expressions**: Fixes CVE-2024-9264
<!-- 11.0.5+security-01 END -->
<!-- 11.2.2 START -->
# 11.2.2 (2024-10-01)
@@ -41,6 +299,19 @@
- **Plugins:** Avoid returning 404 for `AutoEnabled` apps [#93487](https://github.com/grafana/grafana/pull/93487), [@wbrowne](https://github.com/wbrowne)
<!-- 11.1.7 END -->
<!-- 11.0.7 START -->
# 11.0.7 (2024-10-22)
### Bug fixes
- **Alerting:** Fix incorrect permission on POST external rule groups endpoint [CVE-2024-8118] [#93949](https://github.com/grafana/grafana/pull/93949), [@alexweav](https://github.com/alexweav)
- **Dashboard:** Make dashboard search faster [#94702](https://github.com/grafana/grafana/pull/94702), [@knuzhdin](https://github.com/knuzhdin)
- **OrgSync:** Do not set default Organization for a user to a non-existent Organization [#94552](https://github.com/grafana/grafana/pull/94552), [@mgyongyosi](https://github.com/mgyongyosi)
- **ServerSideExpressions:** Disable SQL Expressions to prevent RCE and LFI vulnerability [#94971](https://github.com/grafana/grafana/pull/94971), [@samjewell](https://github.com/samjewell)
<!-- 11.0.7 END -->
<!-- 11.0.6 START -->
# 11.0.6 (2024-10-01)
@@ -58,6 +329,17 @@
- **Plugins:** Avoid returning 404 for `AutoEnabled` apps [#93486](https://github.com/grafana/grafana/pull/93486), [@wbrowne](https://github.com/wbrowne)
- **Alerting:** Fix incorrect permission on POST external rule groups endpoint [CVE-2024-8118] [#93946](https://github.com/grafana/grafana/pull/93946), [@alexweav](https://github.com/alexweav)
- **Dashboard:** Make dashboard search faster [#94703](https://github.com/grafana/grafana/pull/94703), [@knuzhdin](https://github.com/knuzhdin)
<!-- 10.4.11 END -->
<!-- 10.4.10 START -->
# 10.4.10 (2024-10-01)
@@ -73,6 +355,16 @@
- **Correlations:** Limit access to correlations page to users who can access Explore [#93673](https://github.com/grafana/grafana/pull/93673), [@ifrost](https://github.com/ifrost)
<!-- 10.4.10 END -->
<!-- 10.3.12 START -->
# 10.3.12 (2024-10-22)
### Bug fixes
- **Alerting:** Fix incorrect permission on POST external rule groups endpoint [CVE-2024-8118] [#93945](https://github.com/grafana/grafana/pull/93945), [@alexweav](https://github.com/alexweav)
- **Dashboard:** Make dashboard search faster [#94704](https://github.com/grafana/grafana/pull/94704), [@knuzhdin](https://github.com/knuzhdin)
rawSchemaPlaylistv0alpha1=[]byte(`{"spec":{"properties":{"interval":{"type":"string"},"items":{"items":{"properties":{"type":{"description":"type of the item.","enum":["dashboard_by_tag","dashboard_by_uid","dashboard_by_id"],"type":"string"},"value":{"description":"Value depends on type and describes the playlist item.\n - dashboard_by_id: The value is an internal numerical identifier set by Grafana. This\n is not portable as the numerical identifier is non-deterministic between different instances.\n Will be replaced by dashboard_by_uid in the future. (deprecated)\n - dashboard_by_tag: The value is a tag which is set on any number of dashboards. All\n dashboards behind the tag will be added to the playlist.\n - dashboard_by_uid: The value is the dashboard UID","type":"string"}},"required":["type","value"],"type":"object"},"type":"array"},"title":{"type":"string"}},"required":["title","interval","items"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object","x-kubernetes-preserve-unknown-fields":true}}`)
# Comma-separated list of plugins ids that will be loaded inside the frontend sandbox
# Currently behind the feature flag pluginsFrontendSandbox
enable_frontend_sandbox_for_plugins=
# Comma-separated list of paths for POST/PUT URL in actions. Empty will allow anything that is not on the same origin
actions_allow_post_url=
@@ -553,7 +557,7 @@ token_expiration_day_limit =
# Login cookie name
login_cookie_name=grafana_session
# Disable usage of Grafana build-in login solution.
# Disable usage of Grafana's built-in login solution.
disable_login=false
# The maximum lifetime (duration) an authenticated user can be inactive before being required to login at next visit. Default is 7 days (7d). This setting should be expressed as a duration, e.g. 5m (minutes), 6h (hours), 10d (days), 2w (weeks), 1M (month). The lifetime resets at each successful token rotation (token_rotation_interval_minutes).
@@ -622,6 +626,11 @@ id_response_header_namespaces = user api-key service-account
# This feature currently **only supports single-organization deployments**
# Max requests accepted per short interval of time for Grafana backend log ingestion endpoint (/log)
log_endpoint_burst_limit=15
# Enables all Faro default instrumentation by using `getWebInstrumentations`. Overrides other instrumentation flags.
instrumentations_all_enabled=false
# Should error instrumentation be enabled, only affects Grafana Javascript Agent
instrumentations_errors_enabled=true
@@ -1209,6 +1221,9 @@ enabled =
# Comma-separated list of organization IDs for which to disable unified alerting. Only supported if unified alerting is enabled.
disabled_orgs=
# Specify how long to wait for the alerting service to initialize
initialization_timeout=30s
# Specify the frequency of polling for admin config changes.
# The interval string is a possibly signed sequence of decimal numbers, followed by a unit suffix (ms, s, m, h, d), e.g. 30s or 1m.
admin_config_poll_interval=60s
@@ -1559,7 +1574,8 @@ enabled = true
#################################### Short Links #############################
[short_links]
# Short links which are never accessed will be deleted as cleanup. Time is in days. Default is 7 days. Max is 365. 0 means they will be deleted approximately every 10 minutes.
# Short links that are never accessed will be deleted as cleanup. Time is set up in days. The default is 7 days. Maximum value is 365.
# 0 means they will be deleted approximately every 10 minutes. A negative value (such as -1) will disable expiration.
# Comma separated list of plugin ids for which environment variables should be forwarded. Used only when feature flag pluginsSkipHostEnvVars is enabled.
forward_host_env_vars=
# Comma separated list of plugin ids to install as part of the startup process.
preinstall = grafana-lokiexplore-app
#By default, the following plugins will be preinstalled: "grafana-lokiexplore-app"
preinstall=
#Controls whether preinstall plugins asynchronously (in the background) or synchronously (blocking). Useful when preinstalled plugins are used with provisioning.
preinstall_async=true
#Disables preinstall feature. It has the same effect as setting preinstall to an empty list.
You can access the web UI at http://localhost:12080/#/
## Debugging setup in VS Code
An example of launch.json is provided in `devenv/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.
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.
@@ -234,7 +234,7 @@ To determine the number of active users:
A tiered license defines dashboard viewers, and dashboard editors and administrators, as two distinct user types that each have their own user limit.
As of Grafana Enterprise version 9.0, Grafana only counts and enforces the _total_ number of active users in your Grafana instance. For example, if you purchase 150 active users, you can have 20 admins, 70 editors, and 60 viewers, or you can have 150 admins. Grafana will enforce the total number of active users even if you use a license that grants a specific number of admins or editors and a certain number of viewers. This is a more permissive policy than before, which gives you the flexibility to change users' roles.
Grafana only counts and enforces the _total_ number of active users in your Grafana instance. For example, if you purchase 150 active users, you can have 20 admins, 70 editors, and 60 viewers, or you can have 150 admins. Grafana will enforce the total number of active users even if you use a license that grants a specific number of admins or editors and a certain number of viewers. This is a more permissive policy than before, which gives you the flexibility to change users' roles.
If you are running a pre-9.0 version of Grafana Enterprise, please refer to the documentation for that version to learn more about license enforcement in your current version.
@@ -35,9 +35,9 @@ To activate your license, complete the following tasks.
For more information about deploying an application on Amazon ECS, refer to [Creating an Amazon ECS service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service.html).
1. As you create the Amazon ECS service, use the Grafana Enterprise version 8.3.0 or later container image.
1. As you create the Amazon ECS service, use the intended Grafana Enterprise container image version.
For example, enter `grafana/grafana-enterprise:8.3.3`.
For example, enter `grafana/grafana-enterprise:11.3.0`.
> Only Grafana Enterprise versions 8.3.0 and later support licenses granted through AWS Marketplace.
# Activate a Grafana Enterprise license from AWS Marketplace on EKS
If you have purchased a Grafana Enterprise subscription through AWS Marketplace, you must activate it in order to use Grafana Enterprise data source plugins and features in Grafana.
If you have purchased a Grafana Enterprise subscription through AWS Marketplace, you must activate it to use Grafana Enterprise data source plugins and features in Grafana.
## Before you begin:
@@ -37,9 +37,9 @@ To activate your license, complete the following tasks:
For more information about installing Grafana on Kubernetes using the Helm Chart, refer to the [Grafana Helm Chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#readme).
1. Use `kubectl set image deployment/my-release grafana=grafana/grafana-enterprise:<version>` to update the container image to Grafana Enterprise version 8.3.0 or later.
1. Use `kubectl set image deployment/my-release grafana=grafana/grafana-enterprise:<version>` to update the container image.
For example, enter `grafana/grafana-enterprise:8.3.3`.
For example, enter `grafana/grafana-enterprise:11.3.0`.
> Only Grafana Enterprise versions 8.3.0 and later support licenses granted through AWS Marketplace.
@@ -103,53 +103,45 @@ To browse for available plugins:
### Install a plugin
To install a plugin:
The most common way to install a plugin is through the Grafana UI, but alternative methods are also available.
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Browse and find a plugin.
1. Click the plugin's logo.
1. Click **Install**.
When the update is complete, you'll see a confirmation message that the installation was successful.
There are also additional ways to install plugins depending on your setup.
### Update a plugin
#### Install a plugin using Grafana CLI
To update a plugin:
Grafana CLI allows you to install, upgrade, and manage your Grafana plugins using a command line. For more information about Grafana CLI plugin commands, refer to [Plugin commands]({{< relref "../../cli/#plugins-commands" >}}).
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Click the **Installed** filter to show only installed plugins.
1. Click the plugin's logo.
1. Click **Update**.
#### Install a plugin from a ZIP file
When the update is complete, you'll see a confirmationmessage that the update was successful.
This method is typically used for plugins not available in the Plugin Catalog or in environments without internet access.
### Uninstall a plugin
Download the archive containing the plugin assets, and install it by extracting the archive into the plugin directory. For example:
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Click the plugin's logo.
1. Click the **Installed** filter to show only installed plugins.
1. Click **Uninstall**.
The path to the plugin directory is defined in the configuration file. For more information, refer to [Configuration]({{< relref "../../setup-grafana/configure-grafana/#plugins" >}}).
When the update is complete, you'll see a confirmation message that the uninstall was successful.
#### Install a plugin in air-gapped environment
## Install Grafana plugins
Plugin installation usually requires an internet connection. You can check which endpoints are used during the installation on your instance and add them to your instance’s allowlist.
Grafana supports data source, panel, and app plugins.
If this is not possible you can go via installing a plugin using [Grafana CLI](#install-a-plugin-using-grafana-cli) or as a [ZIP file](#install-a-plugin-from-a-zip-file).
1. In a web browser, navigate to the [Grafana plugin catalog](https://grafana.com/plugins) and find a plugin that you want to install.
1. Click the plugin, and then click the **Installation** tab.
You can fetch any plugin from Grafana.com API following the download link referenced in the API.
Here is an example based on `grafana-lokiexplore-app` plugins.
### Install plugin on Grafana Cloud
1. Open `https://grafana.com/api/plugins/grafana-lokiexplore-app` and look for `links` section
1. Find a `download` url which looks something like `https://grafana.com/api/plugins/grafana-lokiexplore-app/versions/1.0.2/download`
1. Use this URL to download the plugin ZIP file, which you can then install as described above.
On the **Installation tab**, in the **For** field, click the name of the Grafana instance on which you want to install the plugin.
Grafana Cloud handles the plugin installation automatically.
If you're logged in to Grafana Cloud when you add a plugin, log out and then log back in again to use the new plugin.
### Install plugins using the Grafana Helm chart
#### Install plugins using the Grafana Helm chart
With the Grafana Helm chart, add the plugins you want to install as a list using the `plugins` field in the your values file. For more information about the configuration, refer to [the Helm chart configuration reference](https://github.com/grafana/helm-charts/tree/main/charts/grafana#configuration).
@@ -162,21 +154,29 @@ plugins:
- redis-datasource
```
### Install plugin on local Grafana
When the update is complete, a confirmation message will indicate the installation was successful.
Follow the instructions on the **Install** tab. You can either install the plugin with a Grafana CLI command or by downloading and uncompressing a zip file into the Grafana plugins directory. We recommend using Grafana CLI in most instances. The zip option is available if your Grafana server doesn't have access to the internet.
### Update a plugin
For more information about Grafana CLI plugin commands, refer to [Plugin commands]({{< relref "../../cli/#plugins-commands" >}}).
To update a plugin:
#### Install a packaged plugin
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Click the **Installed** filter to show only installed plugins.
1. Click the plugin's logo.
1. Click **Update**.
After the user has downloaded the archive containing the plugin assets, they can install it by extracting the archive into their plugin directory. For example:
When the update is complete, a confirmation message will indicate the installation was successful.
The path to the plugin directory is defined in the configuration file. For more information, refer to [Configuration]({{< relref "../../setup-grafana/configure-grafana/#plugins" >}}).
To uninstall a plugin:
1. In Grafana, click **Administration > Plugins and data > Plugins** in the side navigation menu to view all plugins.
1. Click the plugin's logo.
1. Click the **Installed** filter to show only installed plugins.
1. Click **Uninstall**.
When the update is complete, a confirmation message will indicate the installation was successful.
If you're developing a plugin, then you can enable development mode to allow all unsigned plugins.
{{% /admonition %}}
## Plugin Frontend Sandbox
{{% admonition type="caution" %}}
Plugin Frontend Sandbox is currently in [public preview](/docs/release-life-cycle/). Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.
{{% /admonition %}}
The Plugin Frontend Sandbox is a security feature that isolates plugin frontend code from the main Grafana application.
When enabled, plugins run in a separate JavaScript context, which provides several security benefits:
- Prevents plugins from modifying parts of the Grafana interface outside their designated areas
- Stops plugins from interfering with other plugins functionality
- Protects core Grafana features from being altered by plugins
- Prevents plugins from modifying global browser objects and behaviors
Plugins running inside the Frontend Sandbox should continue to work normally without any noticeable changes in their intended functionality.
### Enable Frontend Sandbox
The Frontend Sandbox feature is currently behind the `pluginsFrontendSandbox` feature flag. To enable it, you'll need to:
1. Enable the feature flag in your Grafana configuration. For more information about enabling feature flags, refer to [Configure feature toggles](/setup-grafana/configure-grafana/feature-toggles/).
2. For self-hosted Grafana installations, add the plugin IDs you want to sandbox in the `security` section using the `enable_frontend_sandbox_for_plugins` configuration option.
For Grafana Cloud users, you can simply use the toggle switch in the plugin catalog page to enable or disable the sandbox for each plugin. By default, the sandbox is disabled for all plugins.
{{% admonition type="note" %}}
Enabling the Frontend Sandbox might impact the performance of certain plugins. Only disable the sandbox if you fully trust the plugin and understand the security implications.
{{% /admonition %}}
### Compatibility
The Frontend Sandbox is available in public preview in Grafana >=11.4. It is compatible with all types of plugins including app plugins, panel plugins, and data source plugins. Angular-based plugins are not supported. Plugins developed and signed by Grafana Labs are excluded and cannot be sandboxed.
### When to Use Frontend Sandbox
We strongly recommend enabling the Frontend Sandbox for plugins that allow users to write custom JavaScript code for data visualization or manipulation. These plugins, while powerful, can potentially execute arbitrary JavaScript code in your Grafana instance. The sandbox provides an additional layer of security by restricting what this code can access and modify.
Examples of plugins where the sandbox is particularly important include:
- Panel plugins that allow users to write custom JavaScript code
- Plugins from untrusted sources
### Troubleshooting
If a plugin isn't functioning correctly with the Frontend Sandbox enabled:
1. Temporarily disable the sandbox for that specific plugin
1. Test if the plugin works correctly without the sandbox
1. If the plugin only works with the sandbox disabled, ensure you trust the plugin source before continuing to use it without sandbox protection
1. Report any sandbox-related issues to the plugin developer
@@ -73,7 +73,7 @@ Therefore, we heavily rely on the expertise of the community.
## Data sources
You can manage data sources in Grafana by adding YAML configuration files in the [`provisioning/datasources`]({{< relref "../../setup-grafana/configure-grafana#provisioning" >}}) directory.
You can manage data sources in Grafana by adding YAML configuration files in the [`provisioning/datasources`]({{< relref "../../setup-grafana/configure-grafana#provisioning" >}}) directory.
Each configuration file can contain a list of `datasources` to add or update during startup.
If the data source already exists, Grafana reconfigures it to match the provisioned configuration file.
@@ -81,13 +81,9 @@ The configuration file can also list data sources to automatically delete, calle
Grafana deletes the data sources listed in `deleteDatasources`_before_ adding or updating those in the `datasources` list.
You can configure Grafana to automatically delete provisioned data sources when they're removed from the provisioning file.
To do so, add `prune: true` to the root of your provisioning file.
To do so, add `prune: true` to the root of your data source provisioning file.
With this configuration, Grafana also removes the provisioned data sources if you remove the provisioning file entirely.
{{< admonition type="note" >}}
The `prune` parameter is available in Grafana v11.1 and higher.
{{< /admonition >}}
### Running multiple Grafana instances
If you run multiple instances of Grafana, add a version number to each data source in the configuration and increase it when you update the configuration.
@@ -231,9 +227,9 @@ Data sources tagged with _HTTP\*_ communicate using the HTTP protocol, which inc
| encrypt | string | MSSQL | Determines SSL encryption handling. Options include: `disable` - data sent between client and server is not encrypted; `false` - data sent between client and server is not encrypted beyond the login packet; `true` - data sent between client and server is encrypted. Default is `false`. |
| postgresVersion | number | PostgreSQL | Postgres version as a number (903/904/905/906/1000) meaning v9.3, v9.4, ..., v10 |
@@ -257,17 +253,17 @@ All of these settings are optional.
The _HTTP\*_ tag denotes data sources that communicate using the HTTP protocol, including all core data source plugins except MySQL, PostgreSQL, and MS SQL.
| tlsCACert | string | _HTTP\*_, MySQL, PostgreSQL | CA cert for out going requests. You can point directly to your stored cert by using an environment variable following the `$__file{path/to/ca}` format. |
| tlsClientCert | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client cert for outgoing requests. You can point directly to your stored cert by using an environment variable following the `$__file{path/to/cert}` format. |
| tlsClientKey | string | _HTTP\*_, MySQL, PostgreSQL | TLS Client key for outgoing requests. You can point directly to your stored key by using an environment variable following the `$__file{path/to/key}` format. |
@@ -100,6 +100,8 @@ The following list contains role-based access control actions.
| `folders:delete` | <ul><li>`folders:*`</li><li>`folders:uid:*`</li></ul> | Delete one or more folders and their subfolders. |
| `folders:read` | <ul><li>`folders:*`</li><li>`folders:uid:*`</li></ul> | Read one or more folders and their subfolders. |
| `folders:write` | <ul><li>`folders:*`</li><li>`folders:uid:*`</li></ul> | Update one or more folders and their subfolders. |
| `groupsync.mappings:read` | None | List group attribute sync mappings. To use this permission, enable the `groupAttributeSync` feature toggle. |
| `groupsync.mappings:write` | None | List, create, update, and delete group attribute sync mappings. To use this permission, enable the `groupAttributeSync` feature toggle. |
| `ldap.config:reload` | None | Reload the LDAP configuration. |
| `ldap.status:read` | None | Verify the availability of the LDAP server or servers. |
| `ldap.user:read` | None | Read users via LDAP. |
@@ -188,16 +190,38 @@ The following list contains role-based access control actions used by Grafana Ad
| `alert.notifications.receivers:create` | None | Create a new contact points. The creator is automatically granted full access to the created contact point. |
| Editor | `basic_editor` | `fixed:datasources:explorer`<br>`fixed:dashboards:creator`<br>`fixed:folders:creator`<br>`fixed:annotations:writer`<br>`fixed:teams:creator` if the `editors_can_admin` configuration flag is enabled<br>`fixed:alerting:writer`<br>`fixed:dashboards.insights:reader`<br>`fixed:datasources.insights:reader`<br>`fixed:library.panels:creator`<br>`fixed:library.panels:general.reader`<br>`fixed:library.panels:general.writer`<br>`fixed:alerting.provisioning.status:writer` | Default [Editor](ref:rbac-basic-roles) assignments. |
| Viewer | `basic_viewer` | `fixed:datasources.id:reader`<br>`fixed:organization:reader`<br>`fixed:annotations:reader`<br>`fixed:annotations.dashboard:writer`<br>`fixed:alerting:reader`<br>`fixed:plugins.app:reader`<br>`fixed:dashboards.insights:reader`<br>`fixed:datasources.insights:reader`<br>`fixed:library.panels:general.reader`<br>`fixed:datasources:explorer` if the `viewers_can_edit` configuration flag is enabled | Default [Viewer](ref:rbac-basic-roles) assignments. |
| No Basic Role | n/a | | Default [No Basic Role](ref:rbac-basic-roles) |
| Editor | `basic_editor` | `fixed:datasources:explorer`<br>`fixed:dashboards:creator`<br>`fixed:folders:creator`<br>`fixed:annotations:writer`<br>`fixed:teams:creator` if the `editors_can_admin` configuration flag is enabled<br>`fixed:alerting:writer`<br>`fixed:dashboards.insights:reader`<br>`fixed:datasources.insights:reader`<br>`fixed:library.panels:creator`<br>`fixed:library.panels:general.reader`<br>`fixed:library.panels:general.writer`<br>`fixed:alerting.provisioning.status:writer`| Default [Editor](ref:rbac-basic-roles) assignments. |
| Viewer | `basic_viewer` | `fixed:datasources.id:reader`<br>`fixed:organization:reader`<br>`fixed:annotations:reader`<br>`fixed:annotations.dashboard:writer`<br>`fixed:alerting:reader`<br>`fixed:plugins.app:reader`<br>`fixed:dashboards.insights:reader`<br>`fixed:datasources.insights:reader`<br>`fixed:library.panels:general.reader`<br>`fixed:datasources:explorer` if the `viewers_can_edit` configuration flag is enabled | Default [Viewer](ref:rbac-basic-roles) assignments. |
| No Basic Role | n/a | | Default [No Basic Role](ref:rbac-basic-roles) |
## Fixed role definitions
@@ -115,6 +115,8 @@ To learn how to use the roles API to determine the role UUIDs, refer to [Manage
| `fixed:folders.permissions:writer` | `fixed_3GAgpQ_hWG8o7-lwNb86_VB37eI` | All permissions from `fixed:folders.permissions:reader` and <br>`folders.permissions:write` | Read and update all folder permissions. |
| `fixed:ldap:reader` | `fixed_lMcOPwSkxKY-qCK8NMJc5k6izLE` | `ldap.user:read`<br>`ldap.status:read` | Read the LDAP configuration and LDAP status information. |
| `fixed:groupsync:reader` | `fixed_tLIbDrE6kw93sKqooF8GVS9BF4E` | `groupsync.mappings:read` | List all group attribute sync mappings. To use this role, enable the `groupAttributeSync` feature toggle. |
| `fixed:groupsync:writer` | `fixed_q7XUYx_efzxxsVmWhQgpiYClwBs` | `groupsync.mappings:read`<br>`groupsync.mappings:write` | Create, read, update, and delete all group attribute sync mappings. To use this role, enable the `groupAttributeSync` feature toggle. |
| `fixed:ldap:writer` | `fixed_p6AvnU4GCQyIh7-hbwI-bk3GYnU` | All permissions from `fixed:ldap:reader` and <br>`ldap.user:sync`<br>`ldap.config:reload` | Read and update the LDAP configuration, and read LDAP status information. |
| `fixed:library.panels:creator` | `fixed_6eX6ItfegCIY5zLmPqTDW8ZV7KY` | `library.panels:create`<br>`folders:read` | Create library panel at the root level. |
| `fixed:library.panels:general.reader` | `fixed_ct0DghiBWR_2BiQm3EvNPDVmpio` | `library.panels:read` | Read all library panels at the root level. |
Available in [Grafana Enterprise](/docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/) version 7.3 and later, and [Grafana Cloud](/docs/grafana-cloud).
Available in [Grafana Enterprise](/docs/grafana/<GRAFANA_VERSION>/introduction/grafana-enterprise/) and [Grafana Cloud](/docs/grafana-cloud).
{{% /admonition %}}
You can enable auditing in the Grafana configuration file.
description: Learn more about the fundamentals and available features that help you create, manage, and respond to alerts; and improve your team’s ability to resolve issues quickly.
height: 24
- title: Set up
href: ./set-up/
description: Set up your implementation of Grafana Alerting.
height: 24
- title: Configure alert rules
href: ./alerting-rules/
description: Create, manage, view, and adjust alert rules to alert on your metrics data or log entries from multiple data sources — no matter where your data is stored.
@@ -39,13 +35,13 @@ cards:
href: ./configure-notifications/
description: Choose how, when, and where to send your alert notifications.
height: 24
- title: Detect and respond
- title: Monitor status
href: ./manage-notifications/
description: Monitor, respond to, and triage issues within your services.
height: 24
- title: Monitor
href: ./monitor/
description: Monitor your alerting metrics to ensure you identify potential issues before they become critical.
- title: Additional configuration
href: ./set-up/
description: Use advanced configuration options to further tailor your alerting setup. These options can enhance security, scalability, and automation in complex environments.
@@ -84,6 +89,9 @@ Multiple alert instances can be created as a result of one alert rule (also know
{{% admonition type="note" %}}
For Grafana Cloud Free Forever, you can create up to 100 free Grafana-managed alert rules with each alert rule having a maximum of 1000 alert instances.
For all paid tiers (Cloud Pro and Advanced), there is a soft limit of 2000 alert rules and unlimited alert instances. To increase the limit, open a support ticket from the [Cloud portal](https://grafana.com/docs/grafana-cloud/account-management/support/).
{{% /admonition %}}
Grafana-managed alert rules can only be edited or deleted by users with Edit permissions for the folder storing the rules.
@@ -93,6 +101,13 @@ To make a backup of your configuration and to be able to restore deleted alertin
## Before you begin
If you are using Grafana OSS:
1. Configure your [data sources](ref:data-sources).
2. Check which [data sources](ref:compatible-data-sources) are compatible with and supported by Grafana Alerting.
If you are using Grafana OSS, Enterprise, or Cloud:
You can use default or advanced options for Grafana-managed alert rule creation. The default options streamline rule creation with a cleaner header and a single query and condition. For more complex rules, use advanced options to add multiple queries and expressions.
Default and advanced options are enabled by default for Grafana Cloud users and this feature is being rolled out progressively.
@@ -257,13 +272,9 @@ Annotations add metadata to provide more information on the alert in your alert
Webpage where you keep your runbook for the alert
1. Optional: Add a custom annotation
1. Optional: Add a **dashboard and panel link**.
1. Optional: **Link dashboard and panel**.
Links alert rules to panels in a dashboard.
{{% admonition type="note" %}}
At the moment, alert rules are only supported in [time series](ref:time-series) and [alert list](ref:alert-list) visualizations.
{{% /admonition %}}
[Link the alert rule to a panel](ref:link-alert-rules-to-panels) to facilitate alert investigation.
In Grafana Cloud, you can only create data source-managed recording rules.
In Grafana OSS and Enterprise, you can create both Grafana-managed and data source-managed recording rules if you enable the `grafanaManagedRecordingRules` feature flag.
For more information on enabling feature toggles, refer to [Configure feature toggles](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/feature-toggles).
{{< /admonition >}}
Recording rules calculate frequently needed expressions or computationally expensive expressions in advance and save the result as a new set of time series. Querying this new time series is faster, especially for dashboards since they query the same expression every time the dashboards refresh.
For more information on recording rules in Prometheus, refer to [Defining recording rules in Prometheus](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
Recording rules are run as instant rules, which means that they run every 10s. To overwrite this configuration, update the min_interval in your custom configuration file.
[min_interval](ref:configure-grafana) sets the minimum interval to enforce between rule evaluations. The default value is 10s which equals the scheduler interval. Rules will be adjusted if they are less than this value or if they are not multiple of the scheduler interval (10s). Higher values can help with resource management as fewer evaluations are scheduled over time.
This setting has precedence over each individual rule frequency. If a rule frequency is lower than this value, then this value is enforced.
## Configure data source-managed recording rules
Configure data source-managed recording rules.
### Before you begin
- Verify that you have write permission to the Prometheus or Loki data source. Otherwise, you will not be able to create or update Grafana Mimir managed alerting rules.
- For Grafana Mimir and Loki data sources, enable the ruler API by configuring their respective services.
- **Loki** - The `local` rule storage type, default for the Loki data source, supports only viewing of rules. To edit rules, configure one of the other rule storage types.
- **Grafana Mimir** - use the `/prometheus` prefix. The Prometheus data source supports both Grafana Mimir and Prometheus, and Grafana expects that both the [Query API](/docs/mimir/latest/operators-guide/reference-http-api/#querier--query-frontend) and [Ruler API](/docs/mimir/latest/operators-guide/reference-http-api/#ruler) are under the same URL. You cannot provide a separate URL for the Ruler API.
To configure data-source managed recording rules, complete the following steps.
1. Click **Alerts & IRM** -> **Alerting** ->
**Alert rules**.
1. Scroll to the **Data source-managed section** and click **+New recording rule**.
#### Enter recording rule name
The recording rule name must be a Prometheus metric name and contain no whitespace.
#### Define recording rule
Select your data source and enter a query.
#### Add namespace and group
1. From the **Namespace** dropdown, select an existing rule namespace or add a new one.
Namespaces can contain one or more rule groups and only have an organizational purpose.
1. From the **Group** dropdown, select an existing group within the selected namespace or add a new one.
Newly created rules are appended to the end of the group. Rules within a group are run sequentially at a regular interval, with the same evaluation time.
#### Add labels
1. Add custom labels selecting existing key-value pairs from the drop down, or add new labels by entering the new key or value.
1. Click **Save rule** to save the rule or **Save rule and exit** to save the rule and go back to the Alerting page.
## Configure Grafana-managed recording rules
Configure Grafana-managed recording rules.
{{< admonition type="note" >}}
This feature is only available for Grafana OSS and Enterprise users. It is not available in Grafana Cloud.
{{< /admonition >}}
### Before you begin
- Enable the `grafanaManagedRecordingRules` [feature flag](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/feature-toggles/).
To configure Grafana-managed recording rules, complete the following steps.
1. Click **Alerts & IRM** -> **Alerting** ->
**Alert rules**.
1. Scroll to the **Grafana-managed section** and click **+New recording rule**.
#### Enter a recording rule and metric name
Enter a names to identify your recording rule and metric. The metric name must be a Prometheus metric name and contain no whitespace.
For more information, refer to [Metrics and labels](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
#### Define recording rule
Define a query to get the data you want to measure and a condition that needs to be met before an alert rule fires.
1. Select a data source.
1. From the **Options** dropdown, specify a time range.
{{< admonition type="note" >}}
Grafana Alerting only supports fixed relative time ranges, for example, `now-24hr: now`.
It does not support absolute time ranges: `2021-12-02 00:00:00 to 2021-12-05 23:59:592` or semi-relative time ranges: `now/d to: now`.
{{< /admonition >}}
1. Add a query.
To add multiple queries, click **Add query**.
All alert rules are managed by Grafana by default. If you want to switch to a data source-managed alert rule, click **Switch to data source-managed alert rule**.
2. Add one or more [expressions].
a. For each expression, select either **Classic condition** to create a single alert rule, or choose from the **Math**, **Reduce**, and **Resample** options to generate separate alert for each series.
{{% admonition type="note" %}}
When using Prometheus, you can use an instant vector and built-in functions, so you don't need to add additional expressions.
{{% /admonition %}}
b. Click **Preview** to verify that the expression is successful.
3. To add a recovery threshold, turn the **Custom recovery threshold** toggle on and fill in a value for when your alert rule should stop firing.
You can only add one recovery threshold in a query and it must be the alert condition.
4. Click **Set as alert condition** on the query or expression you want to set as your alert condition.
#### Set evaluation behavior
Use alert rule evaluation to determine how frequently an alert rule should be evaluated and how quickly it should change its state.
To do this, you need to make sure that your alert rule is in the right evaluation group and set a pending period time that works best for your use case.
1. Select a folder or click **+ New folder**.
1. Select an evaluation group or click **+ New evaluation group**.
If you are creating a new evaluation group, specify the interval for the group.
All rules within the same group are evaluated concurrently over the same time interval.
1. Enter a pending period.
The pending period is the period in which an alert rule can be in breach of the condition until it fires.
Once a condition is met, the alert goes into the **Pending** state. If the condition remains active for the duration specified, the alert transitions to the **Firing** state, else it reverts to the **Normal** state.
1. Turn on pause alert notifications, if required.
{{< admonition type="note" >}}
You can pause alert rule evaluation to prevent noisy alerting while tuning your alerts.
Pausing stops alert rule evaluation and doesn't create any alert instances.
This is different to mute timings, which stop notifications from being delivered, but still allows for alert rule evaluation and the creation of alert instances.
{{< /admonition >}}
#### Add labels
Add labels to your rule for searching, silencing, or routing to a notification policy.
description: Recording rules allow you to pre-compute frequently needed or computationally expensive expressions and save the results as a new set of time series. Querying precomputed results is faster and can reduce system load.
Recording rules allows you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.
For instance, you can create a recording rule generating a new metric, `error_9001_count`, which counts occurrences of a specific log error within one minute. Then, query the `error_9001_count` metric in dashboards and alert rules.
Recording rules can be helpful in various scenarios, such as:
- **Faster queries** are needed: Performing heavy aggregations or querying large data sets is quicker with precomputed results than real-time queries.
- **Reducing system load:** Precomputing specific queries in advance can reduce system overload caused by multiple simultaneous queries.
- **Simplifying complex aggregations:** Create a new metric from complex aggregations to facilitate alert and dashboard setup.
- **Reusing queries across alerts:** Improve efficiency by reusing the same query across similar alert rules and dashboards.
The evaluation group of the recording rule determines how often the metric is pre-computed.
Similar to alert rules, Grafana supports two types of recording rules:
1. [Grafana-managed recording rules](ref:grafana-managed-recording-rules), which can query any Grafana data source supported by alerting.
2. [Data source-managed recording rules](ref:data-source-managed-recording-rules), which can query Prometheus-based data sources like Mimir or Loki.
description: Recording rules allow you to pre-compute expensive queries in advance and save the results as a new set of time series. Data source-managed recording rules can create a recording rule for Prometheus-based data sources like Mimir or Loki.
[Recording rules](ref:create-recording-rules) allow you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.
Alert rules and dashboards can then query the new metric resulting from the recording rule. This is faster than querying real-time data and can help to reduce system load.
Data source-managed recording rules can query Prometheus-based data sources like Mimir or Loki. For more information on recording rules in Prometheus, refer to [Defining recording rules in Prometheus](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
Note that in data source-managed groups, the alert rules and recording rules within the same evaluation group are evaluated sequentially. This is useful to ensure that a recording rule is evaluated before any other alert rule queries the pre-computed metric.
## Before you begin
- Verify that you have write permission to the Prometheus or Loki data source. Otherwise, you will not be able to create or update Grafana Mimir managed alerting rules.
- For Grafana Mimir and Loki data sources, enable the ruler API by configuring their respective services.
- **Loki** - The `local` rule storage type, default for the Loki data source, supports only viewing of rules. To edit rules, configure one of the other rule storage types.
- **Grafana Mimir** - use the `/prometheus` prefix. The Prometheus data source supports both Grafana Mimir and Prometheus, and Grafana expects that both the [Query API](/docs/mimir/latest/operators-guide/reference-http-api/#querier--query-frontend) and [Ruler API](/docs/mimir/latest/operators-guide/reference-http-api/#ruler) are under the same URL. You cannot provide a separate URL for the Ruler API.
## Add new recording rule
To create a new data source-managed recording rule:
1. Scroll to the **Data source-managed section** and click **+New recording rule**.
## Enter recording rule name
The recording rule name must be a Prometheus metric name and contain no whitespace.
## Define recording rule
Select your data source and enter a query. The queries used in data source-managed recording rules always run as instant queries.
## Add namespace and group
1. From the **Namespace** dropdown, select an existing rule namespace or add a new one.
Namespaces can contain one or more rule groups and only have an organizational purpose.
1. From the **Group** dropdown, select an existing group within the selected namespace or add a new one.
Newly created rules are appended to the end of the group. Rules within a group are run sequentially at a regular interval, with the same evaluation time.
## Add labels
Optionally, you can add custom labels to the resulting metric by selecting existing key-value pairs from the drop down or entering the new key or value.
## Query the new metric in dashboards or alert rules
Click **Save rule** or **Save rule and exit** to save the rule.
Once saved, the new recording metric is available for use in dashboards and alert rules.
description: Recording rules allow you to pre-compute expensive queries in advance and save the results as a new set of time series. Grafana-managed recording rules can create a recording rule for any data source supported by alerting.
[Recording rules](ref:create-recording-rules) allow you to periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.
Alert rules and dashboards can then query the new metric resulting from the recording rule. This is faster than querying real-time data and can help to reduce system load.
Grafana does not contain an embedded time-series database to store recording rule results. You must bring your own Prometheus-compatible database to store the series generated by recording rules.
Grafana-managed recording rules offer the same Prometheus-like semantics but allow you to query [data sources supported by alerting](ref:alerting-data-sources). Additionally, you can use recording rules to import and map data from other data sources into Prometheus.
{{< admonition type="note" >}}
Grafana-managed recording rules are enabled by default in Grafana Cloud.
In Grafana OSS and Enterprise, you must enable them by following the [Before you begin](#before-you-begin) instructions.
{{< /admonition >}}
To configure Grafana-managed recording rules, complete the following steps.
## Before you begin
This section only applies to Grafana OSS and Grafana Enterprise.
First, enable the `grafanaManagedRecordingRules` [feature flag](ref:configure-feature-toggles).
Then, enable the feature by setting `enabled = true` in the `[recording_rules]` section of the Grafana config .ini. Provide the URL of your Prometheus-compatible remote-write endpoint in the `url` field, along with optional credentials or headers.
1. Scroll to the **Grafana-managed section** and click **+New recording rule**.
1. Enter the names to identify your recording rule and metric.
The metric name must be a Prometheus metric name and contain no whitespace. For details, refer to [Prometheus metric names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
## Define recording rule
Define a query to get the data you want to measure and set the recording rule output.
1. Select a data source.
1. From the **Options** dropdown, specify a time range.
{{< admonition type="note" >}}
Grafana Alerting only supports fixed relative time ranges, for example, `now-24hr: now`.
It does not support absolute time ranges: `2021-12-02 00:00:00 to 2021-12-05 23:59:592` or semi-relative time ranges: `now/d to: now`.
{{< /admonition >}}
1. Add a query.
To add multiple queries, click **Add query**.
1. Add one or more [expressions](ref:expressions).
a. For each expression, select either **Classic condition** to create a single recording rule, or choose from the **Math**, **Reduce**, and **Resample** options.
When using Prometheus, you can use an instant vector and built-in functions, so you don't need to add additional expressions.
b. Click **Preview** to verify that the expression is successful.
1. Click **Set as recording rule output** on the query or expression you want to set as your rule output.
## Set evaluation behavior
Use recording rule evaluation to determine how frequently a recording rule should be evaluated.
To do this, you need to make sure that your recording rule is in the right evaluation group with an interval that works best for your use case.
1. Select a folder or click **+ New folder**.
1. Select an evaluation group or click **+ New evaluation group**.
If you are creating a new evaluation group, specify the interval for the group.
All rules within the same group are evaluated concurrently over the same time interval. Every recording rule in a group uses the same evaluation time, meaning that all queries from the same group are always aligned with each other.
1. Before or after creating a recording rule, you have the option to **Pause evaluation** if necessary.
### Advanced configuration
[min_interval](ref:configure-grafana-min-interval) sets the minimum interval to enforce between rule evaluations. The default value is 10s which equals the scheduler interval. Rules are adjusted if they are less than this value or if they are not multiple of the scheduler interval (10s). Higher values can help with resource management as fewer evaluations are scheduled over time.
This setting has precedence over each individual rule frequency. If a rule frequency is lower than this value, then this value is enforced.
This setting applies to both Grafana-managed alert and recording rules.
## Add labels
Optionally, you can add custom labels to the resulting metric by selecting existing key-value pairs from the drop down or entering the new key or value.
## Query the new metric in dashboards or alert rules
Click **Save rule** or **Save rule and exit** to save the rule.
Once saved, the new recording metric is available for use in dashboards and alert rules.
description: Grafana allows you to link alert rules with panels and dashboards. This helps connect alerts with an existing dashboard and informs alert responders on where to investigate.
Grafana allows you to link an alert rule to a dashboard panel. This can help you:
- Inform alert responders about where to investigate and which data to examine.
- Visualize the alert state directly from dashboards.
An alert rule is linked to a panel by setting the [`dashboardUId` and `panelId` annotations](ref:annotations). Both annotations must be set together.
## Link alert rules to panels
When configuring the alert rule, you can set the dashboard and panel annotations as shown in this [video](https://youtu.be/ClLp-iSoaSY?si=qKWnvSVaQuvYcuw9&t=170).
1. Configure the alert rule.
1. In the **Configure notification message** section, click **Link dashboard and panel**.
1. Select an existing dashboard, then choose a panel from the selected dashboard.
1. Complete the alert rule configuration and click **Save rule** to initiate the alert rule.
You can then [view the alert state on the panel](ref:view-alert-state-on-panels).
{{< figure src="/media/docs/alerting/panel-displays-alert-state.png" max-width="1200px" caption="A panel displaying the alert status and state changes." >}}
## Create alert rules from panels
To streamline alert creation, you can create an alert rule directly from a panel.
1. Navigate to a dashboard in the **Dashboards** section.
1. Hover over the top-right corner of a panel and click the panel menu icon.
1. From the dropdown menu, select **More...** > **New alert rule**.
1. This opens the **Edit rule** form and pre-fills some values:
- Sets the `dashboardUId` and `panelId` annotations to the corresponding dashboard and panel.
- Sets the alert rule query using the panel query.
1. Complete the alert rule configuration and click **Save rule** to initiate the alert rule.
You can then [view the alert state on the panel](ref:view-alert-state-on-panels).
{{% admonition type="note" %}}
Changes to panel and alert rule queries aren't synchronized. If you change a query, you have to update it in both the panel and the alert rule.
{{% /admonition %}}
## Access linked alert rules from panels
This option is available only in [time series panels](ref:time-series-visualizations). To access alert rules associated to a time series panel, complete the following steps.
1. Hover over the top-right corner of the panel and click the panel menu icon.
1. Click **Edit**.
1. Click the **Alert** tab to view existing alert rules or create a new one.
You can use templates to customize alert and notification messages, including dynamic data from alert rule queries.
In Grafana Alerting, you can template alert messages in two ways.
1.**Template annotations and labels**: In the alert rule definition, you can template annotations and labels to include extra information from query data to the alert, adding meaningful details based on the query results.
1.**Template notifications**: You can template notifications to control the content and appearance of your notifications.
## How templating works
In this diagram, you can see the differences between both types of templates.
Refer to [Templates Introduction](ref:intro-to-templates) for a more detailed explanation of this diagram.
Both types of templates are written in the Go templating system. However, it's important to understand that variables and functions used in notification templates are different from those used in annotation and label templates.
1.**Template annotations and labels**: These templates add extra information to individual alert instances. Template variables like [`$labels`](ref:labels) and [`$values`](ref:values) represent alert query data of the individual alert instance.
1.**Template notifications**: Notification templates format the notification content for a group of alerts. Variables like [`.Alerts`](ref:notification-data-reference) include all firing and resolved alerts in the notification.
## Template annotations
[Annotations](ref:annotations) add additional information to alert instances and are often used to help identify the alert and guide responders on how to address the issue.
Annotations are key-value pairs defined in the alert rule. They can contain plain text or template code that is evaluated when the alert fires.
Grafana includes several optional annotations, such as `description`, `summary`, `runbook_url`, `dashboardUId` and `panelId`, which can be edited in the alert rule. You can also create your custom annotations. For example, you might create a new annotation named `location` to report the location of the system that triggered the alert.
Here’s an example of a `summary` annotation explaining why the alert was triggered, using plain text.
```
CPU usage has exceeded 80% for the last 5 minutes.
```
However, if you want to display dynamic query values in annotations, you need to use template code. Common use cases include:
- Displaying the query value or threshold that triggered the alert.
- Highlighting label information that identifies the alert, such as environment, region, or priority.
- Providing specific instructions based on query values.
- Customizing runbook links depending on query or label values.
- Including contact information based on alert labels.
For instance, you can template the previous example to display the specific instance and CPU value that triggered the alert.
```
CPU usage for {{ $labels.instance }} has exceeded 80% ({{ $values.A.Value }}) for the last 5 minutes.
```
Alternatively, you can use the `index` function to print query values.
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% ({{ index $values "A" }}) for the last 5 minutes.
```
The result of the annotation would be as follows.
```
CPU usage for Instance 1 has exceeded 80% (81.2345) for the last 5 minutes.
```
### How to template an annotation
Complete the following steps to template an annotation.
1. Navigate to **Alerts & IRM** -> **Alert rules** -> create or edit an alert rule.
1. Scroll down to the **Configure notification message** section.
1. Copy in your template in the corresponding annotation field (`summary`, `description`, `runbook_url`, `custom`).
### Preview annotation templates
You can template annotations when creating or editing an alert rule.
Two common methods are used to test and preview annotation templates:
1. Trigger the alert and [view the alert instance state in the Grafana UI](ref:view-alert-state), where all annotations of the alert instance are displayed.
1. Use a notification template that displays all annotations, then [preview the notification template](ref:preview-notifications) using the alert instance.
## Template labels
The set of [labels](ref:labels) for an alert instance is used to uniquely identify that alert among all other alert instances.
Labels determine how alerts are routed and managed for notifications, making their design key to the effectiveness of your alerting system.
Labels can be returned from an alert rule query, such as the `pod` label in a Kubernetes Prometheus query. You can also define additional labels in the alert rule to provide extra information for processing alerts.
Like annotations, labels are key-value pairs that can contain plain text or template code evaluated when the alert fires.
Template labels when the labels returned by your queries are insufficient. For instance:
- A new label based on a query value can group a subset of alerts differently, changing how notifications are sent.
- A new label based on a query value can be used in a notification policy to alter the notification contact point.
Here’s an example of templating a `severity` label based on the query value.
```
{{ if (gt $values.A.Value 90.0) -}}
critical
{{ else if (gt $values.A.Value 80.0) -}}
high
{{ else if (gt $values.A.Value 60.0) -}}
medium
{{ else -}}
low
{{- end }}
```
In this example, the value of the `severity` label is determined by the query value, and the possible options are `critical`, `high`, `medium`, or `low`. You can then use the `severity` label to change their notifications—for instance, sending `critical` alerts immediately or routing `low` alerts to a specific team for further review.
{{% admonition type="note" %}}
You should avoid displaying query values in labels, as this may create numerous unique alert instances—one for each distinct label value. Instead, use annotations for query values.
{{% /admonition %}}
### How to template a label
Complete the following steps to template a label.
1. Navigate to **Alerts & IRM** -> **Alert rules** -> create or edit an alert rule.
1. Scroll down to the **Configure labels and notifications** section.
1. Click **+ Add labels**.
1. Enter a **key** that identifies the label.
1. Copy in your template in the **value** field.
### Preview label templates
You can template label values when creating or editing an alert rule.
To preview label values, select `Use notification policy`, and then click on `Preview routing`.
Templating allows you to add dynamic data from queries to alert labels and annotations. Dynamic data enhances alert context, making it easier for responders to quickly assess and address the issue.
This page provides common examples for templating labels and annotations. For more information on templating, refer to:
- [Template annotations and labels](ref:alert-rule-templates)
- [Annotation and label template reference](ref:reference)
- [Alerting template language](ref:language)
## Annotation example
[Annotations](ref:annotations) add extra details to alert instances and are often used to provide helpful information for identifying the issue and guiding the response.
A common use case for annotations is to display the specific query value or threshold that triggered the alert.
For example, you can display the query value from the [`$values`](ref:reference-values) variable to inform about the CPU value that triggered the alert.
```
CPU usage has exceeded 80% ({{ $values.A.value }}) for the last 5 minutes.
```
Alternatively, you can use the [`index()`](ref:language-index) function to retrieve the query value as follows.
```
CPU usage has exceeded 80% ({{ index $values "A" }}) for the last 5 minutes.
```
```template_output
CPU usage has exceeded 80% (81.2345) for the last 5 minutes.
```
### Include labels for extra details
To provide additional context, you can include labels from the query. For instance, access the [`$labels`](ref:reference-labels) variable to display a label that informs about the affected instance:
```
CPU usage for {{ $labels.instance }} has exceeded 80% ({{ $values.A.Value }}) for the last 5 minutes.
```
```template_output
CPU usage for Instance 1 has exceeded 80% (81.2345) for the last 5 minutes.
```
Annotations can also be used to provide a summary of key alert labels, such as the environment and alert severity. For instance, you can display a summary of the alert with important labels like:
```
Alert triggered in {{ $labels.environment }} with severity {{ $labels.severity }}
```
```template_output
Alert triggered in production with severity critical.
```
### Print a range query
To print the value of an instant query you can print its Ref ID using the `index` function or the `$values` variable:
```
{{ $values.A.Value }}
```
For range queries, reduce them from a time series to an instant vector using a reduce expression. You can then print the result by referencing its Ref ID. For example, if the reduce expression averages `A` with the Ref ID `B`, you would then print `$values.B`:
```
{{ $values.B.Value }}
```
### Humanize the value of a query
To print the humanized value of an instant query, use the [`humanize`](ref:reference-humanize) function:
```
{{ humanize $values.A.Value }}
```
Alternatively:
```
{{ humanize (index $values "A").Value }}
```
```template_output
554.9
```
To print the value of an instant query as a percentage, use the [`humanizePercentage`](ref:reference-humanizepercentage) function:
```
{{ humanizePercentage $values.A.Value }}
```
```template_output
10%
```
For additional functions to display or format data, refer to:
- [Annotation and label template functions](ref:reference-functions)
- [Template language functions](ref:language-functions)
## Label example
[Labels](ref:labels) determine how alerts are routed and managed, ensuring that notifications reach the right teams at the right time. If the labels returned by your queries don’t fully capture the necessary context, you can create a new label and sets its value based on query data.
### Based on query value
Here’s an example of creating a `severity` label based on a query value:
```go
{{if(gt$values.A.Value90.0)-}}
critical
{{elseif(gt$values.A.Value80.0)-}}
high
{{elseif(gt$values.A.Value60.0)-}}
medium
{{else-}}
low
{{-end}}
```
In this example, the `severity` label is determined by the query value:
-`critical` for values above 90,
-`high` for values above 80,
-`medium` for values above 60,
- and `low` for anything below.
You can then use the `severity` label to control how alerts are handled. For instance, you could send `critical` alerts immediately, while routing `low` severity alerts to a team for further investigation.
{{% admonition type="note" %}}
You should avoid displaying query values in labels, as this may create many alert instances—one for each distinct label value. Instead, use annotations to convey query values.
{{% /admonition %}}
### Based on query label
You can use labels to differentiate alerts coming from various environments (e.g., production, staging, dev). For example, you may want to add a label that sets the environment based on the instance’s label. Here’s how you can template it:
- For instance `prod-server-1`, the label would be `production`.
- For `staging-server-1`, the label would be `staging`.
- All other instances would be labeled `development`.
To make this template more flexible, you can use a regular expression that matches the instance name with the instance name prefix using the [`match()`](ref:reference-match) function:
For users working with Grafana's legacy alerting system, templates can still be utilized to extract useful information from alert conditions. However, it's important to note that you cannot use `$labels` to print labels from the query if you are using classic conditions, and must use `$values` instead. The reason for this is classic conditions discard these labels to enforce uni-dimensional behavior (at most one alert per alert rule). If classic conditions didn't discard these labels, then queries that returned many time series would cause alerts to flap between firing and resolved constantly as the labels would change every time the alert rule was evaluated.
Instead, the `$values` variable contains the reduced values of all time series for all conditions that are firing. For example, if you have an alert rule with a query A that returns two time series, and a classic condition B with two conditions, then `$values` would contain `B0`, `B1`, `B2` and `B3`. If the classic condition B had just one condition, then `$values` would contain just `B0` and `B1`.
#### Print all labels from a classic condition
To print all labels of all firing time series use the following template (make sure to replace `B` in the regular expression with the Ref ID of the classic condition if it's different):
```go
{{range$k,$v:=$values-}}
{{if(match"B[0-9]+"$k)-}}
{{$k}}:{{$v.Labels}}{{end}}
{{end}}
```
For example, a classic condition for two time series exceeding a single condition would print:
```
B0: instance=server1
B1: instance=server2
```
If the classic condition has two or more conditions, and a time series exceeds multiple conditions at the same time, then its labels will be duplicated for each condition that is exceeded:
```
B0: instance=server1
B1: instance=server2
B2: instance=server1
B3: instance=server2
```
If you need to print unique labels you should consider changing your alert rules from uni-dimensional to multi-dimensional instead. You can do this by replacing your classic condition with reduce and math expressions.
#### Print all values from a classic condition
To print all values from a classic condition take the previous example and replace `$v.Labels` with `$v.Value`:
```go
{{range$k,$v:=$values-}}
{{if(match"B[0-9]+"$k)-}}
{{$k}}:{{$v.Value}}{{end}}
{{end}}
```
For example, a classic condition for two time series exceeding a single condition would print:
```
B0: 81.2345
B1: 84.5678
```
If the classic condition has two or more conditions, and a time series exceeds multiple conditions at the same time, then `$values` will contain the values of all conditions:
Notification templates and alert rule templates, such as annotations and labels, both use the Go template language, [text/template](https://pkg.go.dev/text/template).
Both types of templates can use the same keywords, functions, and comparison operators of the Go template language, such as `range`, `if`, `and`, `index`, `eq`, and more.
However, it's important to note that because notifications and alert rules operate in distinct contexts, some additional variables and functions are only available for either notification or alert rule templates. Refer to:
- [Annotation and label template reference](ref:alert-rule-template-reference)
This documentation provides an overview of the functions and operators of the Go template language that are available for both notification and alert rule templates.
## Print
To print the value of something, use `{{` and `}}`. You can print the value of a [variable](#variables), a field of a variable, the result of a function, or the value of dot.
```go
{{$values}}
{{$values.A.Value}}
{{humanize1000.0}}
{{.Alerts}}
```
## Dot
In `text/template`, there is a special cursor called dot, written as `.`. You can think of this cursor as a variable whose value changes depending on where in the template it is used.
At the start of notification templates, dot (`.`) refers to [Notification Data](ref:reference-notificationdata).
```go
{{.Alerts}}
```
In annotation and label templates, dot (`.`) is initialized with all alert data. It’s recommended to use the [`$labels` and `$values` variables](ref:alert-rule-template-reference-variables) instead to directly access the alert labels and query values.
{{% admonition type="note" %}}
Dot (`.`) might refer to something else when used in a [range](#range), a [with](#with), or when writing [templates](#templates) used in other templates.
{{% /admonition %}}
[//]: <> (The above section is not included in the shared file because `refs` links are not supported in shared files.)
Annotations and labels in alert rules can be defined using plain text. However, you can also define templates to customize their values with dynamic data from alert rule queries.
For example, you can template the `summary` annotation to include information from query values, providing relevant alert context for responders. Refer to [Template annotations and labels](ref:template-annotations-and-labels) for various use cases.
In templates, variables represent dynamic values from queries, while functions perform actions to transform or format this data.
## Variables
Variables represent dynamic values from alert rule queries that can be displayed or accessed in your templates.
The `$` and `.` symbols are used to reference variables and their properties. You can reference variables directly in your alert rule definitions using the `$` symbol followed by the variable name. Similarly, you can access properties of variables using the dot (`.`) notation in alert rule templates.
```
{{ $values.A.Value }}
```
Templates are based on the **Go templating system**. Refer to [Template language](ref:language) for additional information.
The following variables are available when templating annotations and labels:
| [$labels](#labels) | Contains all labels from the query. |
| [$values](#values) | Contains the labels and floating point values of all instant queries and expressions, indexed by their Ref IDs. |
| [$value](#value) | A string containing the labels and values of all instant queries; threshold, reduce and math expressions, and classic conditions in the alert rule. |
### $labels
The `$labels` variable contains all labels from the query.
{{< figure src="/media/docs/alerting/query-labels-and_value.png" max-width="1200px" caption="An alert rule displaying labels and value from a query" >}}
For example, suppose you have a query that returns CPU usage for all of your servers, and you have an alert rule that fires when any of your servers have exceeded 80% CPU usage for the last 5 minutes. You want to add a summary annotation to the alert that tells you which server is experiencing high CPU usage. With the `$labels` variable you can write a template that prints a human-readable sentence such as:
```
CPU usage for {{ $labels.instance }} has exceeded 80% for the last 5 minutes
```
The outcome of this template would be:
```
CPU usage for server1 has exceeded 80% for the last 5 minutes
```
> If you are using a classic condition then `$labels` will not contain any labels from the query. Classic conditions discard these labels in order to enforce uni-dimensional behavior (at most one alert per alert rule). If you want to use labels from the query in your template then use the example [here](ref:print-all-labels-from-a-classic-condition).
### $values
The `$values` variable is a table containing the labels and floating point values of all instant queries and expressions, indexed by their Ref IDs (e.g, `A`, `B`, `C`, etc.). It does not contain the results of range queries, as they can return hundreds or thousands of rows.
Each Ref IDs, such as `$values.A`, has the following properties
| `Value` | Float | The value returned by the instant query or expression. |
| `Labels` | Key/value pairs | The labels associated with the instance query or expression. |
Here's the previous example printing now the value of the instant query with Ref ID `A`:
```
{{ $values.A.Value }} CPU usage for {{ $labels.instance }} over the last 5 minutes.
```
If the alert has the label `instance=server1` and the query returns `81.2345`, the template would print:
```
81.2345 CPU usage for instance1 over the last 5 minutes.
```
If the query in Ref ID `A` is a range query rather than an instant query then add a reduce expression with Ref ID `B` and replace `$values.A.Value` with `$values.B.Value`:
```
{{ $values.B.Value }} CPU usage for {{ $labels.instance }} over the last 5 minutes.
```
Alternatively, you can use the `index()` function to retrieve the query value:
```
{{ index $values "B" }} CPU usage for {{ index $labels "instance" }} over the last 5 minutes.
```
#### $value
The `$value` variable is a string containing the labels and values of all instant queries; threshold, reduce and math expressions, and classic conditions in the alert rule.
This example prints the `$value` variable:
```
{{ $value }}: CPU usage has exceeded 80% for the last 5 minutes.
```
It would display something like this:
```
[ var='A' labels={instance=instance1} value=81.234 ]: CPU usage has exceeded 80% for the last 5 minutes.
```
Instead, we recommend using [$values](#values), which contains the same information as `$value` but is structured in an easier-to-use table format.
## Functions
Functions can perform actions in templates such as transforming or formatting data.
Note that the [functions provided by Go's template language](ref:language-functions), such as `index`, `and`, `printf`, and `len`, are available, along with many others.
In addition, the following functions are also available for templating annotations and labels:
| [args](#args) | []interface{} | map[string]interface{} | Translates a list of objects to a map with keys arg0, arg1 etc. |
| [safeHtml](#safehtml) | string | string | Marks string as HTML not requiring auto-escaping. |
| [externalURL](#externalurl) | none | string | Returns the external URL of the Grafana server as configured in the ini file(s). |
| [pathPrefix](#pathprefix) | none | string | Returns the path of the Grafana server as configured in the ini file(s). |
For further context on these functions, note that templating in Grafana is based on the [Prometheus template implementation](https://prometheus.io/docs/prometheus/latest/configuration/template_reference/), enabling the use of these functions and Prometheus-like templates for formatting alert messages within Grafana.
#### humanize
The `humanize` function humanizes decimal numbers:
```
{{ humanize 1000.0 }}
```
```
1k
```
#### humanize1024
The `humanize1024` works similar to `humanize` but but uses 1024 as the base rather than 1000:
```
{{ humanize1024 1024.0 }}
```
```
1ki
```
#### humanizeDuration
The `humanizeDuration` function humanizes a duration in seconds:
```
{{ humanizeDuration 60.0 }}
```
```
1m 0s
```
#### humanizePercentage
The `humanizePercentage` function humanizes a ratio value between 0 and 1 to a percentage:
```
{{ humanizePercentage 0.2 }}
```
```
20%
```
#### humanizeTimestamp
The `humanizeTimestamp` function humanizes a Unix timestamp:
```
{{ humanizeTimestamp 1577836800.0 }}
```
```
2020-01-01 00:00:00 +0000 UTC
```
#### toTime
The `toTime` function converts a Unix timestamp in seconds to time.:
```
{{ toTime 1727802106 }}
```
```
2024-10-01 17:01:46 +0000 UTC
```
#### title
The `title` function capitalizes the first character of each word:
```
{{ title "hello, world!" }}
```
```
Hello, World!
```
#### toUpper
The `toUpper` function returns all text in uppercase:
```
{{ toUpper "Hello, world!" }}
```
```
HELLO, WORLD!
```
#### toLower
The `toLower` function returns all text in lowercase:
```
{{ toLower "Hello, world!" }}
```
```
hello, world!
```
#### stripPort
The `stripPort` splits string into host and port, then returns only host:
```
{{ stripPort "example.com:8080" }}
```
```
example.com
```
#### match
The `match` function matches the text against a regular expression pattern:
```
{{ match "a.*" "abc" }}
```
```
true
```
#### reReplaceAll
The `reReplaceAll` function replaces text matching the regular expression:
The `args` function translates a list of objects to a map with keys arg0, arg1 etc. This is intended to allow multiple arguments to be passed to templates:
```
{{define "x"}}{{.arg0}} {{.arg1}}{{end}}{{template "x" (args 1 "2")}}
```
```
1 2
```
#### safeHtml
The `safeHtml` function marks string as HTML not requiring auto-escaping:
```
{{ safeHtml "<b>Text</b>"}}
```
```
<b>Text</b>
```
#### externalURL
The `externalURL` function returns the external URL of the Grafana server as configured in the ini file(s):
```
{{ externalURL }}
```
```
https://example.com/grafana
```
#### pathPrefix
The `pathPrefix` function returns the path of the Grafana server as configured in the ini file(s):
```
{{ pathPrefix }}
```
```
/grafana
```
## Differences with notification templates
Both notification templates and alert rule templates use the Go templating system. However, the [functions and variables available in notification templates](ref:notification-template-reference) differ from those used in annotations and labels templates, which are described in this documentation.
Annotation and label templates operate in the context of an individual alert instance, while notification templates apply to a notification that includes a group of alert(s).
For example, notification templates provide the `.Alerts` variable, which includes the list of all firing and resolved alerts in the notification. This variable is not available in alert rule templates, which operate within the context of a single alert instance.
Additionally, you cannot reuse templates for labels and annotations as you can with notification templates. Instead, you need to write each template inline within the label or annotation fields and manually copy them wherever you want to reuse the templates.
You can use templates to include data from queries and expressions in labels and annotations. For example, you might want to set the severity label for an alert based on the value of the query, or use the instance label from the query in a summary annotation so you know which server is experiencing high CPU usage.
When using custom labels with templates it is important to make sure that the label value does not change between consecutive evaluations of the alert rule as this will end up creating large numbers of distinct alerts. However, it is OK for the template to produce different label values for different alerts. For example, do not put the value of the query in a custom label as this will end up creating a new set of alerts each time the value changes. Instead use annotations.
All templates should be written in [text/template](https://pkg.go.dev/text/template). Regardless of whether you are templating a label or an annotation, you should write each template inline inside the label or annotation that you are templating. This means you cannot share templates between labels and annotations, and instead you will need to copy templates wherever you want to use them.
Each template is evaluated whenever the alert rule is evaluated, and is evaluated for every alert separately. For example, if your alert rule has a templated summary annotation, and the alert rule has 10 firing alerts, then the template will be executed 10 times, once for each alert. You should try to avoid doing expensive computations in your templates as much as possible.
{{% admonition type="caution" %}}
Extra whitespace in label templates can break matches with notification policies.
{{% /admonition %}}
## Variables
In Grafana templating, the `$` and `.` symbols are used to reference variables and their properties. You can reference variables directly in your alert rule definitions using the `$` symbol followed by the variable name. Similarly, you can access properties of variables using the dot (`.`) notation within alert rule definitions.
The following variables are available to you when templating labels and annotations:
### The labels variable
The `$labels` variable contains all labels from the query. For example, suppose you have a query that returns CPU usage for all of your servers, and you have an alert rule that fires when any of your servers have exceeded 80% CPU usage for the last 5 minutes. You want to add a summary annotation to the alert that tells you which server is experiencing high CPU usage. With the `$labels` variable you can write a template that prints a human-readable sentence such as:
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% for the last 5 minutes
```
> If you are using a classic condition then `$labels` will not contain any labels from the query. Classic conditions discard these labels in order to enforce uni-dimensional behavior (at most one alert per alert rule). If you want to use labels from the query in your template then use the example [here](#print-all-labels-from-a-classic-condition).
### The value variable
The `$value` variable is a string containing the labels and values of all instant queries; threshold, reduce and math expressions, and classic conditions in the alert rule. It does not contain the results of range queries, as these can return anywhere from 10s to 10,000s of rows or metrics. If it did, for especially large queries a single alert could use 10s of MBs of memory and Grafana would run out of memory very quickly.
To print the `$value` variable in the summary you would write something like this:
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% for the last 5 minutes: {{ $value }}
```
And would look something like this:
```
CPU usage for instance1 has exceeded 80% for the last 5 minutes: [ var='A' labels={instance=instance1} value=81.234 ]
```
Here `var='A'` refers to the instant query with Ref ID A, `labels={instance=instance1}` refers to the labels, and `value=81.234` refers to the average CPU usage over the last 5 minutes.
If you want to print just some of the string instead of the full string then use the `$values` variable. It contains the same information as `$value`, but in a structured table, and is much easier to use then writing a regular expression to match just the text you want.
### The values variable
The `$values` variable is a table containing the labels and floating point values of all instant queries and expressions, indexed by their Ref IDs.
To print the value of the instant query with Ref ID A:
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% for the last 5 minutes: {{ index $values "A" }}
```
For example, given an alert with the labels `instance=server1` and an instant query with the value `81.2345`, this would print:
```
CPU usage for instance1 has exceeded 80% for the last 5 minutes: 81.2345
```
If the query in Ref ID A is a range query rather than an instant query then add a reduce expression with Ref ID B and replace `(index $values "A")` with `(index $values "B")`:
```
CPU usage for {{ index $labels "instance" }} has exceeded 80% for the last 5 minutes: {{ index $values "B" }}
```
## Examples
The following examples attempt to show the most common use-cases we have seen for templates. You can use these examples verbatim, or adapt them as necessary for your use case. For more information on how to write text/template refer see [the beginner's guide to alert notification templates in Grafana](https://grafana.com/blog/2023/04/05/grafana-alerting-a-beginners-guide-to-templating-alert-notifications/).
### Print all labels, comma separated
To print all labels, comma separated, print the `$labels` variable:
```
{{ $labels }}
```
For example, given an alert with the labels `alertname=High CPU usage`, `grafana_folder=CPU alerts` and `instance=server1`, this would print:
```
alertname=High CPU usage, grafana_folder=CPU alerts, instance=server1
```
> If you are using classic conditions then `$labels` will not contain any labels from the query. Refer to [the $labels variable](#the-labels-variable) for more information.
### Print all labels, one per line
To print all labels, one per line, use a `range` to iterate over each key/value pair and print them individually. Here `$k` refers to the name and `$v` refers to the value of the current label:
```
{{ range $k, $v := $labels -}}
{{ $k }}={{ $v }}
{{ end }}
```
For example, given an alert with the labels `alertname=High CPU usage`, `grafana_folder=CPU alerts` and `instance=server1`, this would print:
```
alertname=High CPU usage
grafana_folder=CPU alerts
instance=server1
```
> If you are using classic conditions then `$labels` will not contain any labels from the query. Refer to [the $labels variable](#the-labels-variable) for more information.
### Print an individual label
To print an individual label use the `index` function with the `$labels` variable:
```
The host {{ index $labels "instance" }} has exceeded 80% CPU usage for the last 5 minutes
```
For example, given an alert with the labels `instance=server1`, this would print:
```
The host server1 has exceeded 80% CPU usage for the last 5 minutes
```
> If you are using classic conditions then `$labels` will not contain any labels from the query. Refer to [the $labels variable](#the-labels-variable) for more information.
### Print the value of a query
To print the value of an instant query you can print its Ref ID using the `index` function and the `$values` variable:
```
{{ index $values "A" }}
```
For example, given an instant query that returns the value 81.2345, this will print:
```
81.2345
```
To print the value of a range query you must first reduce it from a time series to an instant vector with a reduce expression. You can then print the result of the reduce expression by using its Ref ID instead. For example, if the reduce expression takes the average of A and has the Ref ID B you would write:
```
{{ index $values "B" }}
```
### Print the humanized value of a query
To print the humanized value of an instant query use the `humanize` function:
```
{{ humanize (index $values "A").Value }}
```
For example, given an instant query that returns the value 81.2345, this will print:
```
81.234
```
To print the humanized value of a range query you must first reduce it from a time series to an instant vector with a reduce expression. You can then print the result of the reduce expression by using its Ref ID instead. For example, if the reduce expression takes the average of A and has the Ref ID B you would write:
```
{{ humanize (index $values "B").Value }}
```
### Print the value of a query as a percentage
To print the value of an instant query as a percentage use the `humanizePercentage` function:
This function expects the value to be a decimal number between 0 and 1. If the value is instead a decimal number between 0 and 100 you can either divide it by 100 in your query or using a math expression. If the query is a range query you must first reduce it from a time series to an instant vector with a reduce expression.
### Set a severity from the value of a query
To set a severity label from the value of a query use an if statement and the greater than comparison function. Make sure to use decimals (`80.0`, `50.0`, `0.0`, etc) when doing comparisons against `$values` as text/template does not support type coercion. You can find a list of all the supported comparison functions [here](https://pkg.go.dev/text/template#hdr-Functions).
```
{{ if (gt $values.A.Value 80.0) -}}
high
{{ else if (gt $values.A.Value 50.0) -}}
medium
{{ else -}}
low
{{- end }}
```
### Print all labels from a classic condition
You cannot use `$labels` to print labels from the query if you are using classic conditions, and must use `$values` instead. The reason for this is classic conditions discard these labels to enforce uni-dimensional behavior (at most one alert per alert rule). If classic conditions didn't discard these labels, then queries that returned many time series would cause alerts to flap between firing and resolved constantly as the labels would change every time the alert rule was evaluated.
Instead, the `$values` variable contains the reduced values of all time series for all conditions that are firing. For example, if you have an alert rule with a query A that returns two time series, and a classic condition B with two conditions, then `$values` would contain `B0`, `B1`, `B2` and `B3`. If the classic condition B had just one condition, then `$values` would contain just `B0` and `B1`.
To print all labels of all firing time series use the following template (make sure to replace `B` in the regular expression with the Ref ID of the classic condition if it's different):
```
{{ range $k, $v := $values -}}
{{ if (match "B[0-9]+" $k) -}}
{{ $k }}: {{ $v.Labels }}{{ end }}
{{ end }}
```
For example, a classic condition for two time series exceeding a single condition would print:
```
B0: instance=server1
B1: instance=server2
```
If the classic condition has two or more conditions, and a time series exceeds multiple conditions at the same time, then its labels will be duplicated for each condition that is exceeded:
```
B0: instance=server1
B1: instance=server2
B2: instance=server1
B3: instance=server2
```
If you need to print unique labels you should consider changing your alert rules from uni-dimensional to multi-dimensional instead. You can do this by replacing your classic condition with reduce and math expressions.
### Print all values from a classic condition
To print all values from a classic condition take the previous example and replace `$v.Labels` with `$v.Value`:
```
{{ range $k, $v := $values -}}
{{ if (match "B[0-9]+" $k) -}}
{{ $k }}: {{ $v.Value }}{{ end }}
{{ end }}
```
For example, a classic condition for two time series exceeding a single condition would print:
```
B0: 81.2345
B1: 84.5678
```
If the classic condition has two or more conditions, and a time series exceeds multiple conditions at the same time, then `$values` will contain the values of all conditions:
```
B0: 81.2345
B1: 92.3456
B2: 84.5678
B3: 95.6789
```
## Functions
The following functions are available to you when templating labels and annotations:
### args
The `args` function translates a list of objects to a map with keys arg0, arg1 etc. This is intended to allow multiple arguments to be passed to templates:
```
{{define "x"}}{{.arg0}} {{.arg1}}{{end}}{{template "x" (args 1 "2")}}
```
```
1 2
```
### externalURL
The `externalURL` function returns the external URL of the Grafana server as configured in the ini file(s):
```
{{ externalURL }}
```
```
https://example.com/grafana
```
### graphLink
The `graphLink` function returns the path to the graphical view in [Explore](ref:explore) for the given expression and data source:
Use contact points to select your preferred communication channel for receiving notifications when your alert rules are firing. You can add, edit, delete, export, and test a contact point.
Use contact points to specify where to receive alert notifications. Contact points contain the configuration for sending alert notifications, including destinations like email, Slack, OnCall, webhooks, and their notification messages.
Testing a contact point is only available for Grafana Alertmanager.
A contact point can have one or multiple destinations, known as [contact point integrations](#list-of-supported-integrations). Alert notifications are sent to each integration within the chosen contact point.
On the **Contact Points** tab, you can:
- Add, edit, and view contact points and integrations.
- Search for name and type of contact points and integrations.
- View all existing contact points and integrations.
- View how many notification policies each contact point is being used for and navigate directly to the linked notification policies.
- View the status of notification deliveries.
- Export individual contact points or all contact points in JSON, YAML, or Terraform format.
- Delete contact points. Note that you cannot delete contact points that are in use by a notification policy. To proceed, either delete the notification policy or update it to use another contact point.
On the **Notification templates** tab, you can:
- View, edit, copy or delete existing notification templates.
## Add a contact point
Complete the following steps to add a contact point.
@@ -114,41 +125,23 @@ Complete the following steps to add a contact point.
1. From **Integration**, select a type and fill out mandatory fields. For example, if you choose email, enter the email addresses. Or if you choose Slack, enter the Slack channel and users who should be contacted.
1. Some contact point integrations, like email or Webhook, have optional settings. In **Optional settings**, specify additional settings for the selected contact point integration.
1. In Notification settings, optionally select **Disable resolved message** if you do not want to be notified when an alert resolves.
1. To add another contact point integration, click **Add contact point integration** and repeat steps 6 through 8.
1. Save your changes.
## Use notification templates
## Add another contact point integration
Use templates in contact points to customize your notifications.
A contact point can have multiple integrations, or destinations for sending notifications.
Complete the following steps to add templates to your contact point.
To add another integration to a contact point, complete the following steps.
1.Click an existing contact point or create a new one
1.In **Optional settings**, click any field that contains templates.
For example, if you are creating an email contact point integration, click **Message** or **Subject**.
1. Click **Edit**.
A dialog box opens where you can select templates.
1. [Optional] Click **Select existing template** to select a template and preview it using the default payload.
Click **Save** to use just a single template in the field.
You can also copy the selected template and use it in the custom tab.
1. [Optional] Click **Enter custom message** to customize and edit the field directly. Note that the title changes depending on the field you are editing.
Click **Save** to use just a single template in the field.
1. You can switch between the two tabs to access the list of available templates and copy them across to the customized version.
1. Click **Save contact point**.
1.Add or edit an existing contact point.
1.Click **Add contact point integration** and repeat the same steps as [Add a contact point](#add-a-contact-point).
- From **Integration**, select a type and fill out mandatory fields.
- In **Optional settings**, specify additional settings for the selected contact point integration.
1. Save your changes.
## Test a contact point
** For Grafana Alertmanager only.**
Complete the following steps to test a contact point.
Testing a contact point is only available for Grafana Alertmanager. Complete the following steps to test a contact point.
1. In the left-side menu, click **Alerts & IRM** and then **Alerting**.
1. Click **Contact points** to view a list of existing contact points.
@@ -166,17 +159,17 @@ The following table lists the contact point integrations supported by Grafana.
@@ -185,7 +178,17 @@ The following table lists the contact point integrations supported by Grafana.
| [Telegram](ref:telegram) | `telegram` |
| Threema Gateway | `threema` |
| VictorOps | `victorops` |
| WeCom | `wecom` |
| [Webhook](ref:webhook) | `webhook` |
| WeCom | `wecom` |
Some of these integrations are not compatible with [external Alertmanagers](ref:external-alertmanager). For the list of Prometheus Alertmanager integrations, refer to the [Prometheus Alertmanager receiver settings](https://prometheus.io/docs/alerting/latest/configuration/#receiver-integration-settings).
## Customize notification messages
In contact points, you can also customize notification messages. For example, when setting up an email contact point integration, click **Message** or **Subject** to modify it.
By default, notification messages include common alert details, which are usually sufficient for most cases.
If necessary, you can customize the content and format of notification messages. You can create a custom notification template, which can then be applied to one or more contact points.
On the **Notification templates** tab, you can view, edit, copy or delete notification templates. Refer to [manage notification templates](ref:manage-notification-templates) for instructions on selecting or creating a template for a contact point.
Use the Grafana Alerting - email integration to send email notifications when your alerts are firing. An email is sent when an alert fires and when an alert gets resolved.
Note that you can customize the `subject` and `message` of the email using [notification templates](ref:notification-templates). However, you cannot add HTML and CSS to email notifications for visual changes.
Use the Grafana Alerting - Grafana OnCall integration to effortlessly connect alerts generated by Grafana Alerting with Grafana OnCall, where you can then route them according to defined escalation chains and schedules.
{{< admonition type="note" >}}
You can also configure the integration from Grafana OnCall. For more information, refer to [Grafana OnCall documentation](http://grafana.com/docs/oncall/latest/integrations/grafana-alerting/).
You can also configure the integration from Grafana OnCall. For more information, refer to [Grafana OnCall documentation](http://grafana.com/docs/oncall/latest/configure/integrations/references/grafana-alerting/).
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.