Enable percentile histograms in metrics 20/76120/2
authorFilip Krzywka <filip.krzywka@nokia.com>
Tue, 22 Jan 2019 11:56:53 +0000 (12:56 +0100)
committerFilip Krzywka <filip.krzywka@nokia.com>
Tue, 22 Jan 2019 12:00:19 +0000 (13:00 +0100)
To allow more precise graphing.

Change-Id: I3c498b24c01e599eec316f552e25d06d653a08bb
Issue-ID: DCAEGEN2-1107
Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt

index b832bc9..fd1d9c5 100644 (file)
@@ -21,6 +21,7 @@ package org.onap.dcae.collectors.veshv.main.metrics
 
 import arrow.syntax.function.memoize
 import io.micrometer.core.instrument.Counter
+import io.micrometer.core.instrument.Timer
 import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics
 import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics
 import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics
@@ -53,8 +54,12 @@ class MicrometerMetrics internal constructor(
     private val totalConnections = registry.counter(name(CONNECTIONS))
     private val disconnections = registry.counter(name(DISCONNECTIONS))
 
-    private val processingTime = registry.timer(name(MESSAGES, PROCESSING, TIME))
-    private val totalLatency = registry.timer(name(MESSAGES, LATENCY))
+    private val processingTime = Timer.builder(name(MESSAGES, PROCESSING, TIME))
+            .publishPercentileHistogram(true)
+            .register(registry)
+    private val totalLatency = Timer.builder(name(MESSAGES, LATENCY))
+            .publishPercentileHistogram(true)
+            .register(registry)
 
     private val sentMessages = registry.counter(name(MESSAGES, SENT))
     private val sentMessagesByTopic = { topic: String ->