smallzhongfeng commented on code in PR #812:
URL: https://github.com/apache/incubator-uniffle/pull/812#discussion_r1165292219
##########
common/src/main/java/org/apache/uniffle/common/metrics/MetricsManager.java:
##########
@@ -17,27 +17,34 @@
package org.apache.uniffle.common.metrics;
+import java.util.Map;
+
+import com.google.common.collect.Maps;
import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.Counter;
import io.prometheus.client.Gauge;
import io.prometheus.client.Histogram;
import io.prometheus.client.Summary;
public class MetricsManager {
- private CollectorRegistry collectorRegistry;
+ private final CollectorRegistry collectorRegistry;
+ private final String[] defaultLabelNames;
+ private final String[] defaultLabelValues;
private static final double[] QUANTILES = {0.50, 0.75, 0.90, 0.95, 0.99};
private static final double QUANTILE_ERROR = 0.01;
public MetricsManager() {
- this(null);
+ this(null, Maps.newHashMap());
}
- public MetricsManager(CollectorRegistry collectorRegistry) {
+ public MetricsManager(CollectorRegistry collectorRegistry, Map<String,
String> defaultLabels) {
if (collectorRegistry == null) {
this.collectorRegistry = CollectorRegistry.defaultRegistry;
} else {
this.collectorRegistry = collectorRegistry;
}
+ this.defaultLabelNames = defaultLabels.keySet().toArray(new String[0]);
+ this.defaultLabelValues = defaultLabels.values().toArray(new String[0]);
Review Comment:

Do you mean like this ?
--
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]