FrankChen021 commented on code in PR #20559:
URL: https://github.com/apache/druid/pull/20559#discussion_r4258525857
##########
extensions-contrib/kafka-emitter/src/main/java/org/apache/druid/emitter/kafka/KafkaEmitter.java:
##########
@@ -175,6 +184,19 @@ protected void logLostMessagesStatus()
currentSegmentMetadataLost -
previousSegmentMetadataLost.getAndSet(currentSegmentMetadataLost);
long deltaInvalidLost = currentInvalidLost -
previousInvalidLost.getAndSet(currentInvalidLost);
+ long currentMetricSampled = metricSampled.get();
+ long deltaMetricSampled = currentMetricSampled -
previousMetricSampled.getAndSet(currentMetricSampled);
+
+ if (deltaMetricSampled > 0) {
Review Comment:
[P2] Sampling summary retains a stale emitted counter
**Finding:** If a five-minute interval has emitted metrics but
deltaMetricSampled is zero, this branch is skipped and previousMetricEmitted is
not advanced. When a later interval samples anything, deltaMetricEmitted
includes emissions from all skipped intervals, so the logged total and emitted
values no longer describe the past five-minute window and can mislead operators
about sampling volume.
**Suggestion:** Advance previousMetricEmitted on every status check, while
keeping the sampling-summary log conditional on whether the current interval
sampled any events.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]