Add opt-in Sentry error reporting for platform services and dashboard #377
Labels
No labels
Compat/Breaking
Component/Enclave-Builder
Component/Infrastructure
Deploy/BYOC
Deploy/Full-managed
Deploy/Self-hosted
Interface/API
Interface/CLI
Interface/Git
Interface/Web
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
public/platform#377
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Summary
Add opt-in Sentry error reporting for the operator-facing Caution platform services and dashboard, with separate development and production Sentry environments. The integration should improve crash/error visibility without weakening Caution's confidentiality, attestation, reproducibility, or secret-handling guarantees.
Proposed implementation
Backend Rust services
Add a small shared workspace crate, for example
src/observability/caution-observability, that centralizes Sentry and tracing setup for:src/apisrc/gatewaysrc/meteringsrc/email-serviceThe crate should:
SENTRY_DSNis set and non-empty;tracingusage viasentry+sentry-tracing;tracing::error!events;tracing::warn!events as breadcrumbs unless there is a specific reason to promote one to an event;Recommended Rust crates, subject to compatibility with the repository's pinned toolchain/container builds:
Use the rustls path rather than native TLS where feasible because these services are built for static/musl StageX-style runtime images.
Axum request context
Layer Sentry into the Axum routers where appropriate, but prefer route templates/matched paths over raw user-controlled URLs. Include safe context such as:
api,gateway,metering,email-service);development,production, etc.);Do not capture request/response bodies.
The gateway already has
X-Request-Idmiddleware. Before using this value as a Sentry tag/context, validate it strictly, e.g. accept UUIDs only and generate a new UUID otherwise, to avoid log/header/tag injection from user-supplied request IDs.Frontend Vue dashboard
Add an opt-in Vue integration in
frontend/src/main.jsusing@sentry/vue:VITE_SENTRY_DSNis set;sendDefaultPii: false;0initially;Add build-time variables to the frontend build path used by
containerfiles/Containerfile.gatewayandcontainerfiles/Containerfile.frontend.Source map upload, if desired, should be a follow-up in CI/release automation using a CI-only
SENTRY_AUTH_TOKEN. Do not passSENTRY_AUTH_TOKENthrough Docker build args, final images,env.example, systemd units, or runtime.envfiles.Sentry setup instructions
1. Create Sentry organization/projects
In Sentry, create separate projects for backend and frontend so SDK settings and alert rules can differ:
caution-platform-backend, platform Rustcaution-platform-frontend, platform JavaScript/VueUse separate Sentry environments instead of separate projects for dev vs prod unless there is a compliance or access-control reason to fully isolate them:
developmentproductionIf staging is used, also add:
staging2. Development environment
Development should be opt-in and low/no-noise by default.
Recommended local
.envadditions:For ordinary local development, leave both DSNs empty to disable Sentry entirely. Developers can set them only when intentionally testing observability.
Development verification steps:
SENTRY_DSNset.development.3. Production environment
Production should use real release identifiers and conservative sampling.
Recommended production runtime
.envadditions:Production rollout guidance:
SENTRY_TRACES_SAMPLE_RATE=0and frontend tracing disabled.0.01, and only for routes where privacy and volume are understood.4. Source maps and releases
Frontend source maps should be uploaded from CI/release automation, not from runtime containers.
If source map upload is added later:
@sentry/vite-pluginorsentry-cliin CI;SENTRY_AUTH_TOKENonly as a CI secret;VITE_SENTRY_RELEASE;SENTRY_AUTH_TOKENinto images.Security and privacy requirements
Sentry must not send or store:
Authorizationheaders;INTERNAL_SERVICE_SECRET;.envvalues;.caution/secrets/*.asc;Do not initialize Sentry inside enclave/customer workload code or deterministic/reproducible build paths. Sentry should be limited to operator-facing platform services and the dashboard.
Acceptance criteria
SENTRY_DSNunset or empty means backend Sentry is fully disabled and services behave as they do today.VITE_SENTRY_DSNunset or empty means frontend Sentry is fully disabled.sendDefaultPii: falseand replay disabled.env.example, deployment docs, or relevant README sections document dev and prod Sentry setup.Suggested test plan
Backend:
Frontend:
Container/build smoke tests where feasible:
Duplicate/related issue audit while moving this into General Availability:
Error tracking and logging). That issue asked for durable error tracking/logging, and the later discussion specifically called out Sentry as the likely error-tracking solution. Closing #132 in favor of this more detailed GA-scoped issue.Add instrumentation for error notifications), which had previously been closed in favor of #132.I also checked #233 (
Observability Into Builders). That one is related but not a duplicate: it focuses on builder logs/metrics and encrypted log streaming, while this issue intentionally limits Sentry to operator-facing platform services/dashboard and says not to initialize Sentry inside builder/enclave/reproducible paths.