https://github.com/opentelemetry-php/contrib-auto-pdo
[READONLY] OpenTelemetry PDO auto-instrumentation
https://github.com/opentelemetry-php/contrib-auto-pdo
Last synced: 4 months ago
JSON representation
[READONLY] OpenTelemetry PDO auto-instrumentation
- Host: GitHub
- URL: https://github.com/opentelemetry-php/contrib-auto-pdo
- Owner: opentelemetry-php
- Created: 2023-02-02T07:18:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-02T06:18:21.000Z (7 months ago)
- Last Synced: 2025-12-27T01:44:29.503Z (6 months ago)
- Language: PHP
- Size: 44.9 KB
- Stars: 10
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/opentelemetry-php/contrib-auto-pdo/releases)
[](https://github.com/open-telemetry/opentelemetry-php/issues)
[](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation/PDO)
[](https://github.com/opentelemetry-php/contrib-auto-pdo)
[](https://packagist.org/packages/open-telemetry/opentelemetry-auto-pdo/)
[](https://packagist.org/packages/open-telemetry/opentelemetry-auto-pdo/)
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.
# OpenTelemetry PDO (PHP DataObjects) auto-instrumentation
Please read https://opentelemetry.io/docs/instrumentation/php/automatic/ for instructions on how to
install and configure the extension and SDK.
## Overview
Auto-instrumentation hooks are registered via composer, and spans will automatically be created for
selected `PDO` and `PDOStatement` methods.
## Configuration
The extension can be disabled via [runtime configuration](https://opentelemetry.io/docs/instrumentation/php/sdk/#configuration):
```shell
OTEL_PHP_DISABLED_INSTRUMENTATIONS=pdo
```
In case UI used to view telemetry data does not support links between spans (for example newrelic),
you can optionally enable setting db statements attribute to `fetchAll` and `execute` spans using
configuration directive:
```
otel.instrumentation.pdo.distribute_statement_to_linked_spans = true
```
or environment variable:
```shell
OTEL_PHP_INSTRUMENTATION_PDO_DISTRIBUTE_STATEMENT_TO_LINKED_SPANS=true
```
## Database Context Propagation
Enable context propagation for database queries (pdo_mysql, pdo_pgsql only) by installing the following packages:
```shell
composer require open-telemetry/opentelemetry-sqlcommenter
```
Currently, only the following functions support context propagation:
* `PDO::query`
* `PDO::exec`