jerrytfleung / opentelemetry-auto-magento2
OpenTelemetry auto-instrumentation for Magento2
Package info
github.com/jerrytfleung/contrib-auto-magento2
pkg:composer/jerrytfleung/opentelemetry-auto-magento2
Requires
- php: ^8.3
- ext-json: *
- ext-opentelemetry: *
- magento/framework: ^103.0
- open-telemetry/api: ^1.6
- open-telemetry/sem-conv: ^1.36
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- magento/community-edition: dev-2.4-develop
- mockery/mockery: ^1.5
- open-telemetry/sdk: ^1.8
- phan/phan: ^5 || ^6
- php-http/mock-client: *
- phpstan/phpstan: ^1.1
- phpstan/phpstan-mockery: ^1.1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.20.0
- vimeo/psalm: ^7.0
README
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.
OpenTelemetry Magento2 auto-instrumentation
Please read https://opentelemetry.io/docs/instrumentation/php/automatic/ for instructions on how to install and configure the extension and SDK.
Overview
Auto-instrumentation hooks are registered via composer, and spans will automatically be created for:
Http::launch()- creates the root HTTP server span, attaches request attributes, records the response status code, propagates response headers, and records exceptions.Bootstrap::terminate()- creates aBootstrap::terminatespan and records any terminating exception.FrontController::dispatch()- creates aFrontController.dispatchspan around front controller routing.Action::dispatch()- creates a span named from the Magento full action name, orunknownwhen it is unavailable.ActionInterface::execute()- creates anActionInterface.executespan around action execution.Manager::dispatch()- createsEVENT: {event name}spans for Magento event dispatches, withunknownas a fallback.InvokerInterface::dispatch()- createsOBSERVER: {observer name}spans for observer execution, withunknownas a fallback.Template::fetchView()- createsTEMPLATE: {template path}spans for template rendering and records rendering exceptions.View::renderLayout()- creates aLAYOUT: layout_renderspan around layout rendering and records rendering exceptions.
In addition to spans, Http::launch() also records the http.server.request.duration metric with request metadata and response/error attributes.
Configuration
The extension can be disabled via runtime configuration:
OTEL_PHP_DISABLED_INSTRUMENTATIONS=magento2