I want to create a panel in grafana but I am not able to get the exact data even from Influxdb itself.
I have some jenkins pipelines and I want first to count them all and then the ones that are successful in order to have a percentage of how successful was the whole pipeline. I have managed to get the 2 results in 2 queries but I cannot do the division afterward.
from(bucket: "influxdb")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "jenkins_data")
|> filter(fn: (r) => r["_field"] =~ /own_tags|build_result_ordinal/)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> group(columns: ["_measurement"])
|> filter(fn: (r) => r.own_tags =~ /bla.*foo/ and r.build_result_ordinal == 0)
|> count(column: "build_result_ordinal")
from(bucket: "influxdb")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "jenkins_data")
|> filter(fn: (r) => r["_field"] =~ /own_tags|build_result_ordinal/)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> group(columns: ["_measurement"])
|> filter(fn: (r) => r.own_tags =~ /bla.*foo/)
|> count(column: "build_result_ordinal")
I have put them also in 2 variables but doing
x.build_result_ordinal/z.build_result_ordinal * 100
does not yield any results.