Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grafana global variables not interpolated in alerts #182

Closed
brycefisher opened this issue Oct 22, 2020 · 3 comments
Closed

Grafana global variables not interpolated in alerts #182

brycefisher opened this issue Oct 22, 2020 · 3 comments
Labels
type/bug Something isn't working

Comments

@brycefisher
Copy link
Contributor

brycefisher commented Oct 22, 2020

Queries used in alerts don't have any macros or variables expanded. This makes it very challenging to reuse panels for alerts.

Here's an example error (whitespace added) from a query that has a dashboard variable called $BusinessUnit:

Semantic error:
'MyTable
| where timestamp >= datetime(2020-10-22T18:23:46.551Z) and timestamp <= datetime(2020-10-22T18:28:46.551Z) 
    and business_unit == \"$BusinessUnit\"
| summarize count() by bin(timestamp, $__interval)
| order by timestamp asc'
has the following semantic error: 
  SEM0100: 'summarize' operator: 
    Failed to resolve scalar expression named '$__interval'.

Notice that neither $__interval nor $BusinessUnit was expanded in the query the alert generated.

Here's the same panel rendered as a line chart:
Screen Shot 2020-10-22 at 11 35 17 AM

@marefr
Copy link
Member

marefr commented Oct 27, 2020

Template variables support, like business unit example, are limited by grafana/grafana#6557.

The $__interval one though can be supported if implemented in this data source.

@marefr marefr added the type/bug Something isn't working label Oct 27, 2020
@marefr marefr changed the title Feature: Interpolate Grafana Variables in Alerts Grafana global variables not interpolated in alerts Oct 27, 2020
@brycefisher
Copy link
Contributor Author

@marefr thanks for the info! It would be great to support the $__interval and other time macros given the blocker from grafana/grafana#6557

@sunker
Copy link
Contributor

sunker commented Feb 2, 2021

Seems like $__interval support is already implemented.

@sunker sunker closed this as completed Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants