Skip to content

Commit

Permalink
fix(plugin-server): update kafkaAbsolutePartitionCount even on empty … (
Browse files Browse the repository at this point in the history
#17791)

fix(plugin-server): update kafkaAbsolutePartitionCount even on empty consume loop
  • Loading branch information
bretthoerner authored Oct 5, 2023
1 parent bb996d1 commit 0d6218f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugin-server/src/kafka/batch-consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ export const startBatchConsumer = async ({
// protocol. If we never manage to consume, we don't want our health checks to pass.
lastConsumeTime = Date.now()

for (const [topic, count] of countPartitionsPerTopic(consumer.assignments())) {
kafkaAbsolutePartitionCount.labels({ topic }).set(count)
}

if (!messages) {
status.debug('🔁', 'main_loop_empty_batch', { cause: 'undefined' })
continue
}

for (const [topic, count] of countPartitionsPerTopic(consumer.assignments())) {
kafkaAbsolutePartitionCount.labels({ topic }).set(count)
}

status.debug('🔁', 'main_loop_consumed', { messagesLength: messages.length })
if (!messages.length) {
status.debug('🔁', 'main_loop_empty_batch', { cause: 'empty' })
Expand Down

0 comments on commit 0d6218f

Please sign in to comment.