Skip to content

Observability port

Definition

Hexagonal port for the observability boundary (ADR-0044 P7.7). Exposes five methods: capture_exception, capture_message, breadcrumb, set_measurement, and flush. The production adapter is SentryObservabilityAdapter in src/observability/sentry_adapter.py, which wraps sentry_sdk and silently degrades to a no-op when the SDK is not installed. The port is intentionally minimal — rich APIs drag every backend into the union.

Invariants

  • Pure Protocol — no implementation, no state.
  • The adapter is a no-op when sentry_sdk is absent; every method returns silently so callers never need a try/except around port calls.
  • Domain code never imports sentry_sdk directly; all observability routes through the injected ObservabilityPort so a future OTLP, structured-log, or sidecar adapter can replace Sentry without touching call sites.