pg_tracing: Distributed Tracing for PostgreSQL

https://news.ycombinator.com/rss Hits: 3
Summary

pg_tracing is a PostgreSQL extension that generates server-side spans for distributed tracing. When pg_tracing is active, it generates spans on sampled queries. To access these spans, the extension provides two ways: pg_tracing_consume_spans and pg_tracing_peek_spans views output spans as a set of records and views output spans as a set of records pg_tracing_json_spans function outputs spans as a OTLP json The utility functions pg_tracing_reset and pg_tracing_info provide ways to read and reset extension's statistics. These are not available globally but can be enabled for a specific database with CREATE EXTENSION pg_tracing . There are currently two mechanisms to propagate trace context: As a SQL comment using SQLer As a GUC parameter pg_tracing.trace_context See Trace Propagation for more details. Warning This extension is still in early development and may be unstable. PostgreSQL Version Compatibility pg_tracing only supports PostgreSQL 14, 15 and 16 for the moment. Generated Spans pg_tracing generates spans for the following events: PostgreSQL internal functions: Planner, ProcessUtility, ExecutorRun, ExecutorFinish Statements: SELECT, INSERT, DELETE... Utility Statements: ALTER, SHOW, TRUNCATE, CALL... Execution Plan: A span is created for each node of the execution plan (SeqScan, NestedLoop, HashJoin...) Nested queries: Statements invoked within another statement (like a function) Triggers: Statements executed through BEFORE and AFTER trigger are tracked Parallel Workers: Processes created to handle queries like Parallel SeqScans are tracked Transaction Commit: Time spent fsync changes on the WAL Documentation The following list of files is found in the doc folder of the pg_tracing github repository. For installation instructions, please see the next section of this README. File Description pg_tracing.md Main reference documentation for pg_tracing. Installation From Source pg_tracing can be compiled against an installed copy of PostgreSQL with development packa...

First seen: 2026-02-01 04:43

Last seen: 2026-02-01 06:43