Grafana alert thresholds from environment variable

I am using grafana 9.4.9

I created an alert rule with math expression $B > 10.0 (I. E. Alert if value exceeds 10)

Now I want to make this threshold configurable via environment variables during provisioning.

I tried writing the rule as

$$B > ${MY_ENV_VAR}

But this creates error ‘Failed to build rule evaluator’.

Is there anything else I can do about it?

Welcome @maloyghosh

If you are using InfluxDB with Flux, @fercasjr came up with a solution here.