PHP code example of open-telemetry / opentelemetry-sqlcommenter
1. Go to this page and download the library: Download open-telemetry/opentelemetry-sqlcommenter library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
open-telemetry / opentelemetry-sqlcommenter example snippets
use OpenTelemetry\SqlCommenter\SqlCommenter;
$comments = [
'traceparent' => '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00',
'custom' => 'value',
];
$query = SqlCommenter::inject($query, $comments);
shell
OTEL_PHP_SQLCOMMENTER_CONTEXT_PROPAGATORS=tracecontext
shell
OTEL_PHP_SQLCOMMENTER_ATTRIBUTE=true
shell
OTEL_PHP_SQLCOMMENTER_PREPEND=true