aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-main/src/main
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-12-14 15:20:56 +0100
committerJakub Dudycz <jakub.dudycz@nokia.com>2018-12-17 13:18:13 +0100
commit8952e9970470b683773bfe3a8f40a10881a3f321 (patch)
treefe31f2eeca7fafcb62ea48dbccc08ad02ec9a5a9 /sources/hv-collector-main/src/main
parente32d91541ffa6c3ec13729032979af8160bdb8dc (diff)
Add metrics for dropped messages
Add counters for messages dropped due to validation or undefined routing Slight refactoring Change-Id: Ibe4e38445e81babc745d7a7d95356910845293ce Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com> Issue-ID: DCAEGEN2-1037
Diffstat (limited to 'sources/hv-collector-main/src/main')
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt26
1 files changed, 21 insertions, 5 deletions
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt
index cf903591..18678ff3 100644
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt
+++ b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt
@@ -29,6 +29,7 @@ import io.micrometer.core.instrument.binder.system.ProcessorMetrics
import io.micrometer.prometheus.PrometheusConfig
import io.micrometer.prometheus.PrometheusMeterRegistry
import org.onap.dcae.collectors.veshv.boundary.Metrics
+import org.onap.dcae.collectors.veshv.model.MessageDropCause
/**
@@ -42,7 +43,16 @@ class MicrometerMetrics internal constructor(
private val receivedBytes = registry.counter(name(DATA, RECEIVED, BYTES))
private val receivedMsgCount = registry.counter(name(MESSAGES, RECEIVED, COUNT))
private val receivedMsgBytes = registry.counter(name(MESSAGES, RECEIVED, BYTES))
- private val sentCountTotal = registry.counter(name(MESSAGES, SENT, COUNT))
+ private val sentCountTotal = registry.counter(name(MESSAGES, SENT, COUNT, TOTAL))
+ private val droppedCountTotal = registry.counter(name(MESSAGES, DROPPED, COUNT, TOTAL))
+
+ private val sentCount = { topic: String ->
+ registry.counter(name(MESSAGES, SENT, COUNT, TOPIC), TOPIC, topic)
+ }.memoize<String, Counter>()
+
+ private val droppedCount = { cause: String ->
+ registry.counter(name(MESSAGES, DROPPED, COUNT, CAUSE), CAUSE, cause)
+ }.memoize<String, Counter>()
init {
registry.gauge(name(MESSAGES, PROCESSING, COUNT), this) {
@@ -55,10 +65,6 @@ class MicrometerMetrics internal constructor(
JvmThreadMetrics().bindTo(registry)
}
- private val sentCount = { topic: String ->
- registry.counter("hvves.messages.sent.topic.count", "topic", topic)
- }.memoize<String, Counter>()
-
val metricsProvider = MicrometerPrometheusMetricsProvider(registry)
override fun notifyBytesReceived(size: Int) {
@@ -75,6 +81,11 @@ class MicrometerMetrics internal constructor(
sentCount(topic).increment()
}
+ override fun notifyMessageDropped(cause: MessageDropCause) {
+ droppedCountTotal.increment()
+ droppedCount(cause.tag).increment()
+ }
+
companion object {
val INSTANCE = MicrometerMetrics()
internal const val PREFIX = "hvves"
@@ -85,6 +96,11 @@ class MicrometerMetrics internal constructor(
internal const val DATA = "data"
internal const val SENT = "sent"
internal const val PROCESSING = "processing"
+ internal const val TOPIC = "topic"
+ internal const val DROPPED = "dropped"
+ internal const val CAUSE = "cause"
+ internal const val TOTAL = "total"
+
fun name(vararg name: String) = "$PREFIX.${name.joinToString(".")}"
}
}