Skip to content

Commit 33b4556

Browse files
committed
feat: missing configs
1 parent 8749c9a commit 33b4556

5 files changed

Lines changed: 226 additions & 6 deletions

File tree

docs/configuration/pgdog.toml/general.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,18 @@ that servers don't stay blocked forever due to healthcheck false positives.
175175

176176
Default: **`300_000`** (5 minutes)
177177

178+
### `ban_replica_lag`
179+
180+
Ban a replica from serving read queries if its replication lag (in milliseconds) exceeds this threshold. See [replication failover](../../features/load-balancer/replication-failover.md).
181+
182+
Default: **disabled** (no time-based lag ban)
183+
184+
### `ban_replica_lag_bytes`
185+
186+
Ban a replica from serving read queries if its replication lag (in bytes) exceeds this threshold.
187+
188+
Default: **disabled** (no byte-based lag ban)
189+
178190
### `shutdown_timeout`
179191

180192
How long to wait for active clients to finish transactions when shutting down. This ensures that PgDog redeployments disrupt as few
@@ -391,6 +403,18 @@ Enable the query parser in single-shard deployments and record its decisions. Ca
391403

392404
Default: **`false`** (disabled)
393405

406+
### `cross_shard_disabled`
407+
408+
Disable cross-shard queries globally. When enabled, queries touching more than one shard are rejected.
409+
410+
Default: **`false`** (cross-shard queries allowed)
411+
412+
### `expanded_explain`
413+
414+
When enabled, PgDog appends its own routing annotations to `EXPLAIN` output, showing how the query was routed (e.g., which sharding key matched, which parameter supplied the value, or whether the query was broadcast to all shards).
415+
416+
Default: **`false`** (disabled)
417+
394418
### `two_phase_commit`
395419

396420
Enable [two-phase commit](../../features/sharding/2pc.md) for write, cross-shard transactions.
@@ -403,6 +427,33 @@ Enable automatic conversion of single-statement write transactions to use [two-p
403427

404428
Default: **`true`** (enabled)
405429

430+
### `two_phase_commit_wal_dir`
431+
432+
Directory where the [two-phase commit](../../features/sharding/2pc.md) write-ahead log is stored.
433+
434+
!!! note "Requires restart"
435+
This setting cannot be changed at runtime.
436+
437+
Default: **`./pgdog_wal`**
438+
439+
### `two_phase_commit_wal_segment_size`
440+
441+
Maximum size, in bytes, of a single 2pc WAL segment file before it is rotated.
442+
443+
Default: **`16_777_216`** (16 MiB)
444+
445+
### `two_phase_commit_wal_fsync_interval`
446+
447+
How long, in milliseconds, the 2pc WAL writer waits to coalesce concurrent appends into a single fsync. Setting this to `0` disables waiting for additional appends; records already queued in the channel when the writer wakes are still batched into one fsync. Higher values trade per-transaction commit latency for fewer fsyncs under load.
448+
449+
Default: **`2`** (2ms)
450+
451+
### `two_phase_commit_wal_checkpoint_interval`
452+
453+
How often, in seconds, to write a checkpoint record to the 2pc WAL and garbage-collect old segments.
454+
455+
Default: **`60`** (60s)
456+
406457
### `query_cache_limit`
407458

408459
Limit on the number of statements saved in the statement cache used to accelerate query parsing. The saved statements are visible by running the `SHOW QUERY_CACHE` in the [admin database](../../administration/index.md).
@@ -428,6 +479,23 @@ Available options:
428479

429480
Default: **`auto`**
430481

482+
### `query_parser_engine`
483+
484+
Underlying parser implementation used to analyze SQL queries.
485+
486+
Available options:
487+
488+
- `pg_query_protobuf` (default): the standard [`pg_query`](https://github.com/pganalyze/pg_query) parser
489+
- `pg_query_raw` (experimental): native Rust bindings to PostgreSQL's parser, skipping the protobuf serialization layer. Requires a larger thread stack. PgDog will automatically raise [`memory.stack_size`](memory.md) to at least 32 MiB per Tokio worker when this engine is selected.
490+
491+
Default: **`pg_query_protobuf`**
492+
493+
### `regex_parser_limit`
494+
495+
Maximum size, in bytes, of a query that the regex pre-parser will inspect before deferring to the full parser. Larger queries skip the regex fast path.
496+
497+
Default: **`1_000`**
498+
431499
### `system_catalogs`
432500

433501
Changes how system catalog tables (like `pg_database`, `pg_class`, etc.) are treated by the query router. Default behavior is to assume they are the same on all shards and send queries referencing them to a random shard. This makes tools like `psql` work out of the box.
@@ -457,6 +525,24 @@ Available options:
457525

458526
`text` format is required when migrating from `INTEGER` to `BIGINT` primary keys during resharding.
459527

528+
### `resharding_parallel_copies`
529+
530+
How many parallel `COPY` workers to launch during [resharding](../../features/sharding/resharding/index.md), irrespective of the number of available replicas.
531+
532+
Default: **`1`**
533+
534+
### `resharding_copy_retry_max_attempts`
535+
536+
Maximum number of retries for a failed table copy during resharding (per-table). Retries use exponential backoff starting at [`resharding_copy_retry_min_delay`](#resharding_copy_retry_min_delay), doubling each attempt and capped at 32×.
537+
538+
Default: **`5`**
539+
540+
### `resharding_copy_retry_min_delay`
541+
542+
Base delay, in milliseconds, between table copy retries during resharding. Each successive attempt doubles the delay, capped at 32×.
543+
544+
Default: **`1_000`** (1s)
545+
460546
### `reload_schema_on_ddl`
461547

462548
!!! warning
@@ -522,6 +608,23 @@ Default: **`abort`**
522608

523609
## Logging
524610

611+
### `log_format`
612+
613+
Format to use for PgDog application logs.
614+
615+
Available options:
616+
617+
- `text` (default): human-readable text logs
618+
- `json`: structured JSON logs suitable for ECS/Datadog ingestion
619+
620+
Default: **`text`**
621+
622+
### `log_level`
623+
624+
Log filter directives using the same syntax as the `RUST_LOG` environment variable (e.g. `info`, `debug`, `pgdog=debug,hyper=warn`).
625+
626+
Default: **`info`**
627+
525628
### `log_connections`
526629

527630
If enabled, log every time a user creates a new connection to PgDog.
@@ -534,6 +637,18 @@ If enabled, log every time a user disconnects from PgDog.
534637

535638
Default: **`true`** (enabled)
536639

640+
### `log_dedup_window`
641+
642+
Window, in milliseconds, over which to deduplicate identical log messages. Identical messages (same level, target, and body) that exceed [`log_dedup_threshold`](#log_dedup_threshold) within this window are suppressed and replaced with a single summary line at the end of the window. Set to `0` to disable throttling.
643+
644+
Default: **`0`** (disabled)
645+
646+
### `log_dedup_threshold`
647+
648+
Number of identical log messages allowed within [`log_dedup_window`](#log_dedup_window) before further duplicates are suppressed. Set to `0` to disable throttling.
649+
650+
Default: **`0`** (disabled)
651+
537652
## Statistics
538653

539654
### `stats_period`
@@ -569,3 +684,22 @@ Default: **`5_000`** (5s)
569684
Maximum amount of time allowed for the [replication delay](../../features/load-balancer/replication-failover.md) query to return a result.
570685

571686
Default: **`5_000`** (5s)
687+
688+
## Unique IDs
689+
690+
### `unique_id_function`
691+
692+
Function used by PgDog to generate unique IDs.
693+
694+
Available options:
695+
696+
- `standard` (default): 64-bit function using the entire 64-bit range
697+
- `compact`: 53-bit function whose output fits in a JavaScript-safe integer
698+
699+
Default: **`standard`**
700+
701+
### `unique_id_min`
702+
703+
Minimum value returned by the unique ID generator. Useful for reserving a range of low IDs for fixtures or system rows.
704+
705+
Default: **`0`**
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
icon: material/chart-line
3+
---
4+
5+
# OTEL
6+
7+
OTEL is a standard for sending telemetry from applications to backends that support it, like Grafana or Datadog. PgDog supports OTEL out of the box:
8+
9+
=== "pgdog.toml"
10+
```toml
11+
[otel]
12+
datadog_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
13+
endpoint = "https://otlp.us5.datadoghq.com/v1/metrics"
14+
```
15+
=== "Helm chart"
16+
```yaml
17+
otel:
18+
datadogApiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
19+
endpoint: "https://otlp.us5.datadoghq.com/v1/metrics"
20+
```
21+
22+
### `endpoint`
23+
24+
Endpoint where PgDog will push OTEL metrics.
25+
26+
### `datadog_api_key`
27+
28+
If using Datadog, configuring the API key here will automatically set
29+
the authentication header.
30+
31+
To obtain a Datadog API key, go to your Organization settings / API keys.
32+
33+
### `namespace`
34+
35+
By default, all metrics will be sent under the `pgdog` namespace, e.g.: `pgdog.sv_idle`.
36+
37+
### `headers`
38+
39+
HTTP headers sent with each OTLP push request. Use this to configure authentication or any custom
40+
headers required by your OTLP backend.
41+
42+
In `pgdog.toml`, headers are configured as a sub-table:
43+
44+
=== "pgdog.toml"
45+
```toml
46+
[otel.headers]
47+
DD-API-KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
48+
X-Custom = "foo"
49+
```
50+
=== "Helm chart"
51+
```yaml
52+
otel:
53+
headers:
54+
DD-API-KEY: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
55+
X-Custom: "foo"
56+
```
57+
58+
Headers can also be set via the `OTEL_EXPORTER_OTLP_HEADERS` environment variable, as a
59+
comma-separated list of `key=value` pairs.
60+
61+
### `push_interval`
62+
63+
How often, in milliseconds, to push metrics to the OTLP endpoint.
64+
65+
_Default:_ `10000`
66+
67+
## Environment variables
68+
69+
PgDog honors the standard OpenTelemetry environment variables. When set, they override the
70+
corresponding `pgdog.toml` values (or supply a value when the setting is omitted).
71+
72+
| Variable | Description |
73+
| --- | --- |
74+
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP metrics ingest URL. Equivalent to `endpoint`. |
75+
| `OTEL_EXPORTER_OTLP_HEADERS` | Comma-separated `key=value` pairs added to OTLP push requests. Equivalent to `[otel.headers]`. |
76+
| `OTEL_METRIC_EXPORT_INTERVAL` | Push interval in milliseconds. Equivalent to `push_interval`. |
77+
| `OTEL_SERVICE_NAME` | Sets the `service.name` resource attribute. Takes precedence over any value set via `OTEL_RESOURCE_ATTRIBUTES`. _Default:_ `pgdog`. |
78+
| `OTEL_RESOURCE_ATTRIBUTES` | Comma-separated `key=value` pairs added as resource attributes on every metric (e.g. `env=prod,region=us-east-1`). Values may be percent-encoded. |
79+
| `PGDOG_OTEL_NAMESPACE` | Metric name prefix. Equivalent to `namespace`. |
80+
| `DD_API_KEY` | Datadog API key. Equivalent to `datadog_api_key`. |
81+
82+
PgDog automatically sets the following resource attributes on every exported metric:
83+
`service.name` (defaults to `pgdog`), `service.instance.id`, and `host.name`. Use
84+
`OTEL_RESOURCE_ATTRIBUTES` to add or override any of these.

docs/enterprise_edition/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ If you're using our [Helm chart](../installation.md#kubernetes), you just need t
6565
```yaml
6666
image:
6767
repository: ghcr.io/pgdogdev/pgdog-enterprise
68-
tag: v2026-04-06
68+
tag: v2026-05-01
6969
```
7070
7171
For deploying the [control plane](control_plane/index.md), you have two options:

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-30
27+
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-05-01
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-30
36+
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-05-01
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-30
45+
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-05-01
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-30
58+
image: ghcr.io/pgdogdev/pgdog-enterprise:v2026-05-01
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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ OTEL is a standard for publishing metrics to compatible systems, like Grafana, P
7171

7272
### Configuration
7373

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:
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+
See [`[otel]` configuration](../configuration/pgdog.toml/otel.md) for the full list of settings, including custom headers, push interval, and supported `OTEL_*` environment variables.
7577

7678
=== "pgdog.toml"
7779
```toml

0 commit comments

Comments
 (0)