TaskBridge Observability and Ops
This guide describes how host applications wire observability for
backend/taskbridge-fastapi.
Logging model
Use taskbridge.observability.log_structured(...) for consistent log payloads.
The helper emits structured fields under extra["taskbridge"] and supports:
taskIdeventIdclientRequestIduserIdtransport(http,ws,internal)outcome
Metrics model
TaskBridge exposes MetricsSink with a no-op default implementation.
Host app integration pattern:
- Implement
MetricsSinkusing Prometheus, OpenTelemetry, StatsD, etc. - Override
get_metrics_sinkdependency in your FastAPI app. - Keep metric names stable for dashboards and alerting.
Core metrics emitted by TaskBridge:
task_starts_totalstreams_activefallbacks_totalreplays_totalduplicates_totalcancels_totaltask_failures_total
Readiness model
TaskBridge supports composable readiness probes:
RedisReadinessProbefor Redis connectivity checks (ping)ExecutorReadinessProbefor executor adapter health (check_health)CompositeReadinessProbefor consolidated/readystatus and details
The /ready route keeps the same response contract:
status:readyornot_readydetails: per dependency diagnostics
Retention defaults
RedisEventStoreSettings operational defaults:
max_stream_length=1000stream_ttl_seconds=86400cleanup_interval_seconds=3600
Recommended overrides:
- dev: smaller max length and shorter TTL for local debugging
- staging: production-like values with lower resource ceilings
- prod: values sized from replay SLO and expected task/event volume
Reference dependency wiring
Minimal host app wiring shape:
get_readiness_probe->CompositeReadinessProbe({"redis": ..., "executor": ...})get_metrics_sink-> host metrics implementation- standard TaskBridge service dependencies stay unchanged