Hive
feat(observability): configure Sentry error reporting
GitHub issue · Closed
What changed
This configures Sentry error reporting for Hive:
- Adds the Sentry Elixir package and wires Phoenix request context, LiveView context, and Logger error forwarding.
- Reads Sentry settings from
SENTRY_DSN,SENTRY_ENVIRONMENT, andSENTRY_RELEASE. TheSENTRY_DSNvariable contains the Sentry Data Source Name. - Enables Sentry’s Oban integration when Sentry is configured, including retryable job failures and scheduled-job check-ins by default.
- Adds Helm defaults for
SENTRY_OBAN_CAPTURE_ERRORS,SENTRY_OBAN_REPORT_RETRIES, andSENTRY_OBAN_CRON_MONITORING. - Removes the Cowboy-specific
Sentry.PlugCapturewrapper because Hive runs Phoenix on Bandit and Sentry documentsSentry.PlugContextas enough for that server. - Filters expected route and transport noise before events are sent.
- Adds Helm defaults, Tuist production secret wiring, and deployment release tagging.
- Documents self-hosted Sentry setup and the Tuist production secret reference.
Why
Hive had no Sentry integration, while Atlas already reports production errors with environment and release tags. That left operators without a standard way to receive application error events or to understand which deployment produced them.
Sentry’s Elixir documentation also calls out Oban and LiveView as separate integration points. Without those hooks, retryable background job failures and LiveView context would be incomplete.
Approach
Sentry stays dormant unless SENTRY_DSN is present, so local, test, and self-hosted deployments without Sentry keep the same behavior. Runtime configuration sets the environment, release, source context, event filter, and Oban integration.
Oban failures are captured for every failed attempt by default, including failures that Oban will retry. Operators can set SENTRY_OBAN_REPORT_RETRIES=false to report only jobs that have exhausted all attempts, or disable Oban error capture and scheduled-job monitoring separately. LiveViews get Sentry.LiveViewHook through the shared HiveWeb macro, and the endpoint exposes connection metadata that lets Sentry attach richer request context.
The Helm chart uses the existing plain environment and external secret mechanisms, so deployments can opt in without new templates.
Impact
Self-hosters can enable Sentry by adding one secret and optional release or environment tags. Deployments with SENTRY_DSN now report Phoenix request errors, LiveView errors, Logger errors, Oban job failures, and scheduled-job check-ins. Retry attempts will produce Sentry events unless SENTRY_OBAN_REPORT_RETRIES is set to false.
Tuist production now expects hive-sentry/dsn in the hive-k8s-production 1Password vault. Deployments without SENTRY_DSN do not send events.
Validation
mix format --check-formattedgit diff --checkmix compile --warnings-as-errorsmix test test/hive/sentry_event_filter_test.exsmix test(719 passed)helm template hive infra/helm/hivehelm template hive infra/helm/hive -f infra/helm/hive/values-production.yaml- Placeholder Data Source Name runtime check with
SENTRY_OBAN_REPORT_RETRIES=false, confirming Oban capture, scheduled-job monitoring, and the final-attempt callback. - Placeholder Data Source Name runtime check with default settings, confirming retry attempts are reported.
No GitHub comments yet.