public class KafkaSourceReaderMetrics extends Object
KafkaSourceReader
.
All metrics of Kafka source reader are registered under group "KafkaSourceReader", which is a
child group of OperatorMetricGroup
. Metrics
related to a specific topic partition will be registered in the group
"KafkaSourceReader.topic.{topic_name}.partition.{partition_id}".
For example, current consuming offset of topic "my-topic" and partition 1 will be reported in metric: "{some_parent_groups}.operator.KafkaSourceReader.topic.my-topic.partition.1.currentOffset"
and number of successful commits will be reported in metric: "{some_parent_groups}.operator.KafkaSourceReader.commitsSucceeded"
All metrics of Kafka consumer are also registered under group "KafkaSourceReader.KafkaConsumer". For example, Kafka consumer metric "records-consumed-total" can be found at: {some_parent_groups}.operator.KafkaSourceReader.KafkaConsumer.records-consumed-total"
Modifier and Type | Field and Description |
---|---|
static String |
COMMITS_FAILED_METRIC_COUNTER |
static String |
COMMITS_SUCCEEDED_METRIC_COUNTER |
static String |
COMMITTED_OFFSET_METRIC_GAUGE |
static String |
CURRENT_OFFSET_METRIC_GAUGE |
static long |
INITIAL_OFFSET |
static String |
KAFKA_CONSUMER_METRIC_GROUP |
static String |
KAFKA_SOURCE_READER_METRIC_GROUP |
static String |
PARTITION_GROUP |
static String |
TOPIC_GROUP |
Constructor and Description |
---|
KafkaSourceReaderMetrics(MetricGroup parentMetricGroup) |
Modifier and Type | Method and Description |
---|---|
void |
recordCommittedOffset(org.apache.kafka.common.TopicPartition tp,
long offset)
Update the latest committed offset of the given
TopicPartition . |
void |
recordCurrentOffset(org.apache.kafka.common.TopicPartition tp,
long offset)
Update current consuming offset of the given
TopicPartition . |
void |
recordFailedCommit()
Mark a failure commit.
|
void |
recordSucceededCommit()
Mark a successful commit.
|
void |
registerKafkaConsumerMetrics(org.apache.kafka.clients.consumer.KafkaConsumer<?,?> kafkaConsumer)
Register metrics of KafkaConsumer in Kafka metric group.
|
void |
registerTopicPartition(org.apache.kafka.common.TopicPartition tp)
Register metric groups for the given
TopicPartition . |
public static final String KAFKA_SOURCE_READER_METRIC_GROUP
public static final String TOPIC_GROUP
public static final String PARTITION_GROUP
public static final String CURRENT_OFFSET_METRIC_GAUGE
public static final String COMMITTED_OFFSET_METRIC_GAUGE
public static final String COMMITS_SUCCEEDED_METRIC_COUNTER
public static final String COMMITS_FAILED_METRIC_COUNTER
public static final String KAFKA_CONSUMER_METRIC_GROUP
public static final long INITIAL_OFFSET
public KafkaSourceReaderMetrics(MetricGroup parentMetricGroup)
public void registerKafkaConsumerMetrics(org.apache.kafka.clients.consumer.KafkaConsumer<?,?> kafkaConsumer)
kafkaConsumer
- Kafka consumer used by partition split reader.public void registerTopicPartition(org.apache.kafka.common.TopicPartition tp)
TopicPartition
.tp
- Registering topic partitionpublic void recordCurrentOffset(org.apache.kafka.common.TopicPartition tp, long offset)
TopicPartition
.tp
- Updating topic partitionoffset
- Current consuming offsetpublic void recordCommittedOffset(org.apache.kafka.common.TopicPartition tp, long offset)
TopicPartition
.tp
- Updating topic partitionoffset
- Committing offsetpublic void recordSucceededCommit()
public void recordFailedCommit()
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.