InseeFrLab / InseeFrLab/onyxia-api
Improve logs, handling and parsing of Helm install erros
- Lingua principale
- Java
- Stelle
- 34
- Fork
- 34
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Currently, if the `helm install` fails for some reason (e.g syntax errors on generated manifests) then Onyxia-API logs a "generic" error with the Java stacktrace that contains almost no real info :
`[onyxia-api-8b8497478-wdm5l] {"@timestamp":"2024-12-12T13:41:13.583714227Z","@version":"1","message":"Servlet.service() for servlet [dispatcherServlet] in context with path [\/api] threw exception","logger_name":"org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[\/api].[dispatcherServlet]","thread_name":"http-nio-8080-exec-3","level":"ERROR","level_value":40000,"stack_trace":"com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1]\n\tat com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)\n\tat com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:5008)\n\tat ...
[TRIMMED FOR CLARITY]"}
`
and in a separate message the real helm error as emitted by the helm process :
`[onyxia-api-8b8497478-wdm5l] Error: YAML parse error on argo-workflows/templates/networkpolicy-ingress.yaml: error converting YAML to JSON: yaml: line 10: did not find expected '-' indicator`
This one is much more relevant and is currently redirected directly to System.err (see https://github.com/InseeFrLab/onyxia-api/blob/715cda25520e83a6e79308c0cefe837e1b1d8698/helm-wrapper/src/main/java/io/github/inseefrlab/helmwrapper/utils/Command.java#L27)
which is not properly integrated with the rest of logging system (e.g it does not use json structuring)
We should catch the real error instead of redirecting it to System.err
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia da helm-wrapper/src/main/java/io/github/inseefrlab/helmwrapper/utils/Command.java alla riga 27 e segui come viene gestito stderr di helm install e come gli errori raggiungono l’API logger. Il lavoro è concluso quando il vero errore di Helm viene catturato nel normale flusso di logging strutturato invece di essere reindirizzato direttamente a System.err, mentre l’output dell’eccezione generica non è più l’unica diagnosi utile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- helm, java
- Ambito
- api, backend, devops
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100