Skip to content

Commit 8749c9a

Browse files
authored
feat: document datadog integration (#68)
1 parent 2b74b54 commit 8749c9a

3 files changed

Lines changed: 46 additions & 25 deletions

File tree

docs/client-drivers.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ Some drivers have known compatibility or performance issues, [documented below](
1717
| `asyncpg` (Python) | :material-check-circle-outline: | None. |
1818
| `ruby-pg` (Ruby) | :material-check-circle-outline: | None. |
1919
| `node-postgres` (Node) | :material-check-circle-outline: | None. |
20-
| Postgres.js (Node) | :material-check-circle-outline: | Needs [additional configuration](#postgresjs) for prepared statements to work correctly. |
20+
| Postgres.js (Node) | :material-check-circle-outline: | None. |
2121
| Prisma (Node) | :material-check-circle-outline: | Generates a lot of unique prepared statements, consider limiting the [prepared statements cache](#prisma). |
2222
| Sequelize (Node) | :material-check-circle-outline: | Uses `node-postgres` under the hood, no limitations. |
2323
| PDO (PHP) | :material-check-circle-outline: | None. |
2424
| SQLx (Rust) | :material-check-circle-outline: | None. |
2525
| `tokio_postgres` (Rust) | :material-check-circle-outline: | None. |
2626
| `pgx` (Go) | :material-check-circle-outline: | None. |
27-
| `lib/pq` (Go) | :material-check-circle-outline: | Needs [additional configuration](#libpq) for prepared statements to work correctly. |
27+
| `lib/pq` (Go) | :material-check-circle-outline: | None. |
2828
| `sqlx` (Go) | :material-check-circle-outline: | Uses `pgx` under the hood, no limitations. |
2929
| `libpq` (C/C++) | :material-check-circle-outline: | None. |
3030
| JDBC (Java) | :material-check-circle-outline: | [Manual routing](features/load-balancer/manual-routing.md) requires a bit of [tweaking](#jdbc). |
@@ -57,15 +57,6 @@ query_parser_engine = "pg_query_raw"
5757

5858
We benchmarked this to be 5 times faster than normal `pg_query` parsing, which should help.
5959

60-
### Postgres.js
61-
62-
`postgres` Node driver uses a combination of named and unnamed prepared statements. For [load balancing](features/load-balancer/index.md) or [sharding](features/sharding/index.md) to work correctly, PgDog needs to cache all prepared statements, including unnamed ones (we call them "anonymous"). This is not the default behavior and requires the following setting:
63-
64-
```toml
65-
[general]
66-
prepared_statements = "extended_anonymous"
67-
```
68-
6960
### Prisma
7061

7162
Prisma doesn't correctly use the `IN` clause with arrays, causing it to generate a very large number of unique prepared statements. This is not a big problem, but if left unchecked, can cause heavy memory usage in PgDog. Consider setting a lower prepared statements [cache limit](features/prepared-statements.md#cache-limit):
@@ -74,12 +65,3 @@ Prisma doesn't correctly use the `IN` clause with arrays, causing it to generate
7465
[general]
7566
prepared_statements_limit = 1_000
7667
```
77-
78-
### lib/pq
79-
80-
`lib/pq` (Go) uses unnamed prepared statements which PgDog has to cache for [load balancing](features/load-balancer/index.md) or [sharding](features/sharding/index.md) to work correctly. This is not the default behavior and requires the following setting:
81-
82-
```toml
83-
[general]
84-
prepared_statements = "extended_anonymous"
85-
```

docs/examples/control_plane/docker-compose.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
- redis_data:/data
2525

2626
migrate:
27-
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-04-06
27+
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-04-30
2828
environment:
2929
<<: *control-env
3030
command: control migrate
@@ -33,7 +33,7 @@ services:
3333
condition: service_healthy
3434

3535
init:
36-
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-04-06
36+
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-04-30
3737
environment:
3838
<<: *control-env
3939
command: control onboard --email demo@pgdog.dev --password demopass --token 644b527c-b9d6-4fb2-9861-703bad871ec0 --name Demo
@@ -42,7 +42,7 @@ services:
4242
condition: service_completed_successfully
4343

4444
control:
45-
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-04-06
45+
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-04-30
4646
ports:
4747
- "8099:8080"
4848
environment:
@@ -55,7 +55,7 @@ services:
5555
condition: service_started
5656

5757
pgdog:
58-
image: ghcr.io/pgdogdev/pgdog-enterprise:v2026-04-06
58+
image: ghcr.io/pgdogdev/pgdog-enterprise:v2026-04-30
5959
command: ["pgdog", "--config", "/etc/pgdog/pgdog.toml", "--users", "/etc/secrets/pgdog/users.toml"]
6060
ports:
6161
- "6432:6432"

docs/features/metrics.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ icon: material/chart-line
33
---
44
# Metrics
55

6-
PgDog exposes real-time metrics and statistics about clients, servers, connection pools, and more. They are available via two media:
6+
PgDog exposes real-time metrics and statistics about clients, servers, connection pools, and more. They are available via three media:
77

88
1. The [admin database](../administration/index.md)
99
2. OpenMetrics (e.g., Prometheus) endpoint
10+
3. OTEL exporter
1011

1112
## Admin database
1213

@@ -64,6 +65,44 @@ openmetrics_namespace = "pgdog_"
6465
Some OpenMetrics implementations don't support special characters in the metric name (e.g., periods, commas, etc.). In that case,
6566
you can use an underscore (`_`) instead.
6667

68+
## OTEL
69+
70+
OTEL is a standard for publishing metrics to compatible systems, like Grafana, Prometheus and other providers like Datadog. PgDog can export metrics to a configured endpoint on an interval, making metrics collection work out of the box.
71+
72+
### Configuration
73+
74+
OTEL export is disabled by default. To enable it, configure the collector endpoint and the necessary credentials. If you're using Datadog, you can set the API key as a separate setting:
75+
76+
=== "pgdog.toml"
77+
```toml
78+
[otel]
79+
datadog_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
80+
endpoint = "https://otlp.us5.datadoghq.com/v1/metrics"
81+
```
82+
=== "Helm chart"
83+
```yaml
84+
otel:
85+
datadogApiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
86+
endpoint: "https://otlp.us5.datadoghq.com/v1/metrics"
87+
```
88+
89+
#### Namespace
90+
91+
All metrics by default will be pushed to the `pgdog` namespace. For example, `sv_active` will be reported as `pgdog.sv_active`. The namespace is configurable, for example:
92+
93+
=== "pgdog.toml"
94+
```toml
95+
[otel]
96+
endpoint = "https://otlp.us5.datadoghq.com/v1/metrics"
97+
namespace = "namespace"
98+
```
99+
=== "Helm chart"
100+
```yaml
101+
otel:
102+
endpoint: "https://otlp.us5.datadoghq.com/v1/metrics"
103+
namespace: "namespace"
104+
```
105+
67106
## Available metrics
68107

69108
The following metrics are exported via the OpenMetrics endpoint:

0 commit comments

Comments
 (0)