-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fiksclient + digisosapiclient: resttemplate til webclient #339
Fiksclient + digisosapiclient: resttemplate til webclient #339
Conversation
proxiedWebClient | ||
.mutate() | ||
.baseUrl(clientProperties.fiksDigisosEndpointUrl) | ||
.codecs { it.defaultCodecs().maxInMemorySize(16 * 1024 * 1024) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by default er maxInMemorySize 256Kb - spring-projects/spring-framework#23961
Det førte til at vi ikke fikk hentet alle søknader for testbruker i dev.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…ngene gir svært lange loggmeldinger (for lange for Kibana)
.onStatus(HttpStatus::is4xxClientError) { | ||
it.createException().map { e -> | ||
log.warn("Fiks - oppdaterDigisosSak feilet - ${e.statusCode} ${e.statusText}", e) | ||
FiksClientException(e.rawStatusCode, e.message, e) | ||
} | ||
} | ||
.onStatus(HttpStatus::is5xxServerError) { | ||
it.createException().map { e -> | ||
log.warn("Fiks - oppdaterDigisosSak feilet - ${e.statusCode} ${e.statusText}", e) | ||
FiksServerException(e.rawStatusCode, e.message, e) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disse er jo rimelig like, kan de skrives i en?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jepp! Noe som dette hadde blitt mer konsist
.onErrorMap(WebClientResponseException::class.java) { e ->
log.warn("Fiks - hentDigisosSak feilet - ${messageUtenFnr(e)}", e)
if (e.statusCode.is4xxClientError) {
FiksClientException(e.rawStatusCode, e.message?.feilmeldingUtenFnr, e)
} else {
FiksServerException(e.rawStatusCode, e.message?.feilmeldingUtenFnr, e)
}
}
Tenkte å ta en runde med forenkling av feilhåndtering i webclients etter at alle restemplater er erstattet :)
val error = FrontendErrorMessage(FIKS_ERROR, NOE_UVENTET_FEILET) | ||
return ResponseEntity(error, HttpStatus.INTERNAL_SERVER_ERROR) | ||
} | ||
|
||
@ExceptionHandler(FiksClientException::class) | ||
fun handleFiksClientError(e: FiksClientException): ResponseEntity<FrontendErrorMessage> { | ||
log.error("Client-feil ved kall til Fiks", e) | ||
log.error("Client-feil ved kall til Fiks") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
den logges jo i fiksClient også.
log.warn("Fiks - hentDigisosSak feilet - ${messageUtenFnr(e)}", e)
Dessuten, stacktracen er så lang at loggmeldingene blir for lange for kibana 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kan heller fjerne error-loggingen i exceptionHandleren, og endre warn til error i client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Der ja, nice. Lurer litt. Disse gir mye mer info. Kan vi endre de til error og heller logge det på linje 60 her som warn.
Kanskje vi egentlig bare skal fjerne disse generelle fra linje 60 etc. 🤔
Det kan vi uansett gjøre i en annen PR.
Men hadde vært kjekt, nå som stacktracen forsvinner, at
log.warn("Fiks - hentDigisosSak feilet - ${messageUtenFnr(e)}", e)
blir logget som error (raskere å finne ut hva som er feil) :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eks på de lange stacktracene:
https://logs.adeo.no/goto/bfb489d2629c9a2771dd7d03b7c59180
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡
src/main/kotlin/no/nav/sosialhjelp/innsyn/client/idporten/IdPortenClientConfig.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dette ser veldig bra ut 🏆
Veldig mye mer leselig også 🧼✨
Tar i bruk mockwebserver for test.
Sørger for å bruk springs autoconfigurerte
webClientBuilder: WebClient.Builder
, da den har satt opp default-metrikker osv