-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Victor Login <batazor@evrone.com>
- Loading branch information
Showing
3 changed files
with
1,760 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
putenv('OTEL_PHP_AUTOLOAD_ENABLED=true'); | ||
putenv('OTEL_TRACES_EXPORTER=otlp'); | ||
putenv('OTEL_EXPORTER_OTLP_PROTOCOL=grpc'); | ||
putenv('OTEL_METRICS_EXPORTER=otlp'); | ||
putenv('OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc'); | ||
putenv('OTEL_EXPORTER_OTLP_ENDPOINT=http://grafana-tempo.grafana:4317'); | ||
putenv('OTEL_PHP_TRACES_PROCESSOR=batch'); | ||
putenv('OTEL_PROPAGATORS=b3,baggage,tracecontext'); | ||
|
||
echo 'autoloading SDK example starting...' . PHP_EOL; | ||
|
||
// Composer autoloader will execute SDK/_autoload.php which will register global instrumentation from environment configuration | ||
require dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
||
$instrumentation = new \OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation('shortlink-support'); | ||
|
||
$instrumentation->tracer()->spanBuilder('root')->startSpan()->end(); | ||
$instrumentation->meter()->createCounter('cnt')->add(1); | ||
|
||
echo 'Finished!' . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.