kuszz commented on code in PR #1991:
URL:
https://github.com/apache/incubator-uniffle/pull/1991#discussion_r1710845628
##########
common/src/main/java/org/apache/uniffle/common/metrics/MetricsManager.java:
##########
@@ -47,6 +50,7 @@ public MetricsManager(CollectorRegistry collectorRegistry,
Map<String, String> d
this.defaultLabelNames = defaultLabels.keySet().toArray(new String[0]);
this.defaultLabelValues =
Arrays.stream(defaultLabelNames).map(defaultLabels::get).toArray(String[]::new);
+ this.gaugeMap = new ConcurrentHashMap<>();
Review Comment:
thanks, I have modified it
##########
common/src/main/java/org/apache/uniffle/common/metrics/MetricsManager.java:
##########
@@ -74,11 +78,37 @@ public Gauge addGauge(String name, String help, String[]
labels) {
return
Gauge.build().name(name).labelNames(labels).help(help).register(collectorRegistry);
}
+ public SupplierGauge addGauge(
Review Comment:
done
##########
common/src/main/java/org/apache/uniffle/common/metrics/MetricsManager.java:
##########
@@ -74,11 +78,37 @@ public Gauge addGauge(String name, String help, String[]
labels) {
return
Gauge.build().name(name).labelNames(labels).help(help).register(collectorRegistry);
}
+ public SupplierGauge addGauge(
+ String name,
+ String help,
+ Supplier<Double> supplier,
+ String[] labelNames,
+ String[] labelValues) {
+ return gaugeMap.computeIfAbsent(
+ name,
+ metricName ->
+ new SupplierGauge(name, help, supplier, labelNames, labelValues)
+ .register(collectorRegistry));
+ }
+
public Gauge.Child addLabeledGauge(String name) {
Gauge c = addGauge(name, this.defaultLabelNames);
return c.labels(this.defaultLabelValues);
}
+ public SupplierGauge addLabeledGauge(String name, Supplier<Double> supplier)
{
Review Comment:
done
--
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]