nsivabalan commented on code in PR #18148:
URL: https://github.com/apache/hudi/pull/18148#discussion_r2824932495
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/metrics/TestHoodieMetrics.java:
##########
@@ -318,4 +321,24 @@ public MockHoodieActiveTimeline(HoodieInstant... instants)
{
this.setInstants(Arrays.asList(instants));
}
}
+
+ @Test
+ public void testRollbackFailureMetric() {
+ // Test that rollback failure metric is emitted correctly
+ String exceptionType = "FileNotFoundException";
+ hoodieMetrics.emitRollbackFailure(exceptionType);
+
+ // Verify the failure counter is incremented
+ String metricName = hoodieMetrics.getMetricsName("rollback",
FAILURE_COUNTER);
+ assertEquals(1,
metrics.getRegistry().getCounters().get(metricName).getCount());
+
+ // Verify a specific counter is incremented for this exception type
+ String exceptionMetricName = hoodieMetrics.getMetricsName("rollback",
exceptionType + COUNTER_METRIC_EXTENSION);
+ assertEquals(1,
metrics.getRegistry().getCounters().get(exceptionMetricName).getCount());
+
+ // Emit another failure and verify counter increments
+ hoodieMetrics.emitRollbackFailure(exceptionType);
+ assertEquals(2,
metrics.getRegistry().getCounters().get(metricName).getCount());
+ assertEquals(2,
metrics.getRegistry().getCounters().get(exceptionMetricName).getCount());
+ }
Review Comment:
we should also emit a diff exception type and add validation
--
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]