advancedxy commented on code in PR #812:
URL: https://github.com/apache/incubator-uniffle/pull/812#discussion_r1162651311
##########
common/src/main/java/org/apache/uniffle/common/metrics/GRPCMetrics.java:
##########
@@ -39,13 +39,18 @@ public abstract class GRPCMetrics {
private static final String GRPC_TOTAL = "grpc_total";
private boolean isRegistered = false;
- protected Map<String, Counter> counterMap = JavaUtils.newConcurrentMap();
- protected Map<String, Gauge> gaugeMap = JavaUtils.newConcurrentMap();
- protected Map<String, Summary> transportTimeSummaryMap =
JavaUtils.newConcurrentMap();
- protected Map<String, Summary> processTimeSummaryMap =
JavaUtils.newConcurrentMap();
- private Gauge gaugeGrpcOpen;
- private Counter counterGrpcTotal;
+ protected Map<String, Counter.Child> counterMap =
JavaUtils.newConcurrentMap();
+ protected Map<String, Gauge.Child> gaugeMap = JavaUtils.newConcurrentMap();
+ protected Map<String, Summary.Child> transportTimeSummaryMap =
JavaUtils.newConcurrentMap();
+ protected Map<String, Summary.Child> processTimeSummaryMap =
JavaUtils.newConcurrentMap();
+ protected Gauge.Child gaugeGrpcOpen;
Review Comment:
To be fair, You should use `Gauge` instead.
##########
common/src/main/java/org/apache/uniffle/common/metrics/GRPCMetrics.java:
##########
@@ -59,25 +64,22 @@ public void register(CollectorRegistry collectorRegistry) {
}
private void registerGeneralMetrics() {
- gaugeGrpcOpen = metricsManager.addGauge(GRPC_OPEN);
- counterGrpcTotal = metricsManager.addCounter(GRPC_TOTAL);
- gaugeMap.putIfAbsent(
- GRPC_SERVER_EXECUTOR_ACTIVE_THREADS_KEY,
- metricsManager.addGauge(GRPC_SERVER_EXECUTOR_ACTIVE_THREADS)
+ gaugeGrpcOpen = metricsManager.addGauge(GRPC_OPEN,
Constants.SHUFFLE_SERVER_TAGS).labels(tags);
Review Comment:
I believe it's better to pass tags to `MetricsManager` and add default tags
if necessary.
##########
server/src/main/java/org/apache/uniffle/server/ShuffleServer.java:
##########
@@ -473,4 +474,18 @@ public boolean isRunning() {
public int getNettyPort() {
return nettyPort;
}
+
+ public String coverToString() {
+ List<String> tags = shuffleServerConf.get(ShuffleServerConf.TAGS);
+ StringBuilder sb = new StringBuilder();
+ sb.append(Constants.SHUFFLE_SERVER_VERSION);
+ if (tags == null || tags.size() == 0) {
+ return sb.toString();
+ }
+ for (String tag : tags) {
+ sb.append("_");
Review Comment:
I'm not sure, isn't `,` a better choice?
##########
common/src/main/java/org/apache/uniffle/common/metrics/GRPCMetrics.java:
##########
@@ -127,7 +129,7 @@ public void incCounter(String methodName) {
public void decCounter(String methodName) {
if (isRegistered) {
- Gauge gauge = gaugeMap.get(methodName);
+ Gauge.Child gauge = gaugeMap.get(methodName);
Review Comment:
It's better to get the gauge first, then append label values to this gauge
via MetricsManager.
##########
server/src/main/java/org/apache/uniffle/server/ShuffleServer.java:
##########
@@ -473,4 +474,18 @@ public boolean isRunning() {
public int getNettyPort() {
return nettyPort;
}
+
+ public String coverToString() {
+ List<String> tags = shuffleServerConf.get(ShuffleServerConf.TAGS);
Review Comment:
Apart from tags, do you think is it necessary to add custom metrics labels,
such as `ShuffleServerConf.MetricsLabels=k=v,a=b`
--
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]