The OpenTelemetry PHP Library
Go to file
wRLSS c9ea3bd4a7
Only sampled spans should be exported (#145)
* Only sampled spans should be exported
https://github.com/open-telemetry/opentelemetry-php/issues/140

* BatchSpanProcessor should flush by time limit even if Span is not sampled
2020-07-09 08:45:25 -04:00
.github Github Actions Workflow (#143) 2020-07-06 08:07:54 -04:00
.phan inject external http client on exporters (#134) 2020-06-30 08:43:48 -04:00
Context Add `context` data structures. (#111) 2020-06-10 13:39:35 -04:00
api/Trace Only sampled spans should be exported (#145) 2020-07-09 08:45:25 -04:00
contrib inject external http client on exporters (#134) 2020-06-30 08:43:48 -04:00
docker Change to timestamps and weave the hrtime web (#83) 2020-05-22 20:10:27 -04:00
examples split Trace SDK in sub-namespaces and create new area for contrib (#97) 2020-06-17 11:24:08 -04:00
sdk Only sampled spans should be exported (#145) 2020-07-09 08:45:25 -04:00
tests Only sampled spans should be exported (#145) 2020-07-09 08:45:25 -04:00
.dockerignore interfaces improvements (#36) 2019-12-23 13:07:20 -05:00
.gitignore Remove the composer.lock file (#51) 2020-01-26 20:43:04 -05:00
.php_cs More style (#54) 2020-01-27 21:44:47 -05:00
.phpcs.xml TracerFactory implementation (#38) 2020-01-07 08:39:14 -05:00
.scrutinizer.yml add scrutinizer config (#40) 2020-01-07 08:39:25 -05:00
CODEOWNERS Adding Codeowners (#74) 2020-04-05 19:08:46 -04:00
CONTRIBUTING.md Small typos in the approver/maintainer links (#110) 2020-05-29 16:00:54 -04:00
LICENSE Initial commit 2019-09-27 11:08:24 -07:00
Makefile Test revamp (#90) 2020-05-15 16:27:54 -04:00
README.md Change to timestamps and weave the hrtime web (#83) 2020-05-22 20:10:27 -04:00
code-of-conduct.md Adding Code of Conduct (#123) 2020-06-06 11:24:02 -04:00
composer.json update phan to 3.x (#136) 2020-07-01 10:59:13 -04:00
docker-compose.yaml Jaeger exporter (#70) 2020-04-05 16:05:52 -04:00
phpunit.xml.dist split Trace SDK in sub-namespaces and create new area for contrib (#97) 2020-06-17 11:24:08 -04:00

README.md

OpenTelemetry php library

Gitter Build Status codecov

Communication

Most of our communication is done on gitter.im in the opentelemetry-php channel.

Our meetings are held weekly on zoom on Wednesdays at 10:30am PST / 1:30pm EST.
A Google calendar invite with the included zoom link can be found here

Our open issues can all be found in the github issues tab. Feel free to reach out in gitter if you have any additional questions about these issues; we are always happy to talk through implementation details.

Installation

The recommended way to install the library is through Composer:

1.) You'll need to add a

 "minimum-stability": "dev"

To your project's composer.json file, as this utility has not reached a stable release status quite yet.

2.) Install the dependency with composer:

$ composer require open-telemetry/opentelemetry

Development

We use docker and docker-compose to perform a lot of our static analysis and testing.

If you're planning to develop for this library, it'll help to install docker engine and docker-compose.
You can find installation instructions for these packages can be found here, under the Docker Engine and Docker Compose submenus respectively.

Styling

We use PHP-CS-Fixer for our code linting and standards fixer. The associated configuration for this standards fixer can be found in the root of the repository here

To ensure that your code is stylish, you can execute make style from your bash compatible shell. This process will print out the fixes that it is making to your associated files. Usually this process is performed as part of a code checkin. This process runs during CI and is a required check. Code that doesn't follow this style pattern will emit a failure in CI.

Static Analysis

We use Phan for static analysis. Currently our phan configuration is just a standard default analysis configuration. You can use our phan docker wrapper to easily perform static analysis on your changes.

Execute make phan from your bash compatible shell. This process will return 0 on success. Usually this process is performed as part of a code checkin. This process runs during CI and is a required check. Code that doesn't match the standards that we have defined in our phan config will emit a failure in CI.

Testing

To make sure the tests in this repo work as you expect, you can use the included docker test wrapper.
Execute make test from your bash compatible shell. This will output the test output as well as a test coverage analysis. Code that doesn't pass our currently defined tests will emit a failure in CI

Examples

You can use the examples/AlwaysSampleTraceExample.php file to test out the reference implementation we have. This example perfoms a sample trace with a grouping of 5 spans and POSTs the result to a local zipkin instance.

The PHP should execute by itself (if you have a zipkin instance running on localhost), but if you'd like a no-fuss way to test this out with docker and docker-compose, you can perform the following simple steps:

1.) Install the necessary dependencies by running make install. This will install the composer dependencies and store them in /vendor
2.) Execute the example trace using make examples.

Exported spans can be seen in zipkin at http://127.0.0.1:9411

Exported spans can also be seen in jaeger at http://127.0.0.1:16686