PHPackages                             open-telemetry/opentelemetry-auto-postgresql - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. open-telemetry/opentelemetry-auto-postgresql

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

open-telemetry/opentelemetry-auto-postgresql
============================================

OpenTelemetry auto-instrumentation for postgresql

05.2k↓49.3%1[1 issues](https://github.com/opentelemetry-php/contrib-auto-postgresql/issues)PHP

Since Mar 20Pushed yesterdayCompare

[ Source](https://github.com/opentelemetry-php/contrib-auto-postgresql)[ Packagist](https://packagist.org/packages/open-telemetry/opentelemetry-auto-postgresql)[ RSS](/packages/open-telemetry-opentelemetry-auto-postgresql/feed)WikiDiscussions main Synced today

READMEChangelog (2)DependenciesVersions (1)Used By (0)

[![Releases](https://camo.githubusercontent.com/46e38a504120203bf7615645011bcf2bb834e03e8eb0bc8e0f4864c729fd5baf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72656c65617365732d707572706c65)](https://github.com/open-telemetry/opentelemetry-php-contrib/releases)[![Issues](https://camo.githubusercontent.com/b9b31135f113cdb6e2b662b4040276044ee0803567bc17688eaf4386f797ea50/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6973737565732d70696e6b)](https://github.com/open-telemetry/opentelemetry-php/issues)[![Source](https://camo.githubusercontent.com/e27dd1126a60abf1c26521d893d9f235ef342a76231c2428ddbc4651185bd626/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d636f6e747269622d677265656e)](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation/PostgreSql)[![Mirror](https://camo.githubusercontent.com/2f9050293ab0c0d9471e618215bc7417a63b6873c960e1605bddb69b1911fa4c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6972726f722d6f70656e74656c656d657472792d2d7068702d2d636f6e747269622d626c7565)](https://github.com/open-telemetry/opentelemetry-php-contrib)[![Latest Version](https://camo.githubusercontent.com/d825ee8551e58a1ece58881dcb8d9127e0840bacb1e943ab41a3de24cc11f898/687474703a2f2f706f7365722e707567782e6f72672f6f70656e2d74656c656d657472792f6f70656e74656c656d657472792d6175746f2d706f737467726573716c2f762f756e737461626c65)](https://packagist.org/packages/open-telemetry/opentelemetry-auto-postgresql/)[![Stable](https://camo.githubusercontent.com/1220d8aec65cfccb31200a98a28e157beabd5b07242840ceb330ea0457e93e52/687474703a2f2f706f7365722e707567782e6f72672f6f70656e2d74656c656d657472792f6f70656e74656c656d657472792d6175746f2d706f737467726573716c2f762f737461626c65)](https://packagist.org/packages/open-telemetry/opentelemetry-auto-postgresql/)

> This is a read-only subtree split of .

OpenTelemetry PostgreSQL auto-instrumentation
=============================================

[](#opentelemetry-postgresql-auto-instrumentation)

Please read  for instructions on how to install and configure the extension and SDK.

Overview
--------

[](#overview)

This package provides auto-instrumentation for the PostgreSQL native PHP extension (`ext-pgsql`). Hooks are registered via Composer, and client spans are automatically created for key database operations.

Supported functions include:

### Connection

[](#connection)

- `pg_connect`
- `pg_pconnect`

### Queries

[](#queries)

- `pg_query`
- `pg_query_params`
- `pg_send_query`
- `pg_send_query_params`
- `pg_get_result`

### Prepared Statements

[](#prepared-statements)

- `pg_prepare`
- `pg_send_prepare`
- `pg_execute`
- `pg_send_execute`

### Table/Row Operations

[](#tablerow-operations)

- `pg_insert`
- `pg_select`
- `pg_update`
- `pg_delete`

### COPY

[](#copy)

- `pg_copy_from`
- `pg_copy_to`

### Large Objects (LOB)

[](#large-objects-lob)

- `pg_lo_create`
- `pg_lo_open`
- `pg_lo_write`
- `pg_lo_read`
- `pg_lo_read_all`
- `pg_lo_unlink`
- `pg_lo_import`
- `pg_lo_export`

Configuration
-------------

[](#configuration)

### Disabling PostgreSQL instrumentation

[](#disabling-postgresql-instrumentation)

The extension can be disabled via [runtime configuration](https://opentelemetry.io/docs/instrumentation/php/sdk/#configuration):

```
OTEL_PHP_DISABLED_INSTRUMENTATIONS=postgresql
```

Database Context Propagation
----------------------------

[](#database-context-propagation)

Enable context propagation for database queries by installing the following packages:

```
composer require open-telemetry/opentelemetry-sqlcommenter
```

Currently, only the following functions support context propagation:

- `pg_query`
- `pg_send_query`

Compatibility
-------------

[](#compatibility)

PHP 8.2 or newer is required

###  Health Score

29

—

LowBetter than 63% of packages

Maintenance65

Regular maintenance activity

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4978962?v=4)[Brett McBride](/maintainers/brettmc)[@brettmc](https://github.com/brettmc)

![](https://avatars.githubusercontent.com/u/4099109?v=4)[Bob Strecansky](/maintainers/bobstrecansky)[@bobstrecansky](https://github.com/bobstrecansky)

---

Top Contributors

[![jerrytfleung](https://avatars.githubusercontent.com/u/8791493?v=4)](https://github.com/jerrytfleung "jerrytfleung (2 commits)")[![intuibase](https://avatars.githubusercontent.com/u/9551626?v=4)](https://github.com/intuibase "intuibase (1 commits)")[![pieterocp](https://avatars.githubusercontent.com/u/68863060?v=4)](https://github.com/pieterocp "pieterocp (1 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (1 commits)")

### Embed Badge

![Health badge](/badges/open-telemetry-opentelemetry-auto-postgresql/health.svg)

```
[![Health](https://phpackages.com/badges/open-telemetry-opentelemetry-auto-postgresql/health.svg)](https://phpackages.com/packages/open-telemetry-opentelemetry-auto-postgresql)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.5k1.2B8.0k](/packages/psr-log)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k43.4M260](/packages/spatie-laravel-activitylog)[itsgoingd/clockwork

php dev tools in your browser

5.9k26.9M84](/packages/itsgoingd-clockwork)[arcanedev/log-viewer

Provides a Log Viewer for Laravel

2.4k6.7M48](/packages/arcanedev-log-viewer)[bugsnag/bugsnag-laravel

Official Bugsnag notifier for Laravel applications.

90234.0M32](/packages/bugsnag-bugsnag-laravel)[facade/flare-client-php

Send PHP errors to Flare

52299.4M4](/packages/facade-flare-client-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
