BartMiki commented on code in PR #14935:
URL: https://github.com/apache/druid/pull/14935#discussion_r1419299204
##########
extensions-contrib/prometheus-emitter/src/test/java/org/apache/druid/emitter/prometheus/PrometheusEmitterTest.java:
##########
@@ -333,7 +341,61 @@ public void testEmitterConfig()
true,
true,
60,
+ null,
+ false,
null
);
}
+
+ @Test
+ public void testEmitterWithDeleteOnShutdown() throws IOException
+ {
+ PrometheusEmitterConfig emitterConfig = new
PrometheusEmitterConfig(PrometheusEmitterConfig.Strategy.pushgateway,
"namespace3", null, 0, "pushgateway", true, true, 60, null, true, null);
+
+ PushGateway mockPushGateway = mock(PushGateway.class);
+ mockPushGateway.push(anyObject(CollectorRegistry.class), anyString(),
anyObject(ImmutableMap.class));
+ expectLastCall().atLeastOnce();
+ mockPushGateway.delete(anyString(), anyObject(ImmutableMap.class));
+ expectLastCall().atLeastOnce();
+
+ EasyMock.replay(mockPushGateway);
+
+ PrometheusEmitter emitter = new PrometheusEmitter(emitterConfig);
+ emitter.start();
+ emitter.setPushGateway(mockPushGateway);
+ ServiceMetricEvent build = ServiceMetricEvent.builder()
+ .setDimension("task",
"index_parallel")
+ .setMetric("task/run/time",
500)
+
.build(ImmutableMap.of("service", "peon", "host", "druid.test.cn"));
+ emitter.emit(build);
+ emitter.flush();
+ emitter.close();
+
+ EasyMock.verify(mockPushGateway);
+ }
+
+ @Test
+ public void testEmitterWithoutDeleteOnShutdown() throws IOException
+ {
+ PrometheusEmitterConfig emitterConfig = new
PrometheusEmitterConfig(PrometheusEmitterConfig.Strategy.pushgateway,
"namespace3", null, 0, "pushgateway", true, true, 60, null, false, null);
Review Comment:
Yes, I will add this
--
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]