Sobes.tech
Middle+

What type of metric is best suited for a graph of order count per second?

sobes.tech AI

Answer from AI

To display the number of orders per second, it is best to use a metric of the counter type with subsequent calculation of the rate of change over time.

A counter is a monotonically increasing metric that increments with each new order. To plot the number of orders per second, the derivative with respect to time of the counter is usually taken, for example, using the rate() function in Prometheus.

Example:

  • Counter: orders_total — the total number of orders since startup.
  • Graph: rate(orders_total[1m]) — the average number of orders per second over the last minute.

This approach allows for correct accounting of spikes and periods without orders.