Using ? to display a ratio of two queries or other advanced calculations

I have been struggling to find a visualization solution that fits my company's needs. I do not only need to visualize time series data but also need to be able to do calculations "vertically" across all the data at one point of time (averages/ratios) as well as "horizontally" across different points of time if possible (see my question here trying to achieve this with kibana).

Displaying averages in Grafana for example is no problem, but I already struggle when it comes to calculating a ratio of the kind (successful runs/all runs) because when using the lucene syntax to query elasticsearch there is no option to use calculations..

I am open to any visualization solution that could accomplish this, grafana, kibana, banana, I dont care as long as it works.. Thanks for the help.

Edit: To give a usecase without you having to click the link: I need to calculate the mean time between failures for jenkins pipelines. So the time between one build with result: "FAILURE" to the next one with a different ID with the result == "FAILURE".

Cheers,
Tobias

bump

Using an Area visualization you could follow the following steps in order to get a ratio overview of any information that is available:

  • In Area visualization, choose X-axis > data aggregation > Date histogram (just for this example, you can choose other dimensions also)
  • Split series > Sub aggregation > filters for instance a filter "jenkins_result:ok" and "NOT jenkins_result:ok". You see both filters being complement to each other.
  • Goto Metric&Axes, Y-axis > LeftAxis-1 > Mode > percentage

Using this approach you could choose other Splits or dimensions.

Hope this helps!

1 Like

Hello @jhg and welcome to this forums I suppose,

Your solution does work for sure, when using kibana there is also the option I found to use timelion to display some basic calculations and thus get a visual of a ratio but I can not get the mean-time between failure part to work in kibana without adding additional metrics to my data.

Even worse is the experience in Grafana, where I can not even get the ratio displayed, not even speaking of the MTBF.

Still thanks a lot for jumping right to my help soon after signing up on the forums,

Best,
Tobias

Hi Tobias,
Ah, I misread the part about the MTBF. Interesting question.
Visualizations are not the issue. For a MTBF I guess some iteration is necessary or preprocessing the data with for instance logstash.

Too bad the answer is not here yet

Regards,
Jaap

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.