abhishekrb19 commented on code in PR #18598:
URL: https://github.com/apache/druid/pull/18598#discussion_r2404184040
##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/DimensionsAndCollector.java:
##########
@@ -20,20 +20,23 @@
package org.apache.druid.emitter.prometheus;
import io.prometheus.client.SimpleCollector;
+import java.util.concurrent.atomic.AtomicLong;
public class DimensionsAndCollector
{
private final String[] dimensions;
private final SimpleCollector collector;
private final double conversionFactor;
private final double[] histogramBuckets;
+ private final AtomicLong lastUpdateTime;
Review Comment:
Resetting it to a previous value, would that show up as a separate
timeseries still?
##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitterConfig.java:
##########
@@ -86,10 +90,11 @@ public PrometheusEmitterConfig(
@JsonProperty("pushGatewayAddress") @Nullable String pushGatewayAddress,
@JsonProperty("addHostAsLabel") boolean addHostAsLabel,
@JsonProperty("addServiceAsLabel") boolean addServiceAsLabel,
- @JsonProperty("flushPeriod") Integer flushPeriod,
+ @JsonProperty("flushPeriod") @Nullable Integer flushPeriod,
@JsonProperty("extraLabels") @Nullable Map<String, String> extraLabels,
@JsonProperty("deletePushGatewayMetricsOnShutdown") @Nullable Boolean
deletePushGatewayMetricsOnShutdown,
- @JsonProperty("waitForShutdownDelay") @Nullable Long waitForShutdownDelay
+ @JsonProperty("waitForShutdownDelay") @Nullable Long
waitForShutdownDelay,
+ @JsonProperty("metricTtlMs") @Nullable Long metricTtlMs
Review Comment:
Could you update the prometheus emitter docs to add this property? Do you
have guidance on what a good value for `metricTtlMs` might be that will be good
for most users?
##########
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitterConfig.java:
##########
@@ -129,6 +134,18 @@ public PrometheusEmitterConfig(
);
}
+ if (metricTtlMs != null && metricTtlMs <= 0) {
+ throw DruidException.forPersona(DruidException.Persona.OPERATOR)
+ .ofCategory(DruidException.Category.INVALID_INPUT)
+ .build(
+ StringUtils.format(
+ "Invalid value for metricTtlMs[%s]
specified, metricTtlMs must be > 0.",
+ metricTtlMs
Review Comment:
nit: you could skip `StringUtils.format()` and pass the string placeholder
since `build()` takes variable args already
--
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]