Skip to content

Commit 1899264

Browse files
committed
Rename metrics
1 parent 960b69a commit 1899264

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

apps/opplysninger-aggregering/src/main/kotlin/no/nav/paw/arbeidssoekerregisteret/config/Metrics.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ import java.util.concurrent.atomic.AtomicLong
99

1010
fun MeterRegistry.tellMottatteOpplysninger() {
1111
counter(
12-
"paw_antall_mottatte_events_total",
12+
"paw_antall_mottatte_meldinger_total",
1313
Tags.of(
14-
Tag.of("event", "opplysninger-om-arbeidssoeker")
14+
Tag.of("meldingstype", "opplysninger-om-arbeidssoeker")
1515
)
1616
).increment()
1717
}
1818

1919
fun MeterRegistry.antallLagredeOpplysningerTotal(antallReference: AtomicLong) {
2020
gauge(
21-
"paw_antall_lagrede_events",
21+
"paw_antall_lagrede_meldinger",
2222
Tags.of(
23-
Tag.of("event", "opplysninger-om-arbeidssoeker")
23+
Tag.of("meldingstype", "opplysninger-om-arbeidssoeker")
2424
),
2525
antallReference
2626
) {
@@ -31,10 +31,10 @@ fun MeterRegistry.antallLagredeOpplysningerTotal(antallReference: AtomicLong) {
3131
fun MeterRegistry.antallLagredeOpplysningerSumPerPeriode(timestamp: Instant, antallReference: AtomicLong) {
3232
val zonedDateTime = timestamp.atZone(ZoneId.systemDefault())
3333
gauge(
34-
"paw_antall_lagrede_events_sum_per_tidsperiode",
34+
"paw_antall_lagrede_meldinger_sum_per_tidsperiode",
3535
Tags.of(
36-
Tag.of("event", "opplysninger-om-arbeidssoeker"),
37-
Tag.of("minute", "${zonedDateTime.minute}")
36+
Tag.of("meldingstype", "opplysninger-om-arbeidssoeker"),
37+
Tag.of("minutt", "${zonedDateTime.minute}")
3838
),
3939
antallReference
4040
) {

apps/opplysninger-aggregering/src/main/kotlin/no/nav/paw/arbeidssoekerregisteret/topology/OpplysningerTopology.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ private fun buildPunctuation(meterRegistry: MeterRegistry): Punctuation<Long, Op
126126
histogram.tellAntall(opplysninger.periodeId)
127127
}
128128

129-
histogram.forEach { (_, antall) -> meterRegistry.antallLagredeOpplysningerSumPerPeriode(timestamp, antall) }
130129
meterRegistry.antallLagredeOpplysningerTotal(antallTotalt)
130+
histogram.forEach { (_, antall) -> meterRegistry.antallLagredeOpplysningerSumPerPeriode(timestamp, antall) }
131131
}
132132
}
133133
}

apps/opplysninger-aggregering/src/test/kotlin/no/nav/paw/arbeidssoekerregisteret/topology/OpplysningerKStreamTest.kt

+8-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ class OpplysningerKStreamTest : FreeSpec({
5353
valueAndTimestamp.value().sendtInnAv.utfoertAv.id shouldBe opplysninger.sendtInnAv.utfoertAv.id
5454
}
5555

56-
"Skal slette opplysninger etter 60 minutter" {
57-
testDriver.advanceWallClockTime(Duration.ofMinutes(65)) // 60 min++
56+
"Skal ikke slette opplysninger etter 50 minutter" {
57+
testDriver.advanceWallClockTime(Duration.ofMinutes(50))
58+
59+
stateStore.size() shouldBe 1
60+
}
61+
62+
"Skal slette opplysninger etter 61 minutter" {
63+
testDriver.advanceWallClockTime(Duration.ofMinutes(11))
5864

5965
stateStore.size() shouldBe 0
6066
}

0 commit comments

Comments
 (0)