Skip to content

Commit a22a477

Browse files
authored
adding missing readme files (#123)
1 parent be91e4f commit a22a477

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# OpenTelemetry Symfony auto-instrumentation
2+
3+
## Requirements
4+
5+
* OpenTelemetry extension
6+
* OpenTelemetry SDK and exporters (required to actually export traces)
7+
8+
## Overview
9+
Currently only root span creation is supported (Symfony\Component\HttpKernel\HttpKernel::handle hook).
10+
11+
To export spans, you will need to create and register a `TracerProvider` early in your application's
12+
lifecycle. This can be done either manually or using SDK autoloading.
13+
14+
### Using SDK autoloading
15+
16+
See https://github.com/open-telemetry/opentelemetry-php#sdk-autoloading
17+
18+
### Manual setup
19+
20+
```php
21+
<?php
22+
require_once 'vendor/autoload.php';
23+
24+
$tracerProvider = /*create tracer provider*/;
25+
$scope = \OpenTelemetry\API\Common\Instrumentation\Configurator::create()
26+
->withTracerProvider($tracerProvider)
27+
->activate();
28+
29+
//your application runs here
30+
31+
$scope->detach();
32+
$tracerProvider->shutdown();
33+
```
34+
35+
## Installation via composer
36+
37+
```bash
38+
$ composer require open-telemetry/opentelemetry-auto-symfony
39+
```
40+
41+
## Installing dependencies and executing tests
42+
43+
From Symfony subdirectory:
44+
45+
```bash
46+
$ composer install
47+
$ ./vendor/bin/phpunit tests
48+
```

0 commit comments

Comments
 (0)