mmo/opentelemetry-auto-yii2-web

OpenTelemetry auto-instrumentation for Yii2 web app

Maintainers

Package info

github.com/morawskim/opentelemetry-auto-yii2-web

pkg:composer/mmo/opentelemetry-auto-yii2-web

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-03-21 13:57 UTC

This package is auto-updated.

Last update: 2026-03-21 13:57:44 UTC


README

This package provides automatic instrumentation for the Yii2 web applications using OpenTelemetry.

Requirements

  • PHP 8.2+
  • OpenTelemetry PHP Extension (ext-opentelemetry)

Installation

You can install the package via Composer:

composer require mmo/opentelemetry-auto-yii2-web

Usage

The instrumentation is automatically registered via Composer's autoloading mechanism (using _register.php). As long as the package is installed and the opentelemetry extension is loaded, it will hook into Yii2's core methods.

Disabling Instrumentation

You can disable this specific instrumentation by setting the OTEL_PHP_DISABLED_INSTRUMENTATIONS environment variable:

export OTEL_PHP_DISABLED_INSTRUMENTATIONS=mmo-yii2-web

How it works

The library uses the OpenTelemetry hook() function to intercept key Yii2 methods:

  • Inline Actions: Wraps runWithParams in a span to monitor action logic execution.
  • View Rendering: Wraps render in a span to measure time spent rendering templates.
  • View File Path: Hooks into findViewFile to enrich the current span with the exact path of the rendered file.

License

This project is licensed under the MIT License. See the LICENSE.txt file for details.