From 2d1a6b2f67c011bbe0bb100109ec1657b60e16f4 Mon Sep 17 00:00:00 2001 From: Tore Langedal Endestad Date: Tue, 27 Aug 2024 14:48:54 +0200 Subject: [PATCH] =?UTF-8?q?Pr=C3=B8ver=20=C3=A5=20bevare=20spans=20i=20kor?= =?UTF-8?q?utiner=20(#2555)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9.kt | 8 +++++++- .../no/nav/k9/los/eventhandler/RefreshK9v3Tjeneste.kt | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9.kt b/src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9.kt index 475681f64..c4232a968 100644 --- a/src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9.kt +++ b/src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9.kt @@ -1,15 +1,19 @@ package no.nav.k9.los.eventhandler +import io.opentelemetry.api.trace.Span +import io.opentelemetry.extension.kotlin.asContextElement import io.opentelemetry.instrumentation.annotations.WithSpan import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import no.nav.k9.los.domene.lager.oppgave.v2.TransactionalManager import no.nav.k9.los.integrasjon.k9.IK9SakService import no.nav.k9.los.nyoppgavestyring.visningoguttrekk.OppgaveRepository import org.slf4j.LoggerFactory import java.util.* import java.util.concurrent.Executors +import kotlin.coroutines.coroutineContext class RefreshK9( val k9SakService: IK9SakService, @@ -67,6 +71,8 @@ class RefreshK9( } private suspend fun refreshK9(oppgaveListe: List) { - k9SakService.refreshBehandlinger(oppgaveListe) + withContext(coroutineContext + Span.current().asContextElement()) { + k9SakService.refreshBehandlinger(oppgaveListe) + } } } \ No newline at end of file diff --git a/src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9v3Tjeneste.kt b/src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9v3Tjeneste.kt index f2f4b3adf..22a6631a6 100644 --- a/src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9v3Tjeneste.kt +++ b/src/main/kotlin/no/nav/k9/los/eventhandler/RefreshK9v3Tjeneste.kt @@ -1,5 +1,7 @@ package no.nav.k9.los.eventhandler +import io.opentelemetry.api.trace.Span +import io.opentelemetry.extension.kotlin.asContextElement import io.opentelemetry.instrumentation.annotations.WithSpan import kotlinx.coroutines.runBlocking import kotliquery.TransactionalSession @@ -14,7 +16,6 @@ import no.nav.k9.los.nyoppgavestyring.mottak.oppgave.AktivOppgaveRepository import no.nav.k9.los.nyoppgavestyring.query.Avgrensning import no.nav.k9.los.nyoppgavestyring.query.OppgaveQueryService import no.nav.k9.los.nyoppgavestyring.query.QueryRequest -import no.nav.k9.los.utils.OpentelemetrySpanUtil import org.slf4j.LoggerFactory import java.util.* @@ -66,7 +67,7 @@ class RefreshK9v3Tjeneste( } DetaljerMetrikker.time("RefreshK9V3", "refreshForKøer", "k9SakService") { - runBlocking { + runBlocking (Span.current().asContextElement()) { k9SakService.refreshBehandlinger(behandlinger) } }