From 5ee59ae9f7d603539f9b21181f69d3146e673c0b Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 15 May 2026 08:15:40 +0200 Subject: [PATCH] fix(backend): make sentry traces-sample-rate env-configurable Co-Authored-By: Claude Sonnet 4.6 --- .env.example | 1 + backend/src/main/resources/application.yaml | 2 +- docker-compose.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index b698b29f..97d677e9 100644 --- a/.env.example +++ b/.env.example @@ -50,6 +50,7 @@ GLITCHTIP_SECRET_KEY=changeme-generate-a-real-secret # Error reporting DSNs — leave empty to disable the SDK (safe default). # SENTRY_DSN: backend (Spring Boot) — used by the GlitchTip/Sentry Java SDK SENTRY_DSN= +SENTRY_TRACES_SAMPLE_RATE= # VITE_SENTRY_DSN: frontend (SvelteKit) — injected at build time via Vite VITE_SENTRY_DSN= # Sentry/GlitchTip auth token for source map upload at build time (optional) diff --git a/backend/src/main/resources/application.yaml b/backend/src/main/resources/application.yaml index 76a6d753..ead3d9e8 100644 --- a/backend/src/main/resources/application.yaml +++ b/backend/src/main/resources/application.yaml @@ -122,7 +122,7 @@ ocr: sentry: dsn: ${SENTRY_DSN:} environment: ${SPRING_PROFILES_ACTIVE:dev} - traces-sample-rate: 1.0 + traces-sample-rate: ${SENTRY_TRACES_SAMPLE_RATE:1.0} send-default-pii: false enable-tracing: true ignored-exceptions-for-type: diff --git a/docker-compose.yml b/docker-compose.yml index 4923e789..2a3b7407 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -148,6 +148,7 @@ services: APP_OCR_BASE_URL: http://ocr-service:8000 APP_OCR_TRAINING_TOKEN: "${OCR_TRAINING_TOKEN:-}" SENTRY_DSN: ${SENTRY_DSN:-} + SENTRY_TRACES_SAMPLE_RATE: ${SENTRY_TRACES_SAMPLE_RATE:-1.0} # Observability: send traces to Tempo inside archiv-net (OTLP gRPC port 4317) # Tempo is defined in docker-compose.observability.yml (future issue). # OTLP failures are non-fatal — backend starts cleanly without the observability stack.