From a8cc2bdce5d036506577268d00658b813a74c970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geir=20Andr=C3=A9=20Lund?= Date: Wed, 20 Nov 2024 12:26:28 +0100 Subject: [PATCH] WIP - tilpasse ny R&R --- .../no/nav/dagpenger/behandling/JsonMapper.kt | 3 +- .../behandling/mediator/ApplicationBuilder.kt | 50 ++++++++++++- .../behandling/mediator/api/ApiConfig.kt | 70 +------------------ .../behandling/mediator/api/BehandlingApi.kt | 3 +- .../behandling/mediator/api/auth/Jwt.kt | 11 ++- .../mediator/mottak/ArenaOppgaveMottak.kt | 4 ++ .../mediator/mottak/AvbrytBehandlingMottak.kt | 5 ++ .../mottak/AvklaringIkkeRelevantMottak.kt | 4 ++ .../mottak/GodkjennBehandlingMottak.kt | 5 ++ .../mottak/InnsendingFerdigstiltMottak.kt | 14 ++-- .../OppgaveReturnertTilSaksbehandler.kt | 4 ++ .../mottak/OppgaveSendtTilKontroll.kt | 4 ++ .../mediator/mottak/OpplysningSvarMottak.kt | 4 ++ .../mottak/P\303\245minnelseMottak.kt" | 4 ++ .../mottak/S\303\270knadInnsendtMottak.kt" | 4 ++ 15 files changed, 108 insertions(+), 81 deletions(-) diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/JsonMapper.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/JsonMapper.kt index 3d9fe48f0..b49b5e2c9 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/JsonMapper.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/JsonMapper.kt @@ -1,11 +1,12 @@ package no.nav.dagpenger.behandling import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -val objectMapper = +val objectMapper: ObjectMapper = jacksonObjectMapper() .registerModule(JavaTimeModule()) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/ApplicationBuilder.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/ApplicationBuilder.kt index 78da3adf1..1fc2387cf 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/ApplicationBuilder.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/ApplicationBuilder.kt @@ -2,7 +2,13 @@ package no.nav.dagpenger.behandling.mediator import com.github.navikt.tbd_libs.rapids_and_rivers.KafkaRapid import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.ktor.http.HttpStatusCode +import io.ktor.server.application.ApplicationCall +import io.ktor.server.plugins.statuspages.StatusPagesConfig +import io.ktor.server.request.uri +import io.ktor.server.response.respond import mu.KotlinLogging +import no.nav.dagpenger.behandling.api.models.HttpProblemDTO import no.nav.dagpenger.behandling.db.PostgresDataSourceBuilder.clean import no.nav.dagpenger.behandling.db.PostgresDataSourceBuilder.runMigration import no.nav.dagpenger.behandling.konfigurasjon.Configuration.config @@ -19,9 +25,12 @@ import no.nav.dagpenger.behandling.mediator.repository.AvklaringRepositoryPostgr import no.nav.dagpenger.behandling.mediator.repository.BehandlingRepositoryPostgres import no.nav.dagpenger.behandling.mediator.repository.OpplysningerRepositoryPostgres import no.nav.dagpenger.behandling.mediator.repository.PersonRepositoryPostgres +import no.nav.dagpenger.behandling.objectMapper import no.nav.dagpenger.opplysning.Opplysningstype import no.nav.dagpenger.regel.RegelverkDagpenger import no.nav.helse.rapids_rivers.RapidApplication +import org.apache.kafka.common.errors.ResourceNotFoundException +import java.net.URI internal class ApplicationBuilder( config: Map, @@ -34,7 +43,9 @@ internal class ApplicationBuilder( private val opplysningstyper: Set> = RegelverkDagpenger.produserer private val rapidsConnection: RapidsConnection = - RapidApplication.create(config) { engine, rapidsConnection: KafkaRapid -> + RapidApplication.create(env = config, objectMapper = objectMapper, builder = { + withStatusPagesConfig(statusPages()) + }) { engine, rapidsConnection: KafkaRapid -> val aktivitetsloggMediator = AktivitetsloggMediator() // Logger bare oppgaver enn så lenge. Bør inn i HendelseMediator @@ -67,6 +78,43 @@ internal class ApplicationBuilder( ) } + private fun statusPages(): StatusPagesConfig.() -> Unit = + { + exception { call: ApplicationCall, cause: IllegalArgumentException -> + val problem = + HttpProblemDTO( + type = URI.create(call.request.uri), + title = "Ugyldig forespørsel", + status = HttpStatusCode.BadRequest.value, + detail = cause.message ?: "Ugyldig forespørsel", + ) + logger.error(cause) { "Noe gikk galt på ${call.request.uri}" } + call.respond(HttpStatusCode.BadRequest, problem) + } + exception { call: ApplicationCall, cause: ResourceNotFoundException -> + val problem = + HttpProblemDTO( + type = URI.create(call.request.uri), + title = "Fant ikke ressurs", + status = HttpStatusCode.NotFound.value, + detail = cause.message ?: "Fant ikke ressurs", + ) + logger.error(cause) { "Noe gikk galt på ${call.request.uri}" } + call.respond(HttpStatusCode.NotFound, problem) + } + exception { call: ApplicationCall, cause: Throwable -> + val problem = + HttpProblemDTO( + type = URI.create(call.request.uri), + title = "Noe gikk galt", + status = HttpStatusCode.InternalServerError.value, + detail = cause.message ?: "Noe gikk galt", + ) + logger.error(cause) { "Noe gikk galt på ${call.request.uri}" } + call.respond(HttpStatusCode.InternalServerError, problem) + } + } + init { rapidsConnection.register(this) } diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/ApiConfig.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/ApiConfig.kt index 86a4f58e5..8348a9ab0 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/ApiConfig.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/ApiConfig.kt @@ -1,86 +1,18 @@ package no.nav.dagpenger.behandling.mediator.api -import com.fasterxml.jackson.databind.DeserializationFeature -import com.fasterxml.jackson.databind.SerializationFeature -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import io.ktor.http.HttpStatusCode -import io.ktor.serialization.jackson.jackson import io.ktor.server.application.Application -import io.ktor.server.application.ApplicationCall import io.ktor.server.application.install import io.ktor.server.auth.Authentication import io.ktor.server.auth.AuthenticationConfig import io.ktor.server.auth.jwt.jwt -import io.ktor.server.plugins.callloging.CallLogging -import io.ktor.server.plugins.contentnegotiation.ContentNegotiation -import io.ktor.server.plugins.statuspages.StatusPages -import io.ktor.server.request.path -import io.ktor.server.request.uri -import io.ktor.server.response.respond -import mu.KotlinLogging -import no.nav.dagpenger.behandling.api.models.HttpProblemDTO import no.nav.dagpenger.behandling.mediator.api.auth.AuthFactory.azureAd -import org.apache.kafka.common.errors.ResourceNotFoundException -import org.slf4j.event.Level -import java.net.URI -private val logger = KotlinLogging.logger {} - -internal fun Application.konfigurerApi( +internal fun Application.authenticationConfig( auth: AuthenticationConfig.() -> Unit = { jwt("azureAd") { azureAd() } }, ) { - install(ContentNegotiation) { - jackson { - registerModule(JavaTimeModule()) - disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) - } - } - install(CallLogging) { - disableDefaultColors() - filter { - it.request.path() !in setOf("/metrics", "/isalive", "/isready") - } - level = Level.INFO - } install(Authentication) { auth() } - install(StatusPages) { - exception { call: ApplicationCall, cause: IllegalArgumentException -> - val problem = - HttpProblemDTO( - type = URI.create(call.request.uri), - title = "Ugyldig forespørsel", - status = HttpStatusCode.BadRequest.value, - detail = cause.message ?: "Ugyldig forespørsel", - ) - logger.error(cause) { "Noe gikk galt på ${call.request.uri}" } - call.respond(HttpStatusCode.BadRequest, problem) - } - exception { call: ApplicationCall, cause: ResourceNotFoundException -> - val problem = - HttpProblemDTO( - type = URI.create(call.request.uri), - title = "Fant ikke ressurs", - status = HttpStatusCode.NotFound.value, - detail = cause.message ?: "Fant ikke ressurs", - ) - logger.error(cause) { "Noe gikk galt på ${call.request.uri}" } - call.respond(HttpStatusCode.NotFound, problem) - } - exception { call: ApplicationCall, cause: Throwable -> - val problem = - HttpProblemDTO( - type = URI.create(call.request.uri), - title = "Noe gikk galt", - status = HttpStatusCode.InternalServerError.value, - detail = cause.message ?: "Noe gikk galt", - ) - logger.error(cause) { "Noe gikk galt på ${call.request.uri}" } - call.respond(HttpStatusCode.InternalServerError, problem) - } - } } diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/BehandlingApi.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/BehandlingApi.kt index 3a4b40e3c..fda77a556 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/BehandlingApi.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/BehandlingApi.kt @@ -4,7 +4,6 @@ import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext import io.ktor.http.HttpStatusCode import io.ktor.server.application.Application import io.ktor.server.application.ApplicationCall -import io.ktor.server.application.call import io.ktor.server.application.createApplicationPlugin import io.ktor.server.application.install import io.ktor.server.auth.authenticate @@ -61,7 +60,7 @@ internal fun Application.behandlingApi( opplysningstyper: Set>, messageContext: (ident: String) -> MessageContext, ) { - konfigurerApi() + authenticationConfig() install(OtelTraceIdPlugin) routing { diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/auth/Jwt.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/auth/Jwt.kt index acd2f20d9..99133ae68 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/auth/Jwt.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/api/auth/Jwt.kt @@ -2,7 +2,6 @@ package no.nav.dagpenger.behandling.mediator.api.auth import io.ktor.http.auth.HttpAuthHeader import io.ktor.server.application.ApplicationCall -import io.ktor.server.auth.Principal import io.ktor.server.auth.authentication import io.ktor.server.auth.jwt.JWTCredential import io.ktor.server.auth.jwt.JWTPayloadHolder @@ -11,7 +10,7 @@ import io.ktor.server.auth.parseAuthorizationHeader import io.ktor.server.request.ApplicationRequest import no.nav.dagpenger.behandling.mediator.api.auth.AuthFactory.issuerFromString -internal fun validator(jwtCredential: JWTCredential): Principal { +internal fun validator(jwtCredential: JWTCredential): JWTPayloadHolder { requirePid(jwtCredential) return JWTPrincipal(jwtCredential.payload) } @@ -40,4 +39,10 @@ internal fun ApplicationRequest.jwt(): String = internal fun ApplicationCall.optionalIdent(): String? = requireNotNull(this.authentication.principal()).payload.claims["pid"]?.asString() -internal fun ApplicationCall.issuer() = issuerFromString(this.authentication.principal()?.payload?.issuer) +internal fun ApplicationCall.issuer() = + issuerFromString( + this.authentication + .principal() + ?.payload + ?.issuer, + ) diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/ArenaOppgaveMottak.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/ArenaOppgaveMottak.kt index 4980654b6..65b54ffef 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/ArenaOppgaveMottak.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/ArenaOppgaveMottak.kt @@ -4,7 +4,9 @@ import com.fasterxml.jackson.databind.JsonNode import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.instrumentation.annotations.WithSpan import kotliquery.queryOf import kotliquery.sessionOf @@ -40,6 +42,8 @@ internal class ArenaOppgaveMottak( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val sakId = packet["after.SAK_ID"].toString() withLoggingContext("sakId" to sakId) { diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/AvbrytBehandlingMottak.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/AvbrytBehandlingMottak.kt index df7c9aec7..0c1a35c7e 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/AvbrytBehandlingMottak.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/AvbrytBehandlingMottak.kt @@ -3,8 +3,10 @@ package no.nav.dagpenger.behandling.mediator.mottak import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageProblems import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.api.trace.Span import io.opentelemetry.instrumentation.annotations.WithSpan import mu.KotlinLogging @@ -33,6 +35,8 @@ internal class AvbrytBehandlingMottak( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val behandlingId = packet["behandlingId"].asUUID() Span.current().apply { @@ -51,6 +55,7 @@ internal class AvbrytBehandlingMottak( override fun onError( problems: MessageProblems, context: MessageContext, + metadata: MessageMetadata, ) { logger.error { problems } } diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/AvklaringIkkeRelevantMottak.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/AvklaringIkkeRelevantMottak.kt index 989806c05..4a8059cff 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/AvklaringIkkeRelevantMottak.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/AvklaringIkkeRelevantMottak.kt @@ -3,7 +3,9 @@ package no.nav.dagpenger.behandling.mediator.mottak import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import mu.KotlinLogging import mu.withLoggingContext import no.nav.dagpenger.behandling.mediator.IMessageMediator @@ -33,6 +35,8 @@ internal class AvklaringIkkeRelevantMottak( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { withLoggingContext( "behovId" to packet["@behovId"].asText(), diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/GodkjennBehandlingMottak.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/GodkjennBehandlingMottak.kt index bff807f5e..494f5cb89 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/GodkjennBehandlingMottak.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/GodkjennBehandlingMottak.kt @@ -3,8 +3,10 @@ package no.nav.dagpenger.behandling.mediator.mottak import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageProblems import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.api.trace.Span import io.opentelemetry.instrumentation.annotations.WithSpan import mu.KotlinLogging @@ -33,6 +35,8 @@ internal class GodkjennBehandlingMottak( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val behandlingId = packet["behandlingId"].asUUID() Span.current().apply { @@ -51,6 +55,7 @@ internal class GodkjennBehandlingMottak( override fun onError( problems: MessageProblems, context: MessageContext, + metadata: MessageMetadata, ) { logger.error { problems } } diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/InnsendingFerdigstiltMottak.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/InnsendingFerdigstiltMottak.kt index 3dab2133f..519bf8af0 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/InnsendingFerdigstiltMottak.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/InnsendingFerdigstiltMottak.kt @@ -4,7 +4,9 @@ import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers.asLocalDateTime import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.instrumentation.annotations.WithSpan import mu.KotlinLogging import mu.withLoggingContext @@ -30,10 +32,17 @@ internal class InnsendingFerdigstiltMottak( }.register(this) } + private companion object { + private val logger = KotlinLogging.logger {} + private val sikkerlogg = KotlinLogging.logger("tjenestekall.SøknadInnsendtMottak") + } + @WithSpan override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val søknadId = packet["søknadsData"]["søknad_uuid"].asUUID().toString() withLoggingContext("søknadId" to søknadId) { @@ -42,11 +51,6 @@ internal class InnsendingFerdigstiltMottak( message.publish(context) } } - - private companion object { - private val logger = KotlinLogging.logger {} - private val sikkerlogg = KotlinLogging.logger("tjenestekall.SøknadInnsendtMottak") - } } class InnsendingFerdigstiltMessage( diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OppgaveReturnertTilSaksbehandler.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OppgaveReturnertTilSaksbehandler.kt index c2fbc466c..b3d5d6716 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OppgaveReturnertTilSaksbehandler.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OppgaveReturnertTilSaksbehandler.kt @@ -3,7 +3,9 @@ package no.nav.dagpenger.behandling.mediator.mottak import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.api.trace.Span import io.opentelemetry.instrumentation.annotations.WithSpan import mu.withLoggingContext @@ -31,6 +33,8 @@ internal class OppgaveReturnertTilSaksbehandler( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val behandlingId = packet["behandlingId"].asUUID() Span.current().apply { diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OppgaveSendtTilKontroll.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OppgaveSendtTilKontroll.kt index 4263c0f19..4e0acb367 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OppgaveSendtTilKontroll.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OppgaveSendtTilKontroll.kt @@ -3,7 +3,9 @@ package no.nav.dagpenger.behandling.mediator.mottak import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.api.trace.Span import io.opentelemetry.instrumentation.annotations.WithSpan import mu.withLoggingContext @@ -31,6 +33,8 @@ internal class OppgaveSendtTilKontroll( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val behandlingId = packet["behandlingId"].asUUID() Span.current().apply { diff --git a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OpplysningSvarMottak.kt b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OpplysningSvarMottak.kt index 37377c357..a7d4003d6 100644 --- a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OpplysningSvarMottak.kt +++ b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/OpplysningSvarMottak.kt @@ -6,7 +6,9 @@ import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers.asLocalDate import com.github.navikt.tbd_libs.rapids_and_rivers.asLocalDateTime import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.api.trace.Span import io.opentelemetry.instrumentation.annotations.WithSpan import mu.KotlinLogging @@ -70,6 +72,8 @@ internal class OpplysningSvarMottak( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val behovId = packet["@behovId"].asText() val behandlingId = packet["behandlingId"].asUUID() diff --git "a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/P\303\245minnelseMottak.kt" "b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/P\303\245minnelseMottak.kt" index ffbb4401b..80f5d07cc 100644 --- "a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/P\303\245minnelseMottak.kt" +++ "b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/P\303\245minnelseMottak.kt" @@ -3,7 +3,9 @@ package no.nav.dagpenger.behandling.mediator.mottak import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.api.trace.Span import io.opentelemetry.instrumentation.annotations.WithSpan import mu.KotlinLogging @@ -30,6 +32,8 @@ internal class PåminnelseMottak( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val behandlingId = packet["behandlingId"].asUUID() diff --git "a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/S\303\270knadInnsendtMottak.kt" "b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/S\303\270knadInnsendtMottak.kt" index f8ae4fc36..0b28fe24c 100644 --- "a/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/S\303\270knadInnsendtMottak.kt" +++ "b/mediator/src/main/kotlin/no/nav/dagpenger/behandling/mediator/mottak/S\303\270knadInnsendtMottak.kt" @@ -4,7 +4,9 @@ import com.github.navikt.tbd_libs.rapids_and_rivers.JsonMessage import com.github.navikt.tbd_libs.rapids_and_rivers.River import com.github.navikt.tbd_libs.rapids_and_rivers.asLocalDateTime import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageContext +import com.github.navikt.tbd_libs.rapids_and_rivers_api.MessageMetadata import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection +import io.micrometer.core.instrument.MeterRegistry import io.opentelemetry.api.trace.Span import io.opentelemetry.instrumentation.annotations.WithSpan import mu.KotlinLogging @@ -41,6 +43,8 @@ internal class SøknadInnsendtMottak( override fun onPacket( packet: JsonMessage, context: MessageContext, + metadata: MessageMetadata, + meterRegistry: MeterRegistry, ) { val søknadId = packet["søknadId"].asUUID().toString() Span.current().apply {