Skip to content

Commit ac95256

Browse files
authored
Add package information to README (#719)
1 parent 6b80fd1 commit ac95256

File tree

1 file changed

+72
-19
lines changed

1 file changed

+72
-19
lines changed

README.md

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,34 @@
33
![CI Build](https://github.com/open-telemetry/opentelemetry-php/workflows/PHP%20QA/badge.svg)
44
[![codecov](https://codecov.io/gh/open-telemetry/opentelemetry-php/branch/master/graph/badge.svg)](https://codecov.io/gh/open-telemetry/opentelemetry-php)
55

6+
This is the **[monorepo](https://en.wikipedia.org/wiki/Monorepo)** for the **main** components of **[OpenTelemetry](https://opentelemetry.io/) PHP**.
7+
The main library is distributed as a complete package: [open-telemetry/opentelemetry](https://packagist.org/packages/open-telemetry/opentelemetry)
8+
as well as each component as a separate package. These packages are:
9+
10+
- API: [open-telemetry/api](https://packagist.org/packages/open-telemetry/api)
11+
- SDK: [open-telemetry/sdk](https://packagist.org/packages/open-telemetry/sdk)
12+
- Semantic Conventions: [open-telemetry/sem-conv](https://packagist.org/packages/open-telemetry/sem-conv)
13+
- Context: [open-telemetry/context](https://packagist.org/packages/open-telemetry/context)
14+
- Contrib: [open-telemetry/sdk-contrib](https://packagist.org/packages/open-telemetry/sdk-contrib)
15+
16+
---
17+
This repository also hosts and distributes generated client code used by individual components as separate packages. These packages are:
18+
- Generated [OTLP](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md) ProtoBuf files:
19+
[open-telemetry/gen-otlp-protobuf](https://packagist.org/packages/open-telemetry/gen-otlp-protobuf)
20+
- Generated [Jaeger](https://github.com/jaegertracing/jaeger-idl) Thrift files:
21+
[open-telemetry/gen-jaeger-thrift](https://packagist.org/packages/open-telemetry/gen-jaeger-thrift)
22+
23+
For now the generated code packages are meant to be only used by library components internally.
24+
25+
---
26+
27+
The [OpenTelemetry PHP Contrib repository](https://github.com/open-telemetry/opentelemetry-php-contrib/) hosts contributions that are not part of the core
28+
distribution or components of the library. Typically, these contributions are vendor specific receivers/exporters and/or
29+
components that are only useful to a relatively small number of users.
30+
31+
Additional packages, demos and tools are hosted or distributed in the [OpenTelemetry PHP organization](https://github.com/opentelemetry-php).
32+
33+
---
634
## Current Project Status
735
![Current Version](https://img.shields.io/github/v/tag/open-telemetry/opentelemetry-php)
836

@@ -23,13 +51,6 @@ mentioned in the provided messages, since doing otherwise may break things compl
2351

2452
---
2553

26-
There is a supplemental repository for OpenTelemetry PHP contributions that are not part of the core
27-
distribution of the library. Typically, these contributions are vendor specific receivers/exporters and/or
28-
components that are only useful to a relatively small number of users. This repository can be found
29-
[here.](https://github.com/open-telemetry/opentelemetry-php-contrib/)
30-
31-
---
32-
3354
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.
3455

3556
If you find an inconsistency in the data in the matrix vs. the data in this repository, please let us know in our slack channel and we'll get it rectified.
@@ -46,7 +67,7 @@ A Google calendar invite with the included zoom link can be found [here](https:/
4667
Our open issues can all be found in the [GitHub issues tab](https://github.com/open-telemetry/opentelemetry-php/issues). Feel free to reach out on Slack if you have any additional questions about these issues; we are always happy to talk through implementation details.
4768

4869
## Requirements
49-
The library requires a PHP version of 7.4.x, 8.0.x or 8.1.x
70+
The library and all separate packages requires a PHP version of 7.4.x, 8.0.x or 8.1.x
5071

5172
### Dependencies
5273

@@ -55,7 +76,7 @@ The library requires a PHP version of 7.4.x, 8.0.x or 8.1.x
5576
#### REQUIRED DEPENDENCIES
5677
#### 1) Install PSR17/18 implementations
5778

58-
The library has a dependency on both a [HTTP Factories (PSR17)](https://www.php-fig.org/psr/psr-17/)
79+
The **SDK** and **Contrib** packages have a dependency on both a [HTTP Factories (PSR17)](https://www.php-fig.org/psr/psr-17/)
5980
and a [php-http/async-client](https://docs.php-http.org/en/latest/clients.html) implementation.
6081
You can find appropriate composer packages implementing given standards on [packagist.org](https://packagist.org/).
6182
Follow [this link](https://packagist.org/providers/psr/http-factory-implementation) to find a `PSR17 (HTTP factories)` implementation,
@@ -67,7 +88,7 @@ and [this link](https://packagist.org/providers/php-http/async-client-implementa
6788

6889
#### 1) Install PHP [ext-grpc](https://pecl.php.net/package/gRPC)
6990

70-
**The PHP gRPC extension is only needed, if you want to use the OTLP GRPC Exporter.**
91+
**The PHP gRPC extension is only needed, if you want to use the OTLP GRPC Exporter from the Contrib package.**
7192

7293
Three ways to install the gRPC extension are described below. Keep in mind, that whatever way
7394
to install the extension you choose, the compilation can take up to 10-15 minutes. (As an alternative you can search for
@@ -92,7 +113,7 @@ provides a package for the extension)
92113
93114
#### 2) Install PHP [ext-mbstring](https://www.php.net/manual/en/book.mbstring.php)
94115

95-
The library will load the `symfony/polyfill-mbstring` package, but for better performance you should install
116+
The library's components will load the `symfony/polyfill-mbstring` package, but for better performance you should install
96117
the PHP mbstring extension. You can use the same install methods as described for the gRPC extension above,
97118
however most OS` package managers provide a package for the extension.
98119

@@ -111,31 +132,63 @@ Using fibers with non-`CLI` SAPIs may require preloading of bindings. One way to
111132

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

114-
**The PHP protobuf extension is optional when using either the `OTLPHttp` or `OTLPGrpc` exporters.**
135+
**The PHP protobuf extension is optional when using either the `OTLPHttp` or `OTLPGrpc` exporters from the Contrib package.**
115136

116137
The protobuf extension makes both exporters more performant. _Note that protobuf 3.20.0+ is required for php 8.1 support_
117138

118139
---
119140

120141
## Installation
121-
The recommended way to install the library is through [Composer](http://getcomposer.org):
142+
The recommended way to install the library's packages is through [Composer](http://getcomposer.org):
122143

123-
1) Install the composer package using [Composer's installation instructions](https://getcomposer.org/doc/00-intromd#installation-linux-unix-macos).
124-
125-
126-
2) Add
144+
Install Composer using the [installation instructions](https://getcomposer.org/doc/00-intromd#installation-linux-unix-macos) and add
127145
```bash
128146
"minimum-stability": "dev"
129147
```
130148

131-
To your project's `composer.json` file, as this utility has not reached a stable release status yet.
149+
To your project's `composer.json` file, as this library has not reached a stable release status yet.
132150

133-
3) Install the dependency with composer:
151+
### Getting Started with OpenTelemetry
152+
153+
To install the complete library with all packages you can run:
134154

135155
```bash
136156
$ composer require open-telemetry/opentelemetry
137157
```
158+
This is perfect for trying out our examples or demos.
159+
160+
### Using OpenTelemetry in an Application
161+
162+
Your application should only depend on Interfaces provided by the API package:
163+
164+
```bash
165+
$ composer require open-telemetry/api
166+
```
167+
In the best case you will use [Dependency Inversion](https://en.wikipedia.org/wiki/Dependency_inversion_principle) and write an adapter to not depend on the API directly.
168+
169+
Make sure your application works with a dependency on the API only, however to make really use of the library you want to install the **SDK** package and probably the **Contrib** package as well:
138170

171+
```bash
172+
$ composer require open-telemetry/sdk
173+
```
174+
or
175+
```bash
176+
$ composer require open-telemetry/sdk open-telemetry/sdk-contrib
177+
```
178+
Make sure any **SDK** or **Contrib** code is set up by your configuration, bootstrap, dependency injection, etc.
179+
180+
### Using OpenTelemetry to instrument a Library
181+
182+
Your library should only depend on Interfaces provided by the API package:
183+
184+
```bash
185+
$ composer require open-telemetry/api
186+
```
187+
188+
For development and testing purposes you also want to install **SDK** and **Contrib** packages:
189+
```bash
190+
$ composer require --dev open-telemetry/sdk open-telemetry/sdk-contrib
191+
```
139192
## Development
140193
For repeatability and consistency across different operating systems, we use the [3 Musketeers pattern](https://3musketeers.io/). If you're on Windows, it might be a good idea to use Git bash for following the steps below.
141194

0 commit comments

Comments
 (0)