kfaraz commented on code in PR #18598:
URL: https://github.com/apache/druid/pull/18598#discussion_r2422760927


##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitterConfig.java:
##########
@@ -97,10 +97,31 @@ public PrometheusEmitterConfig(
     Preconditions.checkArgument(PATTERN.matcher(this.namespace).matches(), 
"Invalid namespace " + this.namespace);
     if (strategy == Strategy.exporter) {
       Preconditions.checkArgument(port != null, "For `exporter` strategy, port 
must be specified.");
+      if (Objects.nonNull(flushPeriod)) {
+        if (flushPeriod <= 0) {
+          throw DruidException.forPersona(DruidException.Persona.OPERATOR)
+                              
.ofCategory(DruidException.Category.INVALID_INPUT)
+                              .build(
+                                  StringUtils.format(
+                                      "Invalid value for flushPeriod[%s] 
specified, flushPeriod must be > 0.",
+                                      flushPeriod
+                                  )
+                              );
+        }
+      }

Review Comment:
   Nit: seems like this part can be commoned out.



##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitter.java:
##########
@@ -74,7 +74,8 @@ public PrometheusEmitter(PrometheusEmitterConfig config)
         config.getDimensionMapPath(),
         config.isAddHostAsLabel(),
         config.isAddServiceAsLabel(),
-        config.getExtraLabels()
+        config.getExtraLabels(),
+        config.getFlushPeriod()

Review Comment:
   Nit: we could pass the entire `config` object to the constructor rather than 
these 6 args.



##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/DimensionsAndCollector.java:
##########
@@ -20,20 +20,26 @@
 package org.apache.druid.emitter.prometheus;
 
 import io.prometheus.client.SimpleCollector;
+import org.apache.druid.java.util.common.Stopwatch;
+import org.joda.time.Duration;
 
 public class DimensionsAndCollector
 {
   private final String[] dimensions;
   private final SimpleCollector collector;
   private final double conversionFactor;
   private final double[] histogramBuckets;
+  private final Stopwatch updateTimer;
+  private final Integer ttlSeconds;

Review Comment:
   Nit: This can be a `Duration` to avoid repeated created of a `Duration` 
object in `isExpired`.



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