Skip to content

Commit 425ebaf

Browse files
authored
doco updates for beta (#895)
1 parent 02c1782 commit 425ebaf

File tree

3 files changed

+28
-47
lines changed

3 files changed

+28
-47
lines changed

README.md

+26-34
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ All OpenTelemetry libraries are distributed via packagist, notably:
5555

5656
The [open-telemetry/opentelemetry](https://packagist.org/packages/open-telemetry/opentelemetry) package contains all of the above and is the easiest way to try out OpenTelemetry.
5757

58+
The [open-telemetry/opentelemetry-php-instrumentation](https://github.com/open-telemetry/opentelemetry-php-instrumentation) extension can be installed to enable auto-instrumentation of PHP code (in conjunction with contrib modules).
59+
5860
---
5961
This repository also hosts and distributes generated client code used by individual components as separate packages. These packages are:
6062
- Generated [OTLP](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md) ProtoBuf files:
@@ -76,13 +78,10 @@ Additional packages, demos and tools are hosted or distributed in the [OpenTelem
7678

7779
| Signal | Status | Project |
7880
|---------|--------|---------|
79-
| Traces | Alpha | N/A |
80-
| Metrics | Alpha | N/A |
81+
| Traces | Beta | N/A |
82+
| Metrics | Beta | N/A |
8183
| Logs | N/A | N/A |
8284

83-
This project currently lives in a **alpha status**. Our current release is not production ready; it has been created in order to receive feedback from the community. \
84-
As long as this project is in alpha status, things may and probably will break once in a while.
85-
8685
## Specification conformance
8786
We attempt to keep the [OpenTelemetry Specification Matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/master/spec-compliance-matrix.md) up to date in order to show which features are available and which have not yet been implemented.
8887

@@ -106,7 +105,11 @@ mentioned in the provided messages, since doing otherwise may break things compl
106105

107106
# Requirements
108107

109-
The library and all separate packages requires a PHP version of 7.4.x, 8.0.x or 8.1.x
108+
The library and all separate packages requires a PHP version of 7.4+
109+
110+
If you want to try out open-telemetry, you can install the entire [open-telemetry](https://packagist.org/packages/open-telemetry/opentelemetry) package, which includes the API, SDK, exporters and extensions.
111+
112+
For a production install, we recommend installing only the components that you need, for example API, SDK, and an exporter.
110113

111114
## Required dependencies
112115
### 1) Install PSR17/18 implementations
@@ -160,14 +163,14 @@ however most OS` package managers provide a package for the extension.
160163

161164
### 4) Install PHP [ext-ffi](https://www.php.net/manual/en/book.ffi.php)
162165

163-
_Experimental_ support for using fibers in PHP 8.1 for Context storage requires the `ffi` extension, and can
166+
Support for using fibers in PHP 8.1 for Context storage requires the `ffi` extension, and can
164167
be enabled by setting the `OTEL_PHP_FIBERS_ENABLED` environment variable to a truthy value (`1`, `true`, `on`).
165168

166169
Using fibers with non-`CLI` SAPIs may require preloading of bindings. One way to achieve this is setting [`ffi.preload`](https://www.php.net/manual/en/ffi.configuration.php#ini.ffi.preload) to `src/Context/fiber/zend_observer_fiber.h` and setting [`opcache.preload`](https://www.php.net/manual/en/opcache.preloading.php) to `vendor/autoload.php`.
167170

168171
### 5) Install PHP [ext-protobuf](https://pecl.php.net/package/protobuf)
169172

170-
**The PHP protobuf extension is optional when using either the `OTLPHttp` or `OTLPGrpc` exporters from the Contrib package.**
173+
**The PHP protobuf extension is recommended when using the `otlp` exporter from the Contrib package.**
171174

172175
The protobuf extension makes both exporters _significantly_ more performant, and we recommend that you do not use the PHP package in production. _Note that protobuf 3.20.0+ is required for php 8.1 support_
173176

@@ -233,11 +236,18 @@ For development and testing purposes you also want to install **SDK** and **Cont
233236
$ composer require --dev open-telemetry/sdk open-telemetry/sdk-contrib
234237
```
235238

239+
## SDK autoloading
240+
241+
If all [configuration](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#general-sdk-configuration) is provided via environment variables or `php.ini`, then an SDK can be auto-loaded.
242+
SDK autoloading must be enabled via the `OTEL_PHP_AUTOLOAD_ENABLED` setting, and will be performed as part of composer autoloading.
243+
244+
See [autoload_sdk.php example](./examples/autoload_sdk.php)
245+
236246
## Trace signals
237247

238248
### Auto-instrumentation
239249

240-
_We do not currently support auto-instrumentation, but are internally discussing how to implement it_
250+
Auto-instrumentation is available via our [otel_instrumentation](https://github.com/open-telemetry/opentelemetry-php-instrumentation) PHP extension, and there are some auto-instrumentation modules available in our [contrib repo](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation).
241251

242252
### Framework instrumentation
243253

@@ -251,9 +261,12 @@ If you wish to build your own instrumentation for your application, you will nee
251261
Tracers must be obtained from a `TracerProvider`:
252262

253263
```php
264+
$transport = (new OpenTelemetry\Contrib\Grpc\GrpcTransportFactory())->create('http://collector:4317' . OtlpUtil::method(Signals::TRACE));
265+
$exporter = new OpenTelemetry\Contrib\Otlp\SpanExporter($transport);
254266
$tracerProvider = new \OpenTelemetry\SDK\Trace\TracerProvider(
255267
new \OpenTelemetry\SDK\Trace\SpanProcessor\BatchSpanProcessor(
256-
new \OpenTelemetry\Contrib\OtlpGrpc\Exporter('otel-collector:4317')
268+
$exporter,
269+
ClockFactory::getDefault()
257270
)
258271
);
259272
\OpenTelemetry\SDK\Common\Util\ShutdownHandler::register([$tracerProvider, 'shutdown']);
@@ -320,37 +333,16 @@ Exported spans can be seen in zipkin at [http://127.0.0.1:9411](http://127.0.0.1
320333
Exported spans can also be seen in jaeger at [http://127.0.0.1:16686](http://127.0.0.1:16686)
321334

322335
## Metrics signals
323-
_coming soon_
324-
325-
### Metrics examples
326336

327-
<details>
328-
<summary>This section is deprecated, we have a new metrics implementation in development</summary>
329-
330-
You can use the [examples/prometheus/PrometheusMetricsExample.php](/examples/prometheus/PrometheusMetricsExample.php)
331-
file to test out the reference implementation we have. This example will create a counter that will be scraped by local
332-
Prometheus instance.
333-
334-
The easy way to test the example out with docker and docker-compose is:
335-
336-
1) Run `make metrics-prometheus-example`. Make sure that local ports 8080, 6379 and 9090 are available.
337-
338-
2) Open local Prometheus instance: http://localhost:9090
337+
Meters must be obtained from a `MeterProvider`
339338

340-
3) Go to Graph section, type "opentelemetry_prometheus_counter" in the search field or select it in the dropdown menu.
341-
You will see the counter value. Every other time you run `make metrics-prometheus-example` will increment the counter
342-
but remember that Prometheus scrapes values once in 10 seconds.
339+
### Metrics examples
343340

344-
4) In order to stop docker containers for this example just run `make stop-prometheus`
345-
</details>
341+
See [basic example](./examples/metrics/basic.php)
346342

347343
## Log signals
348344
_frozen pending delivery of tracing and metrics_
349345

350-
# User Quickstarts
351-
352-
* [Exploring OpenTelemetry in Laravel Applications](./docs/laravel-quickstart.md)
353-
354346
# Versioning
355347

356348
Versioning rationale can be found in the [Versioning Documentation](/docs/versioning.md)

composer.json

+2-12
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
"require": {
1010
"php": "^7.4 || ^8.0",
1111
"ext-json": "*",
12-
"cloudevents/sdk-php": "^v1.0.1",
1312
"google/protobuf": "^3.3.0",
1413
"grpc/grpc": "^1.30",
1514
"php-http/async-client-implementation": "^1.0",
1615
"php-http/discovery": "^1.14",
17-
"promphp/prometheus_client_php": "^2.2.1",
1816
"psr/http-factory-implementation": "^1.0",
1917
"psr/log": "^1.1|^2.0|^3.0",
2018
"symfony/polyfill-mbstring": "^1.23",
@@ -31,16 +29,8 @@
3129
},
3230
"authors": [
3331
{
34-
"name": "Bob Strecansky",
35-
"email": "[email protected]"
36-
},
37-
{
38-
"name": "Dmitry Krokhin",
39-
"email": "[email protected]"
40-
},
41-
{
42-
"name": "Levi Morrison",
43-
"email": "[email protected]"
32+
"name": "opentelemetry-php contributors",
33+
"homepage": "https://github.com/open-telemetry/opentelemetry-php/graphs/contributors"
4434
}
4535
],
4636
"replace": {

src/Contrib/composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"open-telemetry/sem-conv": "self.version",
2121
"php-http/async-client-implementation": "^1.0",
2222
"php-http/discovery": "^1.14",
23-
"promphp/prometheus_client_php": "^2.2.1",
2423
"psr/http-factory-implementation": "^1.0",
2524
"psr/log": "^1.1|^2.0|^3.0",
2625
"symfony/polyfill-mbstring": "^1.23",

0 commit comments

Comments
 (0)