BartMiki commented on code in PR #14935:
URL: https://github.com/apache/druid/pull/14935#discussion_r1314723783
##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitter.java:
##########
@@ -207,6 +207,15 @@ public void close()
} else {
exec.shutdownNow();
flush();
+
+ if (pushGateway != null && config.isDeleteOnShutdown()) {
+ try {
+ pushGateway.delete(config.getNamespace(),
ImmutableMap.of(config.getNamespace(), identifier));
Review Comment:
Unfortunately, the push gateway delete removes everything for a given group
(in this case the task). So yes, the delete will remove pushed metrics in this
case. There is no method to select only metrics that are older than a given
amount of time (see
[docs](https://github.com/prometheus/pushgateway/blob/master/README.md#delete-method)).
However, as there is already a ScheduledExecutor in this class we can cancel
the push metrics task and schedule a new task to be executed in the future to
remove metrics with a TTL. This will prevent the close method from finishing
before the given TTL elapses and the metrics are removed.
Maybe there is some global event loop in Druid that we can inject to
schedule some cleanup tasks that are tied to external resources? If there is no
such event loop, then maybe that would be a good idea to add such an injectable
service to the Druid? What do you think: @abhishekrb19, @kfaraz ?
--
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]