Skip to content

[FLINK-35404] Report all metrics of KafkaConsumer in new Kafka source #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hmit
Copy link

@hmit hmit commented May 20, 2024

Flink docs state that all KafkaConsumer related metrics are reported by Flink under MetricGroup KafkaSourceReader.KafkaConsumer per flink docs.
However, only metrics registered with KafkaConsumer at creation are registered under aforementioned Flink MetricGroup.
This causes important metrics like consumer-lag to be missing. Flink does publish consumer-lag metric but loses fidelity like topic and partition info available as tags.

The PR fixes this issue by providing a Flink MetricGroup implementation for Kafka MetricsReporter interface. This ensures that metrics registered at any point in kafka consumer lifecycle will be correctly added to Flink MetricRegistry.

Copy link

boring-cyborg bot commented May 20, 2024

Thanks for opening this pull request! Please check out our contributing guidelines. (https://flink.apache.org/contributing/how-to-contribute.html)

@tomncooper
Copy link
Contributor

I would be helpful if you included some kind of description with this PR, even if it just a copy of the JIRA issue description. It helps reviewers.

With regard to the metrics reporter, your issue mentions missing consumer lag. However, AFAIK the Kafka connector does not use a Kafka side consumer group so there would be no lag to report?

@hmit
Copy link
Author

hmit commented Apr 11, 2025

@tomncooper thanks for taking the time to look at it and providing feedback! I've updated the PR description with some details, is it possible to give this another look?

The kafka connector very much still uses a kafka side consumer group to consume. In fact, the metrics from the said consumer are cherry-picked to be reported using Flink MetricGroup - KafkaSourceReader.KafkaConsumer. This is the relevant section from flink docs on the matter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants