PHPackages                             kaz29/cakephp-otel-plugin - 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. kaz29/cakephp-otel-plugin

ActiveCakephp-plugin

kaz29/cakephp-otel-plugin
=========================

OpenTelemetry instrumentation plugin for CakePHP

0.0.1(1mo ago)011↑2900%[1 PRs](https://github.com/kaz29/cakephp-otel-plugin/pulls)MITPHPPHP ^8.1CI passing

Since Mar 28Pushed 1mo agoCompare

[ Source](https://github.com/kaz29/cakephp-otel-plugin)[ Packagist](https://packagist.org/packages/kaz29/cakephp-otel-plugin)[ RSS](/packages/kaz29-cakephp-otel-plugin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

CakePHP OpenTelemetry Plugin
============================

[](#cakephp-opentelemetry-plugin)

[![Tests](https://github.com/kaz29/cakephp-otel-plugin/actions/workflows/tests.yml/badge.svg)](https://github.com/kaz29/cakephp-otel-plugin/actions/workflows/tests.yml)

[日本語版🇯🇵](README.ja.md)

A CakePHP 5 plugin that adds OpenTelemetry instrumentation to your application. It uses `ext-opentelemetry`'s `zend_observer` hooks to automatically generate spans for Controller and Table operations without any code changes.

Requirements
------------

[](#requirements)

- PHP 8.3+
- CakePHP 5.x
- `ext-opentelemetry` PECL extension

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

[](#installation)

```
composer require kaz29/otel-instrumentation
```

Load the plugin in `config/bootstrap.php` or `Application::bootstrap()`:

```
$this->addPlugin('OtelInstrumentation');
```

Instrumented Targets
--------------------

[](#instrumented-targets)

TargetSpan name example`Controller::invokeAction``App\Controller\UsersController::index``Table::find``Users.find(all)``Table::save``Users.save``Table::delete``Users.delete`Environment Variables
---------------------

[](#environment-variables)

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

OtelErrorLoggingMiddleware
--------------------------

[](#otelerrorloggingmiddleware)

A PSR-15 middleware that catches 500-level exceptions and emits them as OpenTelemetry log records. The log is automatically associated with the current span, so you can view related errors directly in your trace backend (Jaeger, Grafana Tempo, etc.).

- `HttpException` with status code &gt;= 500: logged
- `HttpException` with status code &lt; 500 (e.g. 404): not logged
- Non-`HttpException` (unexpected errors): logged as 500

### Setup

[](#setup)

Add it **after** `ErrorHandlerMiddleware` in your `Application::middleware()`:

```
use OtelInstrumentation\Middleware\OtelErrorLoggingMiddleware;

public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
{
    $middlewareQueue
        ->add(new ErrorHandlerMiddleware())
        ->add(new OtelErrorLoggingMiddleware())
        // ...
    ;
}
```

TraceAwareLogger
----------------

[](#traceawarelogger)

A PSR-3 LoggerInterface decorator that automatically injects `trace_id` / `span_id` into log `context`.

```
$logger = new \OtelInstrumentation\Log\TraceAwareLogger($existingPsr3Logger);
```

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 92.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

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44de8529c667030c187b91e31c795189fa17a4918de89c497053057973a56704?d=identicon)[kaz29](/maintainers/kaz29)

---

Top Contributors

[![kaz29](https://avatars.githubusercontent.com/u/63869?v=4)](https://github.com/kaz29 "kaz29 (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kaz29-cakephp-otel-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/kaz29-cakephp-otel-plugin/health.svg)](https://phpackages.com/packages/kaz29-cakephp-otel-plugin)
```

###  Alternatives

[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

142347.8k](/packages/keepsuit-laravel-opentelemetry)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2222.9M248](/packages/open-telemetry-sdk)[cakephp/queue

Queue plugin for CakePHP

36257.9k12](/packages/cakephp-queue)[open-telemetry/symfony-sdk-bundle

OpenTelemetry Symfony integration

1182.6k4](/packages/open-telemetry-symfony-sdk-bundle)

PHPackages © 2026

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