PHPackages                             grzegorzdrozd/opentelemetry-metrics-pdo - 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. grzegorzdrozd/opentelemetry-metrics-pdo

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

grzegorzdrozd/opentelemetry-metrics-pdo
=======================================

OpenTelemetry metrics for PDO

1.0.1(1y ago)13Apache-2.0PHPPHP ^8.2

Since Mar 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/GrzegorzDrozd/opentelemetry-metrics-pdo)[ Packagist](https://packagist.org/packages/grzegorzdrozd/opentelemetry-metrics-pdo)[ Docs](https://opentelemetry.io/docs/php)[ RSS](/packages/grzegorzdrozd-opentelemetry-metrics-pdo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (14)Versions (5)Used By (0)

OpenTelemetry metrics for PDO
=============================

[](#opentelemetry-metrics-for-pdo)

Please read  for basic information about metrics. .

Overview
--------

[](#overview)

Metric collection is installed via Composer, and metrics are sent using default collector for selected PDO operations.

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

[](#configuration)

You can disable the extension using [runtime configuration](https://opentelemetry.io/docs/instrumentation/php/sdk/#configuration):

```
OTEL_PHP_DISABLED_METRICS=pdo
```

Recommended OTEL Metrics settings:
----------------------------------

[](#recommended-otel-metrics-settings)

```
OTEL_METRICS_EXEMPLAR_FILTER=all
```

Use this setting to send all data like spanId, traceId, and attributes with metric value.

```
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta
```

To make sure that all metrics are sent and not pre-processed before it is best to send this to `delta`. Otherwise, metrics like `db.client.connection.count` will always send 0 instead of +1 when connection is established and -1 when connection is closed. This metric is specially useful in long-running code that runs from cli like console commands or cron jobs. But it also contains both timestamps — one for connection increase, and one for connection number decrease. Combined with flushing from time to time (more often than on the script end) will show *current* number of established db connections. To force flush, you can use this in one of the console events or somewhere in your processing loop:

```
