fix(deploy): wire SENTRY_DSN + JSON structured logs through prod deployment #641
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Two observability gaps prevent errors from surfacing in GlitchTip and Grafana:
1. GlitchTip receives no errors
SENTRY_DSNis never passed to the backend container.docker-compose.prod.ymlhas noSENTRY_DSNenv var, andnightly.ymldoes not write it into.env.staging. Theapplication.yamlhassentry.dsn: ${SENTRY_DSN:}which resolves to an empty string → Sentry SDK is a no-op.Sentry.captureException(ex)is called inGlobalExceptionHandlerbut silently does nothing.2. Grafana/Loki logs are unstructured
Spring Boot logs in default text format:
Problems:
detected_level: unknown— can't filter by severity| logfmtwhich silently fails on this formatFix
LOGGING_STRUCTURED_FORMAT_CONSOLE=ecsindocker-compose.prod.yml→ single JSON entry per exception including full stack trace,log.levelparsed by LokiSENTRY_DSN: ${SENTRY_DSN:-}to backend service env indocker-compose.prod.ymlSENTRY_DSN=${{ secrets.STAGING_SENTRY_DSN }}to the.env.stagingwriter innightly.yml| logfmt→| jsonDSNs
https://686ec2daa9bb45dc8e264e1e2727c8a4@glitchtip.archiv.raddatz.cloud/2https://758169b5be8e4d799d09aaca4215036d@glitchtip.archiv.raddatz.cloud/1(needs separate Gitea secretSTAGING_VITE_SENTRY_DSN+ build-arg wiring — defer to follow-up)Why now
A
500on the document page is currently occurring in staging (see investigation). The logging fix makes the error traceable in GlitchTip and Grafana so we can verify the 500 fix works after deploying it.