Skip to content

Commit

Permalink
Logge antall oppgaver i kanal (#2777)
Browse files Browse the repository at this point in the history
* Logge antall oppgaver i kanal

* Logge antall oppgaver i kanal
  • Loading branch information
tendestad authored Dec 6, 2024
1 parent 565b5d3 commit fe17b1a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/main/kotlin/no/nav/k9/los/eventhandler/KøOppdatert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import io.opentelemetry.instrumentation.annotations.WithSpan
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.toList
import kotlinx.coroutines.launch
import no.nav.k9.kodeverk.Fagsystem
import no.nav.k9.los.domene.lager.oppgave.Oppgave
Expand Down Expand Up @@ -100,6 +101,7 @@ private suspend fun oppdaterKø(
for (uuid in behandlingerUuiderTilRefresh) {
refreshOppgaveChannel.send(uuid)
}
log.info("Antall oppgaver i refreshOppgaveChannel er nå ${refreshOppgaveChannel.toList().size}")
log.info("Ferdig")
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ class RefreshK9(
if (oppgaveId == null) {
try {
ChannelMetrikker.timeSuspended("refresh_k9sak") {
log.info("Behandler ${oppgaveListe.size} oppgaver")
oppfrisk(oppgaveListe)
oppgaveListe.clear()
}
} catch (e: Exception) {
log.error("Feilet ved refresh av oppgaver i k9-sak: " + oppgaveListe.joinToString(", "), e)
log.error("Feilet ved refresh av ${oppgaveListe.size} oppgaver i k9-sak", e)
for (uuid in oppgaveListe) {
log.warn("Feilet ved refresh av $uuid i k9-sak");
}
} catch (t : Throwable) {
log.error("Feilet hardt (Throwable) ved refresh av oppgaver (v1) mot k9-sak, avslutter tråden", t)
log.error("Feilet hardt (Throwable) ved refresh av ${oppgaveListe.size} oppgaver (v1) mot k9-sak, avslutter tråden", t)
throw t;
}
oppgaveListe.add(channel.receive())
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9v3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class RefreshK9v3(
if (hendelse == null) {
try {
val refreshUtført = ChannelMetrikker.timeSuspended("refresh_k9sak_v3") {
refreshK9v3Tjeneste.refreshK9(hendelser)
log.info("Behandler ${hendelser.size} oppgaver")
refreshK9v3Tjeneste.refreshK9(hendelser)
}
hendelser.clear()
if (refreshUtført == RefreshK9v3Tjeneste.RefreshUtført.ALLE_KØER){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.k9.los.jobber

import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.toList
import kotlinx.coroutines.runBlocking
import no.nav.k9.los.Configuration
import no.nav.k9.los.KoinProfile
Expand Down Expand Up @@ -118,6 +119,7 @@ class K9sakBehandlingsoppfriskingJobb(
for (uuid in behandlingerTilRefresh) {
refreshOppgaveChannel.send(uuid)
}
log.info("Antall oppgaver i refreshOppgaveChannel er nå ${refreshOppgaveChannel.toList().size}")
}
}

Expand Down

0 comments on commit fe17b1a

Please sign in to comment.