# Kafka offset lag

**URL:** <https://community.dynatrace.com/t/kafka-offset-lag/21050>\
**Category:** Extensions\
**Tags:** kafka, jmx, extensions, apache\
**Created:** [December 14, 2020, 6:17pm UTC](https://community.dynatrace.com/t/kafka-offset-lag/21050 "2020-12-14T18:17:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill\_scheuernst](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bill_scheuernst/32/2211_2.png) [@bill\_scheuernst](https://community.dynatrace.com/u/bill_scheuernst)\
**Post date:** [December 14, 2020, 6:17pm UTC](https://community.dynatrace.com/t/kafka-offset-lag/21050/1 "2020-12-14T18:17:56Z")

</div>

I am working on creating a JMX plugin for Kafka metrics.

I would like to see the offset lag, per topic, and per partition. I have tried numerous times and am able to create a plugin, using the “records-lag” and “records-lag-max” Confluent metric, where the lag is per topic and per process, but never per topic and per partition, even though the configuration file suggests I can.

jmx plugin.pptx  
[jmx-plugin.pptx](https://community.dynatrace.com/uploads/short-url/iMc78DuQUYadtcejQsYvw0G6q3D.pptx) (129 KB)

---

<div class="post-metadata">

**Author:** ![david\_lopes](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/david_lopes/32/27273_2.png) [@david\_lopes](https://community.dynatrace.com/u/david_lopes)\
**Post date:** [December 14, 2020, 6:41pm UTC](https://community.dynatrace.com/t/kafka-offset-lag/21050/2 "2020-12-14T18:41:43Z")

</div>

You will need to download the extension json file (From technologies, Custom Extensions), add the partition dimension to the metric definition, and reupload it.

I can help if you would like to post the extension json file here

---

<div class="post-metadata">

**Author:** ![bill\_scheuernst](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bill_scheuernst/32/2211_2.png) [@bill\_scheuernst](https://community.dynatrace.com/u/bill_scheuernst)\
**Post date:** [December 14, 2020, 6:56pm UTC](https://community.dynatrace.com/t/kafka-offset-lag/21050/3 "2020-12-14T18:56:28Z")

</div>

I would very much appreciate any assistance. We are in the midst of a major project with a 1/1/21 deliverable.[plugin.txt](https://answers.dynatrace.com/storage/temp/27630-plugin.txt)

[offset\_lag.txt](https://answers.dynatrace.com/storage/temp/27651-offset-lag.txt)

It’s either this or use the “kafka-consumer-groups.sh” script with the offset lag output, and then graph it in Excel. We are looking for Kafka throughput for each partition as the “engine” generating the topics and data runs on each partition.  
[plugin.txt](https://community.dynatrace.com/uploads/short-url/CoRg1hOE5PqrR9iPGZsO3sUZdG.txt) (1.21 KB)  
[offset-lag.txt](https://community.dynatrace.com/uploads/short-url/gsMN4U6Qf7THwUW37jfmLDhvczh.txt) (2.55 KB)

---

<div class="post-metadata">

**Author:** ![Deepak\_Gupta](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@Deepak\_Gupta](https://community.dynatrace.com/u/Deepak_Gupta)\
**Post date:** [April 1, 2021, 7:56am UTC](https://community.dynatrace.com/t/kafka-offset-lag/21050/4 "2021-04-01T07:56:51Z")

</div>

Hi Bill,

Did you get the solution, I am looking to monitor&nbsp;per-topic metrics but not able to get

---

<div class="post-metadata">

**Author:** ![Saravanakumar\_P](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/saravanakumar_p/32/19257_2.png) [@Saravanakumar\_P](https://community.dynatrace.com/u/Saravanakumar_P)\
**Post date:** [July 15, 2021, 6:40pm UTC](https://community.dynatrace.com/t/kafka-offset-lag/21050/5 "2021-07-15T18:40:01Z")

</div>

Have you got the solution yet, I am also trying to find the&nbsp;offset lag, per topic, and per partition

---

<div class="post-metadata">

**Author:** ![MichalGebacki](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/michalgebacki/32/41585_2.png) [@MichalGebacki](https://community.dynatrace.com/u/MichalGebacki)\
**Post date:** [January 11, 2022, 8:51am UTC](https://community.dynatrace.com/t/kafka-offset-lag/21050/6 "2022-01-11T08:51:00Z")

</div>

Hi&nbsp;[@bill\_scheuernst](https://community.dynatrace.com/user/8813), how has your issue from this thread gone eventually? Have you found some solution? Would be great to have some updates on this subject!&nbsp;😃

---

<div class="post-metadata">

**Author:** ![Stephane\_LeMoig](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Stephane\_LeMoig](https://community.dynatrace.com/u/Stephane_LeMoig)\
**Post date:** [October 11, 2022, 2:38pm UTC](https://community.dynatrace.com/t/kafka-offset-lag/21050/7 "2022-10-11T14:38:20Z")

</div>

Hi, for us the solution was to:

- use a kafka-lag-exporter

- curl it every minute in a file

- transform our file

- use dynatrace\_ingest to put it the result in Dynatrace.

With this solution we can split the lag by topic, partition and consumergroup.
