Skip to content

Commit

Permalink
feat: Add batch duration metric for ingestion consumer loop
Browse files Browse the repository at this point in the history
  • Loading branch information
tiina303 committed Nov 24, 2023
1 parent d980d13 commit 44bbd05
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugin-server/src/kafka/batch-consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export const startBatchConsumer = async ({
batchesProcessed += 1

const processingTimeMs = new Date().valueOf() - startProcessingTimeMs
consumedBatchDuration.labels({ topic, groupId }).observe(processingTimeMs)
if (processingTimeMs > SLOW_BATCH_PROCESSING_LOG_THRESHOLD_MS) {
status.warn(
'🕒',
Expand Down Expand Up @@ -293,6 +294,12 @@ export const startBatchConsumer = async ({
return { isHealthy, stop, join, consumer }
}

export const consumedBatchDuration = new Histogram({
name: 'consumed_batch_duration_ms',
help: 'Main loop consumer batch processing duration in ms',
labelNames: ['topic', 'groupId'],
})

export const consumerBatchSize = new Histogram({
name: 'consumed_batch_size',
help: 'Size of the batch fetched by the consumer',
Expand Down

0 comments on commit 44bbd05

Please sign in to comment.