PromQL - Kafka JMX Metrics - BytesInPerSec -

Hello Team,

I am new to prometheus and have setup JMX_Exporter for Kafka JMX Metrics.
I am still getting my head around rates in prometheus and have been reading on Counter/Gauges/Histograms etc…

I am trying to get the average BytesInPerSec

I noticed below properties give me the BytesInPerSec

  1. kafka_server_BrokerTopicMetrics_Count
  2. kafka_server_BrokerTopicMetrics_FifteenMinuteRate
  3. kafka_server_BrokerTopicMetrics_FiveMinuteRate
  4. kafka_server_BrokerTopicMetrics_MeanRate
  5. kafka_server_BrokerTopicMetrics_OneMinuteRate

So since BytesInPerSec_Count is total count of bytes in since start of prometheus exporter, and does not decrease unless binary is shutdown, i am thinking this as a Counter, correct me here.

Question is

  • What is the difference between the below 2 queries ?

  • Does FiveMinuteRate give me the info about the last5min changes in BytesInPerSec?

  • Also what is the difference between rate and avg_over_time ?

rate(kafka_server_BrokerTopicMetrics_Count{env="Cluster1",name="BytesInPerSec",topic=""}[5m])

rate(kafka_server_BrokerTopicMetrics_FiveMinuteRate{env="Cluster1",topic="",name="BytesInPerSec"}[5m])

Also do we apply rates only on Counters ?

Thanks in Advance.
Any document helping me to understand the rates and other functions will really help.
I’ve been refering this Query functions | Prometheus

rates should only apply to counters.

I would expect that kafka_server_BrokerTopicMetrics_FiveMinuteRate and rate(kafka_server_BrokerTopicMetrics_Count[5m]) give comparable values.

You could look at the JMX help to know what those metrics represent.