For AI agents: a markdown representation of this page is available at https://container-registry.com/docs/administration-manual/database-observability/index.md. The site index is at https://container-registry.com/llms.txt.

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 /metrics endpoint 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 VariableValueDescription
POSTGRESQL_METRICS_ENABLEDtrueEnables 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.