PHPackages                             traceway/opentelemetry-symfony - 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. [Database &amp; ORM](/categories/database)
4. /
5. traceway/opentelemetry-symfony

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

traceway/opentelemetry-symfony
==============================

Pure-PHP OpenTelemetry instrumentation for Symfony — automatic HTTP, Console, HttpClient, Messenger, Doctrine DBAL, Cache, Twig tracing and Monolog log-trace correlation with response propagation, a lightweight Tracing helper, route templates, and semantic conventions. No C extension required (ext-protobuf recommended for production).

v3.1.0(3w ago)8022.8k4MITPHPPHP &gt;=8.1CI passing

Since Mar 14Pushed 3w ago2 watchersCompare

[ Source](https://github.com/tracewayapp/opentelemetry-symfony-bundle)[ Packagist](https://packagist.org/packages/traceway/opentelemetry-symfony)[ Docs](https://github.com/tracewayapp/opentelemetry-symfony-bundle)[ RSS](/packages/traceway-opentelemetry-symfony/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (118)Versions (55)Used By (0)

 [    ![Traceway Logo](https://raw.githubusercontent.com/tracewayapp/traceway/main/Traceway%20Logo.png)  ](https://tracewayapp.com)

OpenTelemetry Symfony Bundle
============================

[](#opentelemetry-symfony-bundle)

[![CI](https://github.com/tracewayapp/opentelemetry-symfony-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/tracewayapp/opentelemetry-symfony-bundle/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/578e9ab0ca4d7c6d0b5a25073184b143400f1f8c16acc42f275412cf36aa5c1f/68747470733a2f2f636f6465636f762e696f2f67682f74726163657761796170702f6f70656e74656c656d657472792d73796d666f6e792d62756e646c652f67726170682f62616467652e737667)](https://codecov.io/gh/tracewayapp/opentelemetry-symfony-bundle)[![Packagist Version](https://camo.githubusercontent.com/aebf2e633114969dc5b25a55556150c1f2ec1a81e483648e5eedde16e336c12d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74726163657761792f6f70656e74656c656d657472792d73796d666f6e792e737667)](https://packagist.org/packages/traceway/opentelemetry-symfony)[![Packagist Downloads](https://camo.githubusercontent.com/440fb495cfbe28a94beae249d1036421f87f938080648c1cf2b63b16cd08172c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74726163657761792f6f70656e74656c656d657472792d73796d666f6e792e737667)](https://packagist.org/packages/traceway/opentelemetry-symfony)[![PHP Version](https://camo.githubusercontent.com/04744bae0a61d2ffe29c26f07a9612eae20445fc6feaeb77b3af1f0e9be6447c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d3838393242462e737667)](https://php.net)[![Symfony Version](https://camo.githubusercontent.com/df69560fe6c25fd0268689a4bbba1950f74df1ee59a1b5d6f744f96d63043647/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d253345253344362e342d3030303030302e737667)](https://symfony.com)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![Discord](https://camo.githubusercontent.com/397741123d69503a0a224452a3629154669e9a870686f0c21c68527c7d8faa07/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446973636f72642d4a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465)](https://discord.gg/9tPn2SB3)

Pure-PHP OpenTelemetry instrumentation for Symfony. Automatic tracing for HTTP, Console, HttpClient, Messenger, Mailer, Scheduler, Doctrine DBAL, Cache, and Twig — plus Monolog log-trace correlation, OTel log export, and opt-in metrics. **No C extension required.**

Works with any OpenTelemetry-compatible backend: [Traceway](https://tracewayapp.com), [Jaeger](https://www.jaegertracing.io/), [Zipkin](https://zipkin.io/), [Datadog](https://www.datadoghq.com/), [Grafana Tempo](https://grafana.com/oss/tempo/), [Honeycomb](https://www.honeycomb.io/), [AWS X-Ray](docs/aws-xray.md), and more.

- **Pure PHP** — installs on every managed Symfony host
- **Production-ready** — stable since v1.0, PHPStan level 10 with no baseline, Symfony 6.4 LTS through 8.x
- **Correct under load** — Messenger context propagates across async boundaries, DBAL 3 and 4 CI-tested, re-entrance guards on HttpClient and the log handler

Installation
------------

[](#installation)

```
composer require traceway/opentelemetry-symfony
```

Symfony Flex registers the bundle automatically. Without Flex, add it to `config/bundles.php`:

```
return [
    // ...
    Traceway\OpenTelemetryBundle\OpenTelemetryBundle::class => ['all' => true],
];
```

Quick Start
-----------

[](#quick-start)

```
OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_SERVICE_NAME=my-symfony-app
OTEL_TRACES_EXPORTER=otlp
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/json
```

That's it. Every HTTP request, console command, outgoing call, Messenger job, DB query, cache operation, and Twig render is now traced.

Prefer configuring the SDK via the bundle instead of raw env vars (works with DotEnv and Symfony Secrets)? See the `open_telemetry.sdk` section in [docs/configuration.md](docs/configuration.md).

Verify the wiring:

```
bin/console traceway:doctor
```

What Gets Traced
----------------

[](#what-gets-traced)

HTTP requests (with route templates), Console commands, HttpClient, Messenger, Scheduler, Mailer, Doctrine DBAL, Cache, and Twig — plus Monolog `trace_id`/`span_id` correlation and opt-in OTel log export. Each subsystem is individually toggleable. See **[docs/index.md](docs/index.md)** for the per-component span breakdown.

Semantic Conventions
--------------------

[](#semantic-conventions)

Audited against the current [OTel semantic conventions](https://opentelemetry.io/docs/specs/semconv/): every stable MUST/Required/Conditionally-Required rule is implemented, Recommended attributes are emitted wherever the data exists, and all deviations are deliberate and spec-permitted. See **[docs/semantic-conventions.md](docs/semantic-conventions.md)** for the conformance statement, deviations, and known limitations.

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

[](#configuration)

All options are optional — the bundle works out of the box. A minimal `config/packages/open_telemetry.yaml`:

```
open_telemetry:
    traces:
        excluded_paths: [/health, /_profiler, /_wdt]
    metrics:
        enabled: true
    logs:
        correlation:
            enabled: true
```

See **[docs/configuration.md](docs/configuration.md)** for the full reference and environment variables.

Manual Instrumentation
----------------------

[](#manual-instrumentation)

Inject `TracingInterface` for one-liner span creation:

```
use Traceway\OpenTelemetryBundle\TracingInterface;

class OrderService
{
    public function __construct(private readonly TracingInterface $tracing) {}

    public function process(int $orderId): void
    {
        $this->tracing->trace('order.validate', fn () => $this->validate($orderId));
        $this->tracing->trace('order.fulfill', function () {
            $this->tracing->trace('inventory.reserve', fn () => $this->reserve());
            $this->tracing->trace('payment.charge', fn () => $this->charge());
        });
    }
}
```

Mock in tests with `$this->createStub(TracingInterface::class)` and have `trace()` invoke the callback directly.

Metrics
-------

[](#metrics)

Opt-in OpenTelemetry metrics — Messenger, Doctrine DBAL, HTTP server/client, and Mailer — alongside a `MeterRegistryInterface` for custom counters/histograms/gauges. See **[docs/metrics.md](docs/metrics.md)**.

Doctor
------

[](#doctor)

`bin/console traceway:doctor` runs diagnostic checks against the bundle's wiring, SDK environment variables, and OTLP endpoint reachability — text or JSON, scriptable in CI. See **[docs/doctor.md](docs/doctor.md)** for flags, JSON envelope schema, and custom checks.

Documentation
-------------

[](#documentation)

[Configuration](docs/configuration.md)Full config reference and environment variables[Metrics](docs/metrics.md)Instrument list, manual metrics, exemplars[AWS X-Ray](docs/aws-xray.md)Native `propagator` / `id_generator` keys[Doctor](docs/doctor.md)`traceway:doctor` flags, JSON output, custom checks[Performance](docs/performance.md)Overhead, sampling, exporter choice[Upgrade from v1.x](UPGRADE-2.0.md)Flat → nested config migration[Changelog](CHANGELOG.md)Release historyContributing
------------

[](#contributing)

```
git clone https://github.com/tracewayapp/opentelemetry-symfony-bundle.git
cd opentelemetry-symfony-bundle
composer install
vendor/bin/phpunit
vendor/bin/phpstan analyse
```

See [CONTRIBUTING.md](CONTRIBUTING.md). Join the conversation on [Discord](https://discord.gg/9tPn2SB3).

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance95

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.3% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~4 days

Total

28

Last Release

25d ago

Major Versions

v1.9.0 → v2.0.02026-05-19

v2.2.1 → v3.0.02026-06-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/8160951a0cd8e658add59bc36c59497d410ac3a82ab800aa6cd40b54f188f287?d=identicon)[graphene](/maintainers/graphene)

---

Top Contributors

[![jstojiljkovic](https://avatars.githubusercontent.com/u/22980168?v=4)](https://github.com/jstojiljkovic "jstojiljkovic (151 commits)")[![srekcud](https://avatars.githubusercontent.com/u/12445827?v=4)](https://github.com/srekcud "srekcud (37 commits)")[![AndreasA](https://avatars.githubusercontent.com/u/1383094?v=4)](https://github.com/AndreasA "AndreasA (7 commits)")[![d-mitrofanov-v](https://avatars.githubusercontent.com/u/88384601?v=4)](https://github.com/d-mitrofanov-v "d-mitrofanov-v (6 commits)")[![dusanstanojeviccs](https://avatars.githubusercontent.com/u/15340338?v=4)](https://github.com/dusanstanojeviccs "dusanstanojeviccs (2 commits)")[![FrameAutomata](https://avatars.githubusercontent.com/u/68393441?v=4)](https://github.com/FrameAutomata "FrameAutomata (1 commits)")[![MrYamous](https://avatars.githubusercontent.com/u/32437818?v=4)](https://github.com/MrYamous "MrYamous (1 commits)")[![pflueg](https://avatars.githubusercontent.com/u/34553498?v=4)](https://github.com/pflueg "pflueg (1 commits)")

---

Tags

instrumentationobservabilityopentelemetryotelphpsymfonysymfony-bundletracingconsolesymfonyloggingtwigdoctrinetracingopentelemetryotelcachemonologobservabilityinstrumentation

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/traceway-opentelemetry-symfony/health.svg)

```
[![Health](https://phpackages.com/badges/traceway-opentelemetry-symfony/health.svg)](https://phpackages.com/packages/traceway-opentelemetry-symfony)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M415](/packages/easycorp-easyadmin-bundle)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M656](/packages/shopware-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M225](/packages/sulu-sulu)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19467.3M1.9k](/packages/drupal-core)[chameleon-system/chameleon-base

The Chameleon System core.

1029.4k6](/packages/chameleon-system-chameleon-base)

PHPackages © 2026

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