Database Observability
Container Registry can export OpenTelemetry query tracing spans and connection pool metrics for the PostgreSQL database layer. This feature is opt-in and controlled by a single environment variable.
How It Works
When enabled, the database layer emits two categories of observability data:
- Query tracing: Each database query produces an OpenTelemetry span, giving you distributed-trace visibility into database activity.
- Pool metrics: Connection pool status metrics are exported through the existing
/metricsendpoint alongside other system metrics.
When the feature is disabled, the OpenTelemetry meter provider is skipped entirely, so there is no overhead from unused instrumentation.
Enabling Database Observability
Set the following environment variable to opt in:
| Environment Variable | Value | Description |
|---|---|---|
POSTGRESQL_METRICS_ENABLED | true | Enables database connection pool metrics and OpenTelemetry query tracing. |
By default, database observability is off. Set POSTGRESQL_METRICS_ENABLED=true in your deployment environment and restart the service to activate it.
Once enabled, pool metrics are available at the /metrics endpoint. Query traces are emitted to whichever OpenTelemetry-compatible backend you have configured for the instance.