[ https://issues.apache.org/jira/browse/FLINK-8419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16346623#comment-16346623 ]
ASF GitHub Bot commented on FLINK-8419: --------------------------------------- Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/5336#discussion_r165021339 --- Diff: flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java --- @@ -560,16 +585,11 @@ private void updateMinPunctuatedWatermark(Watermark nextWatermark) { /** * Add current and committed offsets to metric group. - * - * @param metricGroup The metric group to use */ - protected void addOffsetStateGauge(MetricGroup metricGroup) { - // add current offsets to gage - MetricGroup currentOffsets = metricGroup.addGroup("current-offsets"); - MetricGroup committedOffsets = metricGroup.addGroup("committed-offsets"); - for (KafkaTopicPartitionState<KPH> ktp : subscribedPartitionStates) { - currentOffsets.gauge(ktp.getTopic() + "-" + ktp.getPartition(), new OffsetGauge(ktp, OffsetGaugeType.CURRENT_OFFSET)); - committedOffsets.gauge(ktp.getTopic() + "-" + ktp.getPartition(), new OffsetGauge(ktp, OffsetGaugeType.COMMITTED_OFFSET)); + protected void registerOffsetMetrics(List<KafkaTopicPartitionState<KPH>> partitionOffsetStates) { --- End diff -- make private? > Kafka consumer's offset metrics are not registered for dynamically discovered > partitions > ---------------------------------------------------------------------------------------- > > Key: FLINK-8419 > URL: https://issues.apache.org/jira/browse/FLINK-8419 > Project: Flink > Issue Type: Bug > Components: Kafka Connector, Metrics > Affects Versions: 1.4.0, 1.5.0 > Reporter: Tzu-Li (Gordon) Tai > Assignee: Tzu-Li (Gordon) Tai > Priority: Blocker > Fix For: 1.5.0, 1.4.1 > > > Currently, the per-partition offset metrics are registered via the > {{AbstractFetcher#addOffsetStateGauge}} method. That method is only ever > called for the initial startup partitions, and not for dynamically discovered > partitions. > We should consider adding some unit tests to make sure that metrics are > properly registered for all partitions. That would also safeguard us from > accidentally removing metrics. -- This message was sent by Atlassian JIRA (v7.6.3#76005)