fix(topology_lag): Kafka Topology Lag breaking when no offsets are commited for topic/partition#8589
Merged
Merged
Conversation
…mmited for topic/partition
5b3cb46 to
87827f0
Compare
pedroazevedo-fd
approved these changes
May 7, 2026
rzo1
reviewed
May 7, 2026
rzo1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR! Both bugs are real, and the bulk-committed() + null-check is exactly the right shape for the fix.
One heads-up before going further: master currently targets Storm 3 (Java 21, no Clojure). The PR description mentions manual verification on a 2.8.7 cluster, so if you also need this fix on the 2.x line, happy to get a separate PR against the 2.x branch — they're maintained independently now.
A couple of things on the change itself:
- Testcontainers without a Docker fallback — see inline at
KafkaOffsetLagUtilTest.java:45. This will hard-fail on every CI runner (and dev box) without Docker.storm-metrics-prometheusalready established the right pattern; please mirror it. - Formatting churn in
KafkaOffsetLagUtil.java— the bug fix is ~6 useful lines, but the diff also reformats half the file (continuation indent 4→8, plus a Javadoc tweak). Bug fixes that get cherry-picked to release branches are much easier to backport when they aren't entangled with style-only changes. Consider splitting the formatting into a separate commit (or dropping it from this PR). - Minor observability regression in
TopologySpoutLag.java— see inline.
Nothing blocking on (2) or (3) — author's call.
da2b705 to
49835fe
Compare
Contributor
|
Hey @DiogoP98. |
rzo1
approved these changes
May 8, 2026
pedroalves-fd
approved these changes
May 8, 2026
joaomarques-fd
approved these changes
May 8, 2026
reiabreu
approved these changes
May 8, 2026
Contributor
|
@rzo1 happy to merge this into both master and 2.x |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Fixes the silent failure of the topology spout lag query, where the Storm UI's "Topology Lag" panel stops working with this warning being logged repeatedly for every Kafka spout:
The regression was introduced by the Kafka client bump from 3.9.0 → 4.x (#8243). Two issues, on the same code path:
Together, (1) restores correct lag reporting for partitions with no committed offset, and (2) ensures any future monitor failure is reported usefully instead of as a generic
ClassCastExceptionwith a null message.How was the change tested
Integration test
KafkaOffsetLagUtilTest#getOffsetLagsReportsCommittedOffsetForCommittedPartitionsAndMinusOneForUncommittedPartitionscreates a 2-partition topic, commits an offset on partition 0 only, and calls the productionKafkaOffsetLagUtil.getOffsetLags(...)end-to-end. Asserts the committed offset is reported for partition 0 and-1for partition 1 (the regression case — pre-fix this NPE'd inside the monitor and surfaced asClassCastExceptionupstream inTopologySpoutLag).Manual verification on a Storm 2.8.7 cluster
Issue: #8588