esecules commented on code in PR #9965:
URL: https://github.com/apache/nifi/pull/9965#discussion_r2107661108


##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/PrometheusMetricsUtil.java:
##########
@@ -84,7 +85,8 @@ public static CollectorRegistry 
createNifiMetrics(NiFiMetricsRegistry nifiMetric
         addProcessingPerformanceMetrics(nifiMetricsRegistry, 
status.getProcessingPerformanceStatus(),
                 instanceId, componentType, componentName, componentId, 
parentPGId);
 
-        nifiMetricsRegistry.setDataPoint(status.getProcessingNanos(), 
"TOTAL_TASK_DURATION",
+        // prometheus metric expects milliseconds
+        nifiMetricsRegistry.setDataPoint(status.getProcessingNanos() / 
NANOS_PER_MILLI, "TOTAL_TASK_DURATION",

Review Comment:
   I decided to use double division rather than the TimeUnit conversions 
because prometheus ultimately uses a double to represent the metric value and 
we can tolerate floating point errors.



-- 
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]

Reply via email to