BartMiki commented on code in PR #14935:
URL: https://github.com/apache/druid/pull/14935#discussion_r1319577375


##########
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:
   @abhishekrb19 Thank you for the research on this topic! 
   
   The TTL is discouraged by implementing it as part of Pushgateway, however, 
the solution they present in the Google Groups thread is the solution I 
described above, mainly 
([link](https://groups.google.com/g/prometheus-developers/c/9IyUxRvhY7w/m/edX2nq3_BQAJ)):
   > Solution: Do _not_ implement a TTL. Instead, make metrics
   deletion (with a simple DELETE call of the RESTful API) a part of
   decommissioning a job.
   
   My approach is basically that. After the Druid task closes, do not remove 
the metrics from PushGateway immediately, but schedule a task on Druid to call 
the removal of these metrics after some time elapses (TTL but it is on the 
Druid side). That would be part of decommissioning a job as per their 
recommendation.
   
   Also, could you elaborate on what is considered an anti-pattern here? You 
write here:
   > Digging up some more, it seems like the pushgateway community considers 
this usecase an 
[anti-pattern](https://github.com/prometheus/pushgateway/tree/master#non-goals).
   
   I'm not sure about the use case you are referring to. To my understanding, 
the Pushgateway on Druid should be only used for Peons, which aligns with the 
PushGateway 
[goals](https://github.com/prometheus/pushgateway/tree/master#prometheus-pushgateway):
   > The Prometheus Pushgateway exists to allow ephemeral and batch jobs to 
expose their metrics to Prometheus. Since these kinds of jobs may not exist 
long enough to be scraped, they can instead push their metrics to a 
Pushgateway. The Pushgateway then exposes these metrics to Prometheus.



-- 
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]

Reply via email to