# Lag metric to prometheus

**URL:** <https://forum.confluent.io/t/lag-metric-to-prometheus/628>\
**Category:** Confluent Cloud\
**Created:** [4 February 2021 13:44 UTC](https://forum.confluent.io/t/lag-metric-to-prometheus/628 "2021-02-04T13:44:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zachariahyoung](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/zachariahyoung/32/320_2.png) [@zachariahyoung](https://forum.confluent.io/u/zachariahyoung)\
**Post date:** [4 February 2021 13:44 UTC](https://forum.confluent.io/t/lag-metric-to-prometheus/628/1 "2021-02-04T13:44:43Z")

</div>

What are my options for exporting the max lag of a topic into promethus?

I have reviewed the metrics API already and don’t see anything at the consumer group level.

Seems like there should be a jmx exporter endpoint that we could consumer from.

Thanks  
Zach

---

<div class="post-metadata">

**Author:** ![mcascallares](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mcascallares/32/274_2.png) [@mcascallares](https://forum.confluent.io/u/mcascallares)\
**Post date:** [4 February 2021 15:08 UTC](https://forum.confluent.io/t/lag-metric-to-prometheus/628/2 "2021-02-04T15:08:28Z")

</div>

Have you checked [GitHub - seglo/kafka-lag-exporter: Monitor Kafka Consumer Group Latency with Kafka Lag Exporter](https://github.com/lightbend/kafka-lag-exporter)? It’s probably the easiest way to export the consumer lag from a Confluent Cloud deployment to Prometheus.

---

<div class="post-metadata">

**Author:** ![rmoff](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/rmoff/32/3_2.png) [@rmoff](https://forum.confluent.io/u/rmoff)\
**Post date:** [4 February 2021 16:24 UTC](https://forum.confluent.io/t/lag-metric-to-prometheus/628/3 "2021-02-04T16:24:50Z")

</div>

Hi @zachariahyoung, [per this doc](https://docs.confluent.io/cloud/current/monitoring/metrics-api.html#why-don-t-i-see-consumer-lag-in-the-metrics-api) at the moment this isn’t possible using the metrics API.

@mcascallares’s suggestion is a good alternative.

---

<div class="post-metadata">

**Author:** ![zachariahyoung](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/zachariahyoung/32/320_2.png) [@zachariahyoung](https://forum.confluent.io/u/zachariahyoung)\
**Post date:** [4 February 2021 16:28 UTC](https://forum.confluent.io/t/lag-metric-to-prometheus/628/4 "2021-02-04T16:28:40Z")

</div>

@mcascallares Yes we have reviewed this tool and have it working.

It just seems strange that I would have to use this tool.

Why can’t I pull this out of a jmx exporter or the Metrics API.

---

<div class="post-metadata">

**Author:** ![vaseemt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/vaseemt/32/2067_2.png) [@vaseemt](https://forum.confluent.io/u/vaseemt)\
**Post date:** [24 July 2022 08:26 UTC](https://forum.confluent.io/t/lag-metric-to-prometheus/628/5 "2022-07-24T08:26:29Z")

</div>

@mcascallares @zachariahyoung  
Can someone please share here how we can pass confluent metrics api endpoints in this lag exporter?([GitHub - seglo/kafka-lag-exporter: Monitor Kafka Consumer Group Latency with Kafka Lag Exporter](https://github.com/lightbend/kafka-lag-exporter)) …  
or how we can connect lag exporter to our confluent cloud endpoint? I couldn’t see this in the documentation.

---

<div class="post-metadata">

**Author:** ![vaseemt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/vaseemt/32/2067_2.png) [@vaseemt](https://forum.confluent.io/u/vaseemt)\
**Post date:** [26 July 2022 13:36 UTC](https://forum.confluent.io/t/lag-metric-to-prometheus/628/6 "2022-07-26T13:36:28Z")

</div>

@rmoff could you please help here?

---

<div class="post-metadata">

**Author:** ![santiago](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@santiago](https://forum.confluent.io/u/santiago)\
**Post date:** [1 August 2023 22:04 UTC](https://forum.confluent.io/t/lag-metric-to-prometheus/628/7 "2023-08-01T22:04:06Z")

</div>

@vaseemt

kafka-lag-exporter does not use the Confluent Metrics endpoints, it is configured as if it were a kafka client it uses the Kafka API

For example configurations check:

> <https://github.com/seglo/kafka-lag-exporter/blob/3fcb3c79f5a62745a167e9bc4cd92f0228cf9ad5/examples/standalone/application.conf#L13>

Here is an example of a what you need to set to connect to Confluent Cloud

```auto
bootstrap.servers=pkc-xxxxx.us-east-1.aws.confluent.cloud:9092
ssl.endpoint.identification.algorithm=https
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="{{ CLUSTER_API_KEY }}" password="{{ CLUSTER_API_SECRET }}";

```

This post was created on 2 years ago when Confluent Cloud did not have Consumer lag in its metrics the metric is now directly available see the documentation for more reference:  
[https://docs.confluent.io/cloud/current/monitoring/monitor-lag.html#monitor-consumer-lag-via-the-metrics-api](https://docs.confluent.io/cloud/current/monitoring/monitor-lag.html#monitor-consumer-lag-via-the-metrics-api)
