Skip to content

Commit

Permalink
Endret verdier fra prometheus-gauges for å prøve å bruke thresholds i…
Browse files Browse the repository at this point in the history
… grafana
  • Loading branch information
Jan Kroken committed Oct 8, 2023
1 parent 5bd47f3 commit f9e7bf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class MicrometerStatusMalere(private val registry: MeterRegistry) {
}

fun antallOk() : Int {
return if (status == ApplicationStatus.OK) 1 else 0
return if (status == ApplicationStatus.OK) 9 else 0
}

fun antallFeil() : Int {
return if (status is ApplicationStatus.Feil) 1 else 0
return if (status is ApplicationStatus.Feil) 10 else 0
}

fun antallMangler() : Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MicrometerStatusMalereTest {
fun testOK() {
val målere = MicrometerStatusMalere(registry)
målere.oppdater(ApplicationStatus.OK)
assertThat(målere.antallOk()).isOne()
assertThat(målere.antallOk()).isEqualTo(9)
assertThat(målere.antallFeil()).isZero()
assertThat(målere.antallMangler()).isZero()
assertThat(målere.feilmelding()).isEmpty()
Expand All @@ -40,7 +40,7 @@ class MicrometerStatusMalereTest {
val målere = MicrometerStatusMalere(registry)
målere.oppdater(ApplicationStatus.Feil("Dette er en feil"))
assertThat(målere.antallOk()).isZero()
assertThat(målere.antallFeil()).isOne()
assertThat(målere.antallFeil()).isEqualTo(10)
assertThat(målere.antallMangler()).isZero()
assertThat(målere.feilmelding()).isEqualTo("Dette er en feil")
}
Expand All @@ -65,13 +65,13 @@ class MicrometerStatusMalereTest {
}

@Test
fun testMikrometerIkkeMerEnnEn() {
fun testMikrometerØkerIkke() {
val målere = MicrometerStatusMalere(registry)
målere.oppdater(ApplicationStatus.OK)
målere.oppdater(ApplicationStatus.OK)
målere.oppdater(ApplicationStatus.OK)
val okCount = registry.get("pensjonopptjening_applikasjonsstatus_ok").gauge().value().toInt()
assertThat(okCount).isOne()
assertThat(okCount).isEqualTo(9)
}

@Test
Expand Down

0 comments on commit f9e7bf8

Please sign in to comment.