cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to monitor Kafka consumption / lag when working with spark structured streaming?

Maatari
New Contributor III

I have just find out spark structured streaming do not commit offset to kafka but use its internal checkpoint system and that there is no way to visualize its consumption lag in typical kafka UI

- https://community.databricks.com/t5/data-engineering/can-we-commit-offset-in-spark-structured-stream... ?

Lag being important in stream processing, I can't imagine that the community did not come up with workaround to help with consumer lag tracking, but so far i could not find any out of the box solutions.

In any case, as i do not want to reinvent the will, I won't if anyone can share solution either out of the box or custom that people typically uses for this ?

 

1 ACCEPTED SOLUTION

Accepted Solutions

szymon_dybczak
Contributor III

Hi @Maatari ,

In spark structured streaming, current offset information is written to checkpoint files continuously. You can create piece of code that will extract information from checkpoint files aobut currently consumed offset, extract offset from Kafka and compare it.

As an example, look at below article. Unfortunately, I don't know anything about out of the box solution for this kind of problem.

Monitoring Spark Structured Streaming/Kafka Offsets with Prometheus and Grafana | by Lim Yow Cheng |...

PS. There is Kafka offset commiter for Spark Structured Streaming, but last commits are from 4 years ago 🙂

HeartSaVioR/spark-sql-kafka-offset-committer: Kafka offset committer for structured streaming query ...

View solution in original post

2 REPLIES 2

Rishabh_Tiwari
Databricks Employee
Databricks Employee

Hi @Maatari ,

Thank you for reaching out to our community! We're here to help you. 

To ensure we provide you with the best support, could you please take a moment to review the response and choose the one that best answers your question? Your feedback not only helps us assist you better but also benefits other community members who may have similar questions in the future.

If you found the answer helpful, consider giving it a kudo. If the response fully addresses your question, please mark it as the accepted solution. This will help us close the thread and ensure your question is resolved.

We appreciate your participation and are here to assist you further if you need it!

Thanks,

Rishabh

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group