smjn commented on code in PR #18174:
URL: https://github.com/apache/kafka/pull/18174#discussion_r1887908162
##########
share-coordinator/src/main/java/org/apache/kafka/coordinator/share/metrics/ShareCoordinatorMetrics.java:
##########
@@ -153,4 +158,31 @@ public void record(String sensorName) {
globalSensors.get(sensorName).record();
}
}
+
+ public void recordPrune(double value, TopicPartition tp) {
+ pruneMetrics.computeIfAbsent(tp, k -> new ShareGroupPruneMetrics(tp))
+ .pruneSensor.record(value);
+ }
+
+ private class ShareGroupPruneMetrics {
+ private final Sensor pruneSensor;
+
+ ShareGroupPruneMetrics(TopicPartition tp) {
+ String sensorNameSuffix = tp.toString();
+ Map<String, String> tags = Map.of(
+ "topic", tp.topic(),
+ "partition", Integer.toString(tp.partition())
+ );
+
+ pruneSensor =
metrics.sensor(SHARE_COORDINATOR_STATE_TOPIC_PRUNE_SENSOR_NAME +
sensorNameSuffix);
+
+ pruneSensor.add(
+ metrics.metricName("last-pruned-offset",
Review Comment:
Like the case I mentioned our last pruned offset could be different we what
the low water mark is (if we send something smaller). Current `Partition.scala`
code simply swallows this condition with no specific indication.
Another point is that our `last-pruned-offset` is dual purposed. It is also
giving the indication that the pruner is working, which the other offsets do
not provide.
This metric provides pruners perspective, low water mark/LogStartOffset
provide replicamanager/partition/Unified log perspectives.
If however, this information is appears to be derivative, then we needn't
make any changes and this PR can be closed as LogStartOffset is being tracked.
--
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]