mmo/opentelemetry-auto-yii2-web
Composer 安装命令:
composer require mmo/opentelemetry-auto-yii2-web
包简介
OpenTelemetry auto-instrumentation for Yii2 web app
README 文档
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
runWithParamsin a span to monitor action logic execution. - View Rendering: Wraps
renderin a span to measure time spent rendering templates. - View File Path: Hooks into
findViewFileto 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.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-21