We're running a Java service, logging metrics with Micrometer to InfluxDB and using Grafana to visualize it. Micrometer only supports string tag/values, but I've stored an integer as a string value, query_span
and want to filter on that in Grafana.
This is what I've point-n-clicked myself to in Grafana:
SELECT sum("value") FROM "db_read"
WHERE ("short_name" = 'app' AND "environment" =~ /^$site$/
AND "query_span" > '1' AND "query_span" <= '7')
AND $timeFilter
GROUP BY time(5m) fill(null)
The query_span
part does not yield any data. Dropping the single-quotes doesn't work either. When I set the lower part of the interval to "query_span" >= '2'
instead, I get some hits. Which leads me to believe some kinda string-to-string compare is going on (and the 'equal' part of 'greater or equal' returns true when =="2"
). I see Influx supports casting selected fields, bit I don't understand how to cast in the WHERE clause (naïve attempt failed).
Note: this is not a clone of this, distinct, Grafana/InfluxDB question. (Oh do I miss the good ol' days where these disclaimers were superfluous! :)
Edit: regex filtering works but is not ideal.