I am having an issue with the checks API in InfluxDb OSS 2.5.1. I am trying to make a builder in javascript that converts users’ UI inputs into flux that I send to the checks API to create a check. The users will be able to specify complex thresholds that need to support operator precedence. Currently, I am generating the following flux.
...
crit = (r) => ((r["f1"] >= 22 and r["f2"] >= 40) or (r["f1"] <= 0 and r["f2"] <= 10) or r["f3"] == 0)
...
When I send it to the checks API it seems to remove the brackets, meaning that the ‘and’ and ‘or’ operators won’t work together. Is there something I can do about this?
crit = (r) =>
r["f1"] >= 22
and
r["f2"] >= 40
or
r["f1"] <= 0
and
r["f2"] <= 10
or
r["f3"] == 0
Hello @Moses_Wescombe,
Hmm I’m not sure. But perhaps as a workaround you can conditionally transform the levels and then alert on those levels where the levels meet your conditions?