Chandra Mohan Soni created FLINK-41829:
------------------------------------------
Summary: Report each partition's records lag in KafkaSource
Key: FLINK-41829
URL: https://issues.apache.org/jira/browse/FLINK-41829
Project: Flink
Issue Type: Improvement
Components: Connectors / Kafka
Reporter: Chandra Mohan Soni
KafkaSourceReaderMetrics reports pendingRecords, one gauge per source reader:
the sum of the Kafka consumer's records-lag metric over every partition that
the reader tracks. When a KafkaSource reads several topics, a reader usually
holds partitions of more than one topic, so no Flink metric shows how far
behind each topic or partition is.
The Kafka consumer metrics under KafkaSourceReader.KafkaConsumer do not fill
this gap: they are registered by metric name only, once, when the consumer is
created, before any per-partition records-lag metric exists (see FLINK-35404).
Proposal: register a recordsLag gauge in each topic-partition group, next to
currentOffset and committedOffset:
<operator
scope>.KafkaSourceReader.topic.<topic>.partition.<partition>.recordsLag
It reads the same tracked records-lag metric as pendingRecords, with the same
conversion, so the partition values of one reader add up to pendingRecords. A
partition reports 0 until the reader fetches records from it and after the
reader stops reading it, which are the partitions that pendingRecords leaves
out.
This adds one public constant, RECORDS_LAG_METRIC_GAUGE, to the @PublicEvolving
class KafkaSourceReaderMetrics, and one gauge for each assigned partition (the
same cost as currentOffset). No FLIP should be needed: it is a
connector-specific metric next to the existing per-partition ones.
I have a patch with tests and docs ready and would like to work on this:
https://github.com/apache/flink-connector-kafka/compare/main...chandrsoni:flink-connector-kafka:per-partition-records-lag
Could a committer assign the ticket to me?
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)