Add metric for total latency without routing
[dcaegen2/collectors/hv-ves.git] / sources / hv-collector-ct / src / test / kotlin / org / onap / dcae / collectors / veshv / tests / fakes / metrics.kt
index 1255596..4a5474c 100644 (file)
@@ -42,6 +42,7 @@ class FakeMetrics : Metrics {
     var lastProcessingTimeMicros: Double = -1.0; private set
     var lastProcessingTimeWithoutRoutingMicros: Double = -1.0; private set
     var lastToCollectorTravelTime: Double = -1.0; private set
+    var lastTotalLatencyWithoutRouting: Double = -1.0; private set
     var messagesSentCount: Int = 0; private set
     var clientRejectionCause = mutableMapOf<ClientRejectionCause, Int>(); private set
 
@@ -63,6 +64,7 @@ class FakeMetrics : Metrics {
 
     override fun notifyMessageReadyForRouting(msg: VesMessage) {
         lastProcessingTimeWithoutRoutingMicros = Duration.between(msg.wtpFrame.receivedAt, Instant.now()).toNanos() / 1000.0
+        lastTotalLatencyWithoutRouting = Duration.between(TimeUtils.epochMicroToInstant(msg.header.lastEpochMicrosec), Instant.now()).toNanos() / 1000.0
     }
 
     override fun notifyMessageSent(msg: RoutedMessage) {