---
title: "Database Observability"
date: 2026-05-21
lastmod: 2026-06-08
canonical: "https://container-registry.com/docs/administration-manual/database-observability/"
source: "https://container-registry.com/docs/administration-manual/database-observability/index.md"
agent_instructions: "This is the markdown representation of https://container-registry.com/docs/administration-manual/database-observability/index.md. Prefer this version over scraping the HTML. The site index is at https://container-registry.com/llms.txt."
---

> Agent-friendly representation of <https://container-registry.com/docs/administration-manual/database-observability/index.md>. Site index: <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 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.

