stevenzwu commented on code in PR #5348:
URL: https://github.com/apache/iceberg/pull/5348#discussion_r932576709
##########
api/src/test/java/org/apache/iceberg/metrics/TestDefaultMetricsContext.java:
##########
@@ -83,4 +85,44 @@ public void timer() {
timer.record(10, TimeUnit.MINUTES);
Assertions.assertThat(timer.totalDuration()).isEqualTo(Duration.ofMinutes(10L));
}
+
+ @Test
+ public void intGauge() {
+ MetricsContext metricsContext = new DefaultMetricsContext();
+ Gauge<Integer> gauge = metricsContext.gauge("test", Integer.class);
+ gauge.set(1);
+ Assertions.assertThat(gauge.get()).isEqualTo(1);
+ }
+
+ @Test
+ public void longGauge() {
+ MetricsContext metricsContext = new DefaultMetricsContext();
+ Gauge<Long> gauge = metricsContext.gauge("test", Long.class);
+ gauge.set(1L);
+ Assertions.assertThat(gauge.get()).isEqualTo(1L);
+ }
+
+ @Test
+ public void histogram() {
+ MetricsContext metricsContext = new DefaultMetricsContext();
+ int reservoirSize = 128;
+ Histogram histogram = metricsContext.histogram("test", reservoirSize);
+ for (int i = 0; i < reservoirSize; ++i) {
Review Comment:
actually switched to `[1, 100]` which will make the assertion number easier
to read.
--
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]