pg_tracing
Distributed Tracing for PostgreSQL
Repository
DataDog/pg_tracing
https://github.com/DataDog/pg_tracing
Source
pg_tracing-0.1.3.tar.gz
pg_tracing-0.1.3.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_tracing | 0.1.3 | STAT | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 6010 | pg_tracing | No | Yes | Yes | Yes | No | Yes | - |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.3 | 1817161514 | pg_tracing | - |
| RPM | PIGSTY | 0.1.3 | 1817161514 | pg_tracing_$v | - |
| DEB | PIGSTY | 0.1.3 | 1817161514 | postgresql-$v-pg-tracing | - |
Build
You can build the RPM / DEB packages for pg_tracing using pig build:
Install
You can install pg_tracing directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Preload:
Create Extension:
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 |
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)