# PromQL - Kafka JMX Metrics - BytesInPerSec -

**URL:** <https://discuss.prometheus.io/t/promql-kafka-jmx-metrics-bytesinpersec/177>\
**Category:** PromQL\
**Created:** [April 29, 2021, 11:26am UTC](https://discuss.prometheus.io/t/promql-kafka-jmx-metrics-bytesinpersec/177 "2021-04-29T11:26:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SriraagSridhar](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/sriraagsridhar/32/104_2.png) [@SriraagSridhar](https://discuss.prometheus.io/u/SriraagSridhar)\
**Post date:** [April 29, 2021, 11:26am UTC](https://discuss.prometheus.io/t/promql-kafka-jmx-metrics-bytesinpersec/177/1 "2021-04-29T11:26:29Z")

</div>

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](https://prometheus.io/docs/prometheus/latest/querying/functions/)

---

<div class="post-metadata">

**Author:** ![roidelapluie](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/roidelapluie/32/6_2.png) [@roidelapluie](https://discuss.prometheus.io/u/roidelapluie)\
**Post date:** [May 11, 2021, 9:43am UTC](https://discuss.prometheus.io/t/promql-kafka-jmx-metrics-bytesinpersec/177/2 "2021-05-11T09:43:28Z")

</div>

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.
