-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
56 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 |
---|---|---|
@@ -1,66 +1,25 @@ | ||
# OpenTelemetry CodeIgniter auto-instrumentation | ||
|
||
**Warning**: this is experimental, use at your own risk | ||
[![Releases](https://img.shields.io/badge/releases-purple)](https://github.com/opentelemetry-php/contrib-auto-codeigniter/releases) | ||
[![Issues](https://img.shields.io/badge/issues-pink)](https://github.com/open-telemetry/opentelemetry-php/issues) | ||
[![Source](https://img.shields.io/badge/source-contrib-green)](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation/CodeIgniter) | ||
[![Mirror](https://img.shields.io/badge/mirror-opentelemetry--php--contrib-blue)](https://github.com/opentelemetry-php/contrib-auto-codeigniter) | ||
[![Latest Version](http://poser.pugx.org/open-telemetry/opentelemetry-auto-codeigniter/v/unstable)](https://packagist.org/packages/open-telemetry/opentelemetry-auto-codeigniter/) | ||
[![Stable](http://poser.pugx.org/open-telemetry/opentelemetry-auto-codeigniter/v/stable)](https://packagist.org/packages/open-telemetry/opentelemetry-auto-codeigniter/) | ||
|
||
**Preferred and simplest way to install auto-instrumentation (c extension plus instrumentation libraries) is to use [opentelemetry-instrumentation-installer](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/AutoInstrumentationInstaller).** | ||
**The same process can be done manually by installing [c extension](https://github.com/open-telemetry/opentelemetry-php-instrumentation#installation) plus all needed instrumentation libraries like [CodeIgniter](#Installation-via-composer)** | ||
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib. | ||
|
||
## Requirements | ||
# OpenTelemetry CodeIgniter auto-instrumentation | ||
|
||
* [OpenTelemetry extension](https://opentelemetry.io/docs/instrumentation/php/automatic/#installation) | ||
* OpenTelemetry SDK exporter (required to actually export traces) | ||
* CodeIgniter 4.0+ installation | ||
Please read https://opentelemetry.io/docs/instrumentation/php/automatic/ for instructions on how to | ||
install and configure the extension and SDK. | ||
|
||
## Overview | ||
|
||
Currently only root span creation is supported (`CodeIgniter\CodeIgniter::handleRequest` hook). | ||
|
||
To export spans, you will need to create and register a `TracerProvider` early in your application's | ||
lifecycle. This can be done either manually or using SDK autoloading. | ||
|
||
### Using SDK autoloading | ||
|
||
See https://github.com/open-telemetry/opentelemetry-php#sdk-autoloading | ||
|
||
### Manual setup | ||
|
||
```php | ||
<?php | ||
require_once 'vendor/autoload.php'; | ||
|
||
$tracerProvider = /*create tracer provider*/; | ||
$scope = \OpenTelemetry\API\Instrumentation\Configurator::create() | ||
->withTracerProvider($tracerProvider) | ||
->activate(); | ||
|
||
//your application runs here | ||
|
||
$scope->detach(); | ||
$tracerProvider->shutdown(); | ||
``` | ||
|
||
## Installation via composer | ||
|
||
```bash | ||
$ composer require open-telemetry/opentelemetry-auto-codeigniter | ||
``` | ||
|
||
## Installing dependencies and executing tests | ||
|
||
From CodeIgniter subdirectory: | ||
|
||
```bash | ||
$ composer install | ||
$ ./vendor/bin/phpunit tests | ||
``` | ||
Requires CodeIgniter 4.0+ | ||
|
||
## Configuration | ||
|
||
Parts of this auto-instrumentation library can be configured, more options are available throught the | ||
[General SDK Configuration](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#general-sdk-configuration): | ||
The extension can be disabled via [runtime configuration](https://opentelemetry.io/docs/instrumentation/php/sdk/#configuration): | ||
|
||
| Name | Default value | Values | Example | Description | | ||
|-------------------------------------|---------------|-------------------------|-------------|---------------------------------------------------------------------------------| | ||
| OTEL_PHP_DISABLED_INSTRUMENTATIONS | [] | Instrumentation name(s) | codeigniter | Disable one or more installed auto-instrumentations, names are comma seperated. | | ||
|
||
Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`) | ||
```shell | ||
OTEL_PHP_DISABLED_INSTRUMENTATIONS=codeigniter | ||
``` |