pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] srkukarni commented on a change in pull request #2930: Expose metrics via http port in function instance
Date Tue, 06 Nov 2018 17:24:05 GMT
srkukarni commented on a change in pull request #2930: Expose metrics via http port in function
instance
URL: https://github.com/apache/pulsar/pull/2930#discussion_r231216618
 
 

 ##########
 File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/ContextImpl.java
 ##########
 @@ -320,8 +338,16 @@ public ByteBuffer getState(String key) {
 
     @Override
     public void recordMetric(String metricName, double value) {
-        currentAccumulatedMetrics.putIfAbsent(metricName, new AccumulatedMetricDatum());
-        currentAccumulatedMetrics.get(metricName).update(value);
+        userMetricsLabels.computeIfAbsent(metricName,
+                s -> {
+                    String[] userMetricLabels = Arrays.copyOf(metricsLabels, metricsLabels.length
+ 1);
+                    userMetricLabels[userMetricLabels.length - 1] = metricName;
+                    return userMetricLabels;
+                });
+
+        userMetricsGauge.labels(userMetricsLabels.get(metricName)).set(value);
+        accumulatedMetrics.putIfAbsent(metricName, new AccumulatedMetricDatum());
 
 Review comment:
   isn't accumulatedMetrics and userMetricsGauge duplicates?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message