Hi All!
I would like to make a some conditionbased summary with the ‘alertng’ engine in our Grafana v8.4.7 (23bf3ef043) but have problems with it.
I have some alert queries expressions etc, where the last is my real ‘alert’ (also with name of ‘alert’) expression with a possible logical 0
/1
results:
It is working fine, without any problems, but If I want to refer to it from my Summarization the corresponding simple Go template not works (‘not works’ mean, I get no real and expected results but simply the template string which used to be in case of any errors in the template).
Here is my sample/test template…
{{ if eq .Values.alert 0 ) }} Everything is fine {{ end }}
{{ if ne .Values.alert 0 ) }} There are problems {{ end }}
…which you can see as Summary annotation:
I can get the result of the .Values.alert
key, it is finely show me 0
or 1
based on its state, but the mentioned template simply now works. My first idea was a type mismatch between the comparable values (if the result could not be ‘int’), but tried with forced ‘float’ comparition the result is the same, non working template:
{{ if eq .Values.alert 0.0 ) }} Everything is fine {{ end }}
...
If I try to ask it about its type I get the following:
Go template:
{{ printf "%T" .Values.alert }}
Output:
state.templateCaptureValue
What is it, how could I handle it, what is my mistake?
Thanks for your attentions in advance!