You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration/pgdog.toml/general.md
+134Lines changed: 134 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,6 +175,18 @@ that servers don't stay blocked forever due to healthcheck false positives.
175
175
176
176
Default: **`300_000`** (5 minutes)
177
177
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
+
178
190
### `shutdown_timeout`
179
191
180
192
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
391
403
392
404
Default: **`false`** (disabled)
393
405
406
+
### `cross_shard_disabled`
407
+
408
+
Disable cross-shard queries globally. When enabled, queries touching more than one shard are rejected.
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
+
394
418
### `two_phase_commit`
395
419
396
420
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
403
427
404
428
Default: **`true`** (enabled)
405
429
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
+
406
457
### `query_cache_limit`
407
458
408
459
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:
428
479
429
480
Default: **`auto`**
430
481
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
+
431
499
### `system_catalogs`
432
500
433
501
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:
457
525
458
526
`text` format is required when migrating from `INTEGER` to `BIGINT` primary keys during resharding.
459
527
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
+
460
546
### `reload_schema_on_ddl`
461
547
462
548
!!! warning
@@ -522,6 +608,23 @@ Default: **`abort`**
522
608
523
609
## Logging
524
610
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
+
525
628
### `log_connections`
526
629
527
630
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.
534
637
535
638
Default: **`true`** (enabled)
536
639
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
+
537
652
## Statistics
538
653
539
654
### `stats_period`
@@ -569,3 +684,22 @@ Default: **`5_000`** (5s)
569
684
Maximum amount of time allowed for the [replication delay](../../features/load-balancer/replication-failover.md) query to return a result.
570
685
571
686
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.
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.
Copy file name to clipboardExpand all lines: docs/features/metrics.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,9 @@ OTEL is a standard for publishing metrics to compatible systems, like Grafana, P
71
71
72
72
### Configuration
73
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:
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.
0 commit comments