Raj Sharma
Raj Sharma

Reputation: 13

How to create a prometheus graph in grafana to get division of two queries?

I have created two queries in Prometheus data source.

  1. sum(increase(transaction_seconds_sum{action = 'initiate'}[1m]))

  2. sum(increase(transaction_seconds_count{action = 'initiate'}[1m]))

Is there any way to divide the first query by the second one and generate one graph in a specific time interval?

Upvotes: 1

Views: 8074

Answers (1)

mweirauch
mweirauch

Reputation: 2248

I assume you want to calculate the average? Then:

sum(increase(transaction_seconds_sum{action = 'initiate'}[1m])) / sum(increase(transaction_seconds_count{action = 'initiate'}[1m]))

See here for the available operators.

Upvotes: 1

Related Questions