<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/datadog-pg-tracing-distributed-tracing-for-postgresql-xfr0u4gsj" -->

---
title: DataDog/pg_tracing: Distributed Tracing for PostgreSQL
description: pg_tracing is a PostgreSQL extension that generates server-side distributed tracing spans for database queries and operations. It supports PostgreSQL 14-16 and...
canonical: https://daily.dev/posts/datadog-pg-tracing-distributed-tracing-for-postgresql-xfr0u4gsj
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: DataDog/pg_tracing: Distributed Tracing for PostgreSQL | daily.dev
og:description: pg_tracing is a PostgreSQL extension that generates server-side distributed tracing spans for database queries and operations. It supports PostgreSQL 14-16 and...
og:url: https://daily.dev/posts/datadog-pg-tracing-distributed-tracing-for-postgresql-xfr0u4gsj
og:image: https://api.daily.dev/og/posts/Xfr0u4GSj.png
og:image:alt: DataDog/pg_tracing: Distributed Tracing for PostgreSQL
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# DataDog/pg_tracing: Distributed Tracing for PostgreSQL

**[Hacker News](https://daily.dev/sources/hn)** · 5 min read · 3 upvotes · 0 comments

## Summary

pg_tracing is a PostgreSQL extension that generates server-side distributed tracing spans for database queries and operations. It supports PostgreSQL 14-16 and creates spans for internal functions, statements, execution plans, nested queries, triggers, parallel workers, and transaction commits. Trace context can be propagated via SQLCommenter or GUC parameters, with spans accessible through views or OTLP JSON format. The extension can automatically send spans to an OpenTelemetry collector and supports both context-based and random sampling of queries.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://github.com/DataDog/pg_tracing>

## Similar posts on daily.dev

- [Debug PostgreSQL query latency faster with EXPLAIN ANALYZE in Datadog Database Monitoring](https://daily.dev/posts/debug-postgresql-query-latency-faster-with-explain-analyze-in-datadog-database-monitoring-kwcnveyee) · Datadog · 40 upvotes · 0 comments
- [Your PostgreSQL Platform Has Telemetry. Does It Have a Digital Twin?](https://daily.dev/posts/your-postgresql-platform-has-telemetry-does-it-have-a-digital-twin--bgfpua762) · Planet PostgreSQL · 0 upvotes · 0 comments

---

Tags: [#devops](https://daily.dev/tags/devops), [#c](https://daily.dev/tags/c), [#postgresql](https://daily.dev/tags/postgresql), [#observability](https://daily.dev/tags/observability)

[View this post on daily.dev](https://daily.dev/posts/datadog-pg-tracing-distributed-tracing-for-postgresql-xfr0u4gsj)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"DataDog/pg_tracing: Distributed Tracing for PostgreSQL","url":"https://daily.dev/posts/datadog-pg-tracing-distributed-tracing-for-postgresql-xfr0u4gsj","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/datadog-pg-tracing-distributed-tracing-for-postgresql-xfr0u4gsj"},"datePublished":"2026-02-01T12:57:10.580Z","dateModified":"2026-02-01T12:57:28.289Z","description":"pg_tracing is a PostgreSQL extension that generates server-side distributed tracing spans for database queries and operations. It supports PostgreSQL 14-16 and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/663c6c1e71f7ac3d7e48d8889af03ee6?_a=AQAEulh","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/663c6c1e71f7ac3d7e48d8889af03ee6?_a=AQAEulh","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/datadog-pg-tracing-distributed-tracing-for-postgresql-xfr0u4gsj","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"devops,c,postgresql,observability","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"DataDog/pg_tracing: Distributed Tracing for PostgreSQL"}]}
```

