You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "lkuchars (via GitHub)" <gi...@apache.org> on 2026/02/04 16:35:20 UTC
[PR] NIFI-15545 Extend KafkaConsumerService.getPartitionStates() to return lag information [nifi]
lkuchars opened a new pull request, #10852:
URL: https://github.com/apache/nifi/pull/10852
NIFI-15545 Extend KafkaConsumerService.getPartitionStates() to return lag information
<!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
<!-- contributor license agreements. See the NOTICE file distributed with -->
<!-- this work for additional information regarding copyright ownership. -->
<!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
<!-- (the "License"); you may not use this file except in compliance with -->
<!-- the License. You may obtain a copy of the License at -->
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- Unless required by applicable law or agreed to in writing, software -->
<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
<!-- See the License for the specific language governing permissions and -->
<!-- limitations under the License. -->
# Summary
[NIFI-15545](https://issues.apache.org/jira/browse/NIFI-15545)
# Tracking
Please complete the following tracking steps prior to pull request creation.
### Issue Tracking
- [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
### Pull Request Tracking
- [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
- [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
- [x] Pull request contains [commits signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) with a registered key indicating `Verified` status
### Pull Request Formatting
- [x] Pull Request based on current revision of the `main` branch
- [x] Pull Request refers to a feature branch with one commit containing changes
# Verification
Please indicate the verification steps performed prior to pull request creation.
### Build
- [ ] Build completed using `./mvnw clean install -P contrib-check`
- [ ] JDK 21
- [ ] JDK 25
### Licensing
- [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
- [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
### Documentation
- [ ] Documentation formatting appears as expected in rendered files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15545 Extend KafkaConsumerService.getPartitionStates() to return lag information [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #10852:
URL: https://github.com/apache/nifi/pull/10852#discussion_r2765467206
##########
nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-service-api/src/main/java/org/apache/nifi/kafka/service/api/common/ConsumerMetrics.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.kafka.service.api.common;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import java.util.OptionalLong;
+
+public class ConsumerMetrics {
+
+ private final static ConsumerMetrics EMPTY = new ConsumerMetrics();
+
+ private final OptionalLong currentLag;
+
+ public ConsumerMetrics(final OptionalLong currentLag) {
+ this.currentLag = currentLag;
+ }
+
+ private ConsumerMetrics(){
+ this.currentLag = OptionalLong.empty();
+ }
+
+ public static ConsumerMetrics empty(){
Review Comment:
This method seems unnecessary, as on the one hand, this class is just a wrapper for the currentLag. If the goal is the support other metrics in the future, it may be less clear what `empty` means.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15545 Extend KafkaConsumerService.getPartitionStates() to return lag information [nifi]
Posted by "lkuchars (via GitHub)" <gi...@apache.org>.
lkuchars commented on code in PR #10852:
URL: https://github.com/apache/nifi/pull/10852#discussion_r2770499601
##########
nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-service-api/src/main/java/org/apache/nifi/kafka/service/api/common/ConsumerMetrics.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.kafka.service.api.common;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import java.util.OptionalLong;
+
+public class ConsumerMetrics {
+
+ private final static ConsumerMetrics EMPTY = new ConsumerMetrics();
+
+ private final OptionalLong currentLag;
+
+ public ConsumerMetrics(final OptionalLong currentLag) {
+ this.currentLag = currentLag;
+ }
+
+ private ConsumerMetrics(){
+ this.currentLag = OptionalLong.empty();
+ }
+
+ public static ConsumerMetrics empty(){
Review Comment:
Yes, there are lots of other metrics on the consumer group that I had in mind for later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15545 Extend KafkaConsumerService.getPartitionStates() to return lag information [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #10852:
URL: https://github.com/apache/nifi/pull/10852#issuecomment-3855597138
Thanks for the reply @lkuchars.
I think some additional consideration is needed for those other metrics. In particular, evaluating options for plugging in an implementation that integrates more closely with Kafka's available telemetry capabilities. That is worth considering in a separate Jira issue.
For now, it seems best to proceed with the narrow additional of support for current lag, as it aligns with available Kafka Consumer methods.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15545 Extend KafkaConsumerService.getPartitionStates() to return lag information [nifi]
Posted by "lkuchars (via GitHub)" <gi...@apache.org>.
lkuchars commented on PR #10852:
URL: https://github.com/apache/nifi/pull/10852#issuecomment-3855425226
>
> Instead, it seems better to add a new method to the `KafkaConsumerService` interface, taking a `TopicPartitionSummary` and returning the `OptionalLong` of current lag. There is a balance between simply reproducing Kafka Client methods, but in this case, it seems better to keep the methods distinct.
Good point @exceptionfactory. I agree that the new method would be a better fit. But, Instead of using the method to return just the lag I would call this `metrics()` or `kafkaMetrics()`, it has a corresponding method in the `KafkaConsumer` implementation. The new method would return a new object of class `Metrics`, and for now, the metrics returned there would be lag, bytes received, throughput, just a few useful ones. KafkaConsumer collects/computes metrics on poll.
Whole list is available here https://kafka.apache.org/41/operations/monitoring/#common-monitoring-metrics-for-producerconsumerconnectstreams
WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15545 Extend KafkaConsumerService.getPartitionStates() to return lag information [nifi]
Posted by "lkuchars (via GitHub)" <gi...@apache.org>.
lkuchars commented on PR #10852:
URL: https://github.com/apache/nifi/pull/10852#issuecomment-3856776955
> Please make sure that
>
> ```
> mvn clean install -Pcontrib-check -Pintegration-tests
> ```
>
@pvillard31 Thanks for looking at the changes. Sorry for that. I forgot about contrib-check profile. I rarely push sth here. Also, I've added the ITest on the first push.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15545 Extend KafkaConsumerService.getPartitionStates() to return lag information [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory merged PR #10852:
URL: https://github.com/apache/nifi/pull/10852
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org