pg_tracing
Distributed Tracing for PostgreSQL
pg_tracing : Distributed Tracing for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 6010 | pg_tracing | pg_tracing | 0.1.3 |
STAT | MIT | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-r | No | Yes | Yes | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_stat_log pg_stat_backtrace pgfr_record logerrors pgelog |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.3 |
18 17 16 15 14 | pg_tracing |
- |
| RPM | PIGSTY | 0.1.3 |
18 17 16 15 14 | pg_tracing_$v |
- |
| DEB | PIGSTY | 0.1.3 |
18 17 16 15 14 | postgresql-$v-pg-tracing |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| el8.aarch64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| el9.x86_64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| el9.aarch64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| el10.x86_64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| el10.aarch64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| d12.x86_64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| d12.aarch64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| d13.x86_64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| d13.aarch64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| u22.x86_64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| u22.aarch64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| u24.x86_64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| u24.aarch64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| u26.x86_64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
| u26.aarch64 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 | PIGSTY 0.1.3 |
Source
github.com/DataDog/pg_tracing
pg_tracing-0.1.3.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
pg_tracing generates server-side spans for distributed tracing. It creates spans for planner, executor, plan nodes, nested queries, triggers, parallel workers, and transaction commits.
Trace Propagation via SQLCommenter
Pass trace context as a SQL comment. Queries with a sampled flag will generate spans:
Trace Propagation via GUC
Standalone Sampling
Randomly sample queries without external trace context:
Viewing Spans
Statistics
Sending Spans to OpenTelemetry Collector
Configure in postgresql.conf:
Key GUC Parameters
| Parameter | Default | Description |
|---|---|---|
pg_tracing.max_span |
10000 | Maximum spans in shared memory |
pg_tracing.track |
all |
Which statements to track |
pg_tracing.sample_rate |
0 | Fraction of queries to sample randomly |
pg_tracing.otel_endpoint |
(empty) | OTLP HTTP endpoint for span export |