PHPackages                             eerzho/opentelemetry-auto-class-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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. eerzho/opentelemetry-auto-class-symfony

ActiveSymfony-bundle[Logging &amp; Monitoring](/categories/logging)

eerzho/opentelemetry-auto-class-symfony
=======================================

Symfony bundle for automatic OpenTelemetry tracing via the #\[Traceable\] attribute

v0.1.3(1mo ago)04MITPHPPHP &gt;=8.2

Since Apr 20Pushed 5d agoCompare

[ Source](https://github.com/eerzho/opentelemetry-auto-class-symfony)[ Packagist](https://packagist.org/packages/eerzho/opentelemetry-auto-class-symfony)[ RSS](/packages/eerzho-opentelemetry-auto-class-symfony/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (0)

opentelemetry-auto-class-symfony
================================

[](#opentelemetry-auto-class-symfony)

[![Version](https://camo.githubusercontent.com/70deb18ae52a615b40ed0d8b195873c3262a7a3bf84a66fc88c3daa2616052b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6565727a686f2f6f70656e74656c656d657472792d6175746f2d636c6173732d73796d666f6e79)](https://packagist.org/packages/eerzho/opentelemetry-auto-class-symfony)[![Downloads](https://camo.githubusercontent.com/5fa0fd6cc9e6ecf6102c47ba366666cf84233b48478f91f3bc9707c470cc18c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6565727a686f2f6f70656e74656c656d657472792d6175746f2d636c6173732d73796d666f6e79)](https://packagist.org/packages/eerzho/opentelemetry-auto-class-symfony)[![PHP](https://camo.githubusercontent.com/e80a12e0504929001c86c83d777c56e019479736a0fa8cd96e651fabb5a30e91/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6565727a686f2f6f70656e74656c656d657472792d6175746f2d636c6173732d73796d666f6e792f706870)](https://packagist.org/packages/eerzho/opentelemetry-auto-class-symfony)[![License](https://camo.githubusercontent.com/c6b18814c4878bfc1e93d0be629e2b6c2c738a69267a454cbf4746495e7c9db6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6565727a686f2f6f70656e74656c656d657472792d6175746f2d636c6173732d73796d666f6e79)](https://packagist.org/packages/eerzho/opentelemetry-auto-class-symfony)

Symfony integration for automatic OpenTelemetry tracing of PHP methods via the `#[Traceable]` attribute. All services with the attribute in the container are instrumented automatically using the `ext-opentelemetry` hook API.

This is a read-only sub-split. Please open issues and pull requests in the [monorepo](https://github.com/eerzho/opentelemetry-auto-class-monorepo).

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

[](#installation)

```
composer require eerzho/opentelemetry-auto-class-symfony
```

Register the bundle:

```
// config/bundles.php
return [
    // ...
    Eerzho\Instrumentation\Class\Symfony\TraceableBundle::class => ['all' => true],
];
```

Requirements:

- [ext-opentelemetry](https://opentelemetry.io/docs/zero-code/php/)
- PHP 8.2+
- Symfony 6+

Usage
-----

[](#usage)

### Basic

[](#basic)

Add `#[Traceable]` to a class registered in the service container — all public methods will be traced automatically:

```
namespace App\Service;

use Eerzho\Instrumentation\Class\Attribute\Traceable;

#[Traceable]
class OrderService
{
    public function create(array $items): void
    {
        // span "App\Service\OrderService::create" is created automatically
    }

    public function cancel(int $orderId): void
    {
        // span "App\Service\OrderService::cancel" is created automatically
    }
}
```

> For full details on how spans are created, argument serialization, and limitations, see [opentelemetry-auto-class](https://github.com/eerzho/opentelemetry-auto-class).

### Exclude methods

[](#exclude-methods)

Use the `exclude` parameter to skip specific methods from tracing:

```
namespace App\Service;

use Eerzho\Instrumentation\Class\Attribute\Traceable;

#[Traceable(exclude: ['healthCheck', 'getVersion'])]
class PaymentService
{
    public function charge(int $amount, string $currency): void
    {
        // traced
    }

    public function healthCheck(): bool
    {
        // NOT traced
        return true;
    }

    public function getVersion(): string
    {
        // NOT traced
        return '1.0.0';
    }
}
```

### Exclude arguments

[](#exclude-arguments)

By default, all method arguments are captured as span attributes. Use `#[Arguments(exclude: [...])]` on a method to hide sensitive parameters:

```
namespace App\Service;

use Eerzho\Instrumentation\Class\Attribute\Arguments;
use Eerzho\Instrumentation\Class\Attribute\Traceable;

#[Traceable]
class AuthService
{
    #[Arguments(exclude: ['password', 'token'])]
    public function login(string $email, string $password, string $token): void
    {
        // span captures "email" attribute only
        // "password" and "token" are excluded
    }

    public function logout(int $userId): void
    {
        // span captures "userId" attribute (no exclusions)
    }
}
```

How it works
------------

[](#how-it-works)

1. During container compilation, the bundle scans all service definitions for `#[Traceable]` attribute
2. Builds a method map and stores it as a container parameter
3. On kernel boot, registers `ext-opentelemetry` hooks for matched methods

Disabling instrumentation
-------------------------

[](#disabling-instrumentation)

To disable tracing at runtime, use the standard OpenTelemetry environment variable:

```
OTEL_PHP_DISABLED_INSTRUMENTATIONS=class
```

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance95

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

50d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f1db695a51a4fcdbee1067af7f1bdbd1bfd11916789994f36d3b2ba2b2e4466?d=identicon)[eerzho](/maintainers/eerzho)

---

Top Contributors

[![eerzho](https://avatars.githubusercontent.com/u/56928699?v=4)](https://github.com/eerzho "eerzho (6 commits)")

---

Tags

apmauto-instrumentationdistributed-tracinginstrumentationmonitoringobservabilityopentelemetryotelphp-attributesspanssymfonysymfony-bundletelemetrytracestracingsymfonymonitoringapmtracingopentelemetryotelSymfony Bundletelemetryobservabilityinstrumentationdistributed-tracingtracesphp-attributesspansauto-instrumentation

### Embed Badge

![Health badge](/badges/eerzho-opentelemetry-auto-class-symfony/health.svg)

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

###  Alternatives

[open-telemetry/opentelemetry-auto-symfony

OpenTelemetry auto-instrumentation for Symfony

561.5M3](/packages/open-telemetry-opentelemetry-auto-symfony)[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).

724.6k](/packages/traceway-opentelemetry-symfony)[friendsofopentelemetry/opentelemetry-bundle

Traces, metrics, and logs instrumentation within your Symfony application

6510.2k](/packages/friendsofopentelemetry-opentelemetry-bundle)

PHPackages © 2026

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