Skip to content

Commit

Permalink
Add NPE check for updateNumBytesInCounter
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffxiang committed Oct 30, 2024
1 parent 8be3077 commit 8c9ebbe
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public void removeRecordsLagMetric(TopicUriPartition tp) {
* bytes-consumed-total and count it towards the counter.
*/
public void updateNumBytesInCounter() {
if (this.bytesConsumedTotalMetric != null) {
if (this.bytesConsumedTotalMetric != null && this.bytesConsumedTotalMetric.metricValue() != null) {
long bytesConsumedUntilNow =
((Number) this.bytesConsumedTotalMetric.metricValue()).longValue();
long bytesConsumedSinceLastUpdate = bytesConsumedUntilNow - latestBytesConsumedTotal;
Expand Down

0 comments on commit 8c9ebbe

Please sign in to comment.