rdhabalia commented on a change in pull request #2128: Schedule task to update function stats separately URL: https://github.com/apache/incubator-pulsar/pull/2128#discussion_r201804691
########## File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/ContextImpl.java ########## @@ -324,11 +326,23 @@ public ByteBuffer getState(String key) { @Override public void recordMetric(String metricName, double value) { - accumulatedMetrics.putIfAbsent(metricName, new AccumulatedMetricDatum()); - accumulatedMetrics.get(metricName).update(value); + currentAccumulatedMetrics.putIfAbsent(metricName, new AccumulatedMetricDatum()); + currentAccumulatedMetrics.get(metricName).update(value); } public MetricsData getAndResetMetrics() { + MetricsData retval = getMetrics(); Review comment: now, with this change, reset-api will capture a sample so, getAndRestMetrics will get the current sample and resets it separately. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services