-
Notifications
You must be signed in to change notification settings - Fork 27
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
Allow template variable substitution in panel promql #18
Conversation
As mentioned in the $title, allow any templated variable substitution in panel promql expressions. Signed-off-by: Arunprasad Rajkumar <arajkuma@redhat.com>
Unrelated info: We have recently added dashboard linting to k8s-mixin project. |
Hi @arajkumar - thank you for your PR! We're working on this exact thing in #17 - does that fix your problem? In this case, does |
@wuzuf would you mind figuring out if these variables should be supported too? |
@tomwilkie @wuzuf This PR is actually about supporting Grafana custom variables used in promql expressions., not related to Grafana global variable. Even after #17 , promql expression Here is a workaround we have applied on k8s-mixin to mitigate this problem. |
Indeed, I think the challenge here is to find the right "sample value" for a variable depending on where it is used inside the promQL expression. I see two options:
@arajkumar would you by any chance be in a position to share your dashboard json? I would not mind exploring options 2. |
Hey @wuzuf, Thanks for the explanation. Here is a sample dashboard from k8s-mixins which uses variable beyond metric label selection: https://github.com/kubernetes-monitoring/kubernetes-mixin/blob/master/dashboards/network-usage/cluster-total.libsonnet#L395 |
Ah I didn't clock that. Why does this dashboard need a template variable for the interval? Does it make more sense to use the |
IIUC, $interval template variable shall be replaced with global variable $__rate_interval. But still subquery template variable $resolution will get into same problem. |
Closing in favour of #19 |
As mentioned in the $title, this PR enables templated variable substitution in panel promql expressions.
Example: https://github.com/kubernetes-monitoring/kubernetes-mixin/blob/master/dashboards/network-usage/cluster-total.libsonnet#L395
Signed-off-by: Arunprasad Rajkumar arajkuma@redhat.com