abhishekrb19 commented on code in PR #18598:
URL: https://github.com/apache/druid/pull/18598#discussion_r2404193631
##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitter.java:
##########
@@ -256,4 +278,21 @@ public void setPushGateway(PushGateway pushGateway)
{
this.pushGateway = pushGateway;
}
+
+ private void checkMetricTtl()
Review Comment:
On the naming, something like `expireStaleMetrics()` or
`clearExpiredMetrics()` it clearer. What do you think?
Could you please add a brief javadoc on how the expiration is done?
##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitter.java:
##########
@@ -93,6 +94,18 @@ public void start()
} else {
log.error("HTTPServer is already started");
}
+ // Start TTL scheduler if TTL is configured
+ if (config.getMetricTtlMs() != null) {
+ ttlExecutor = ScheduledExecutors.fixed(1, "PrometheusTTLExecutor-%s");
+ // Check TTL every minute
+ ttlExecutor.scheduleAtFixedRate(
+ this::checkMetricTtl,
+ config.getMetricTtlMs(),
+ config.getMetricTtlMs(),
+ TimeUnit.MILLISECONDS
Review Comment:
Does this need to be running every millisecond? Seems like running this at
`TimeUnit.SECONDS` or even at like 5s or so should suffice since the default
metric emission period is 1 minute.
--
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]