Open cazeaux opened 1 month ago
Just an update to report that the issue is also present in Grafana 11.0.0
Hello
I have found where the regression happened. It has been introduced in v10.1.6, with this commit: https://github.com/grafana/grafana/commit/ae581286bb4894df7e75f1a48ec8a2a7f5f201be#diff-79a8e0c726aee282de46b93b30ea4022261351ea9c0d46e6f988296cfcf5c900
We see in this commit that the replace
happens before the enhanceExprWithAdHocFilters
. So this is why the variables are not replaces anymore.
The same inversion is also there in the last version, even if the code has significantly changed : https://github.com/grafana/grafana/blob/c73bbf19a1ed4f2f092a40922dda580775e424e4/packages/grafana-prometheus/src/datasource.ts#L844-L851
thanks for reporting this issue and for your contribution @cazeaux 🎉 I've added the issue to the team's board
What happened?
When you use a variable as a value for an adhoc filter, the variable is not evaluated and the filter is applied with the variable name. The problem is seen with Prometheus datasource.
Problem seen first in 10.2.1, and confirmed in 10.4.2
What did you expect to happen?
The variable should be evaluated, and the filter applied with the variable value instead of its name.
Did this work before?
It was working at least up to version 10.1.2.
How do we reproduce it?
platform=~$platform
platform=~$platform
. See inspect below:An example dashboard to reproduce the bug (you might change
platform
label to another label):Is the bug inside a dashboard panel?
No
Environment (with versions)?
Grafana: 10.2.1 and recent versions OS: Windows 10 Browser: Edge, Vivaldi, Chrome, Firefox
Grafana platform?
Kubernetes
Datasource(s)?
prometheus