diff options
author | kjaniak <kornel.janiak@nokia.com> | 2020-04-21 12:44:53 +0200 |
---|---|---|
committer | Kornel Janiak <kornel.janiak@nokia.com> | 2020-04-22 11:19:54 +0000 |
commit | da498bfc1f006a17f1d8174b10bc33acbd4b2fa0 (patch) | |
tree | 3711f4b175ce046feceaab482a9d786a2f152a55 /sources/hv-collector-ct/src | |
parent | c61dcc75290d24ec0f0188b32e0ab0a7f15ea420 (diff) |
Add of message travel time metric
Message travel time: Producer -> HV-VES input introduced.
Tests for new metric added.
Change-Id: I36347ff53abb3f274e4358af26db49fe8bac95ed
Issue-ID: DCAEGEN2-1576
Signed-off-by: kjaniak <kornel.janiak@nokia.com>
Diffstat (limited to 'sources/hv-collector-ct/src')
-rw-r--r-- | sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt b/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt index 3b01d137..12555965 100644 --- a/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt +++ b/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * dcaegen2-collectors-veshv * ================================================================================ - * Copyright (C) 2018-2019 NOKIA + * Copyright (C) 2018-2020 NOKIA * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.onap.dcae.collectors.veshv.model.ClientRejectionCause import org.onap.dcae.collectors.veshv.model.MessageDropCause import org.onap.dcae.collectors.veshv.domain.RoutedMessage import org.onap.dcae.collectors.veshv.domain.VesMessage +import org.onap.dcae.collectors.veshv.utils.TimeUtils import java.time.Duration import java.time.Instant import kotlin.test.fail @@ -40,6 +41,7 @@ class FakeMetrics : Metrics { var messagesDroppedCount: Int = 0; private set var lastProcessingTimeMicros: Double = -1.0; private set var lastProcessingTimeWithoutRoutingMicros: Double = -1.0; private set + var lastToCollectorTravelTime: Double = -1.0; private set var messagesSentCount: Int = 0; private set var clientRejectionCause = mutableMapOf<ClientRejectionCause, Int>(); private set @@ -54,6 +56,11 @@ class FakeMetrics : Metrics { messageBytesReceived += msg.payloadSize } + override fun notifyMessageReceived(msg: VesMessage) { + lastToCollectorTravelTime = Duration.between(TimeUtils.epochMicroToInstant(msg.header.lastEpochMicrosec), + Instant.now()).toNanos() / 1000.0 + } + override fun notifyMessageReadyForRouting(msg: VesMessage) { lastProcessingTimeWithoutRoutingMicros = Duration.between(msg.wtpFrame.receivedAt, Instant.now()).toNanos() / 1000.0 } |