Skip to content

Commit 960b69a

Browse files
committed
Endret metrics navn og consumer group
1 parent ceacd94 commit 960b69a

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed
+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# PAW Arbeidssoeker Opplysninger Aggregering
22

3+
## Testbruker
4+
28908398892 FORNØYD BLEKK Tyskland

apps/opplysninger-aggregering/nais/nais-dev.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
port: 8080
1111
env:
1212
- name: KAFKA_OPPLYSNINGER_OM_ARBEIDSSOEKER_STREAM_ID_SUFFIX
13-
value: "opplysninger-stream-v1"
13+
value: "opplysninger-stream-v2"
1414
- name: KAFKA_PAW_OPPLYSNINGER_OM_ARBEIDSSOEKER_TOPIC
1515
value: "paw.opplysninger-om-arbeidssoeker-v1"
1616
- name: OPPLYSNINGER_PUNCTUATOR_SCHEDULE

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ import java.time.Instant
77
import java.time.ZoneId
88
import java.util.concurrent.atomic.AtomicLong
99

10-
private const val METRIC_PREFIX = "paw_arbeidssoeker_opplysninger_aggregering"
11-
1210
fun MeterRegistry.tellMottatteOpplysninger() {
1311
counter(
14-
"${METRIC_PREFIX}_antall_mottatte_opplysninger_total",
12+
"paw_antall_mottatte_events_total",
13+
Tags.of(
14+
Tag.of("event", "opplysninger-om-arbeidssoeker")
15+
)
1516
).increment()
1617
}
1718

1819
fun MeterRegistry.antallLagredeOpplysningerTotal(antallReference: AtomicLong) {
1920
gauge(
20-
"${METRIC_PREFIX}_antall_lagrede_opplysninger_total",
21-
Tags.empty(),
21+
"paw_antall_lagrede_events",
22+
Tags.of(
23+
Tag.of("event", "opplysninger-om-arbeidssoeker")
24+
),
2225
antallReference
2326
) {
2427
antallReference.get().toDouble()
@@ -28,8 +31,9 @@ fun MeterRegistry.antallLagredeOpplysningerTotal(antallReference: AtomicLong) {
2831
fun MeterRegistry.antallLagredeOpplysningerSumPerPeriode(timestamp: Instant, antallReference: AtomicLong) {
2932
val zonedDateTime = timestamp.atZone(ZoneId.systemDefault())
3033
gauge(
31-
"${METRIC_PREFIX}_antall_lagrede_opplysninger_sum_per_periode",
34+
"paw_antall_lagrede_events_sum_per_tidsperiode",
3235
Tags.of(
36+
Tag.of("event", "opplysninger-om-arbeidssoeker"),
3337
Tag.of("minute", "${zonedDateTime.minute}")
3438
),
3539
antallReference

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

+12-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fun buildOpplysningerTopology(
3030

3131
context(ApplicationContext)
3232
private fun StreamsBuilder.addOpplysningerStateStore() {
33-
logger.info("Oppretter state store for opplysninger om arbeidssøker")
33+
logger.info("Oppretter State Store for opplysninger om arbeidssøker")
3434
val kafkaProperties = properties.kafka
3535
val kafkaStreamsProperties = properties.kafkaStreams
3636

@@ -123,17 +123,21 @@ private fun buildPunctuation(meterRegistry: MeterRegistry): Punctuation<Long, Op
123123
)
124124
}
125125

126-
val antall = histogram[opplysninger.periodeId]
127-
if (antall != null) {
128-
antall.incrementAndGet()
129-
histogram[opplysninger.periodeId] = antall
130-
} else {
131-
histogram[opplysninger.periodeId] = AtomicLong(1)
132-
}
126+
histogram.tellAntall(opplysninger.periodeId)
133127
}
134128

135129
histogram.forEach { (_, antall) -> meterRegistry.antallLagredeOpplysningerSumPerPeriode(timestamp, antall) }
136130
meterRegistry.antallLagredeOpplysningerTotal(antallTotalt)
137131
}
138132
}
139133
}
134+
135+
private fun MutableMap<UUID, AtomicLong>.tellAntall(key: UUID) {
136+
val antall = get(key)
137+
if (antall != null) {
138+
antall.incrementAndGet()
139+
put(key, antall)
140+
} else {
141+
put(key, AtomicLong(1))
142+
}
143+
}

0 commit comments

Comments
 (0)