open-telemetry / opentelemetry-auto-mysqli
OpenTelemetry auto-instrumentation for mysqli
Installs: 19 401
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
pkg:composer/open-telemetry/opentelemetry-auto-mysqli
Requires
- php: ^8.2
- ext-mysqli: *
- ext-opentelemetry: *
- open-telemetry/api: ^1.0
- open-telemetry/sem-conv: ^1.32
- symfony/polyfill-mbstring: ^1.31
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- open-telemetry/sdk: ^1.0
- phan/phan: ^5.0
- php-http/mock-client: *
- phpstan/phpstan: ^1.1
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.19.2
- vimeo/psalm: 6.4.0
Suggests
- ext-mbstring: For better performance than symfony/polyfill-mbstring
README
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.
OpenTelemetry mysqli 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 client kind spans will automatically be created when calling following functions or methods:
-
mysqli_connect -
mysqli::__construct -
mysqli::connect -
mysqli_real_connect -
mysqli::real_connect -
mysqli_query -
mysqli::query -
mysqli_real_query -
mysqli::real_query -
mysqli_execute_query -
mysqli::execute_query -
mysqli_multi_query -
mysqli::multi_query -
mysqli_next_result -
mysqli::next_result -
mysqli_begin_transaction -
mysqli::begin_transaction -
mysqli_rollback -
mysqli::rollback -
mysqli_commit -
mysqli::commit -
mysqli_stmt_execute -
mysqli_stmt::execute -
mysqli_stmt_next_result -
mysqli_stmt::next_result
Configuration
Disabling mysqli instrumentation
The extension can be disabled via runtime configuration:
OTEL_PHP_DISABLED_INSTRUMENTATIONS=mysqli
Database Context Propagation
Enable context propagation for database queries by installing the following packages:
composer require open-telemetry/opentelemetry-sqlcommenter
Currently, only the following functions support context propagation:
mysqli::querymysqli_querymysqli::real_querymysqli_real_query