Skip to content

Commit

Permalink
update codeigniter readme (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
brettmc authored Oct 18, 2023
1 parent 664b278 commit 2439ee9
Showing 1 changed file with 15 additions and 56 deletions.
71 changes: 15 additions & 56 deletions src/Instrumentation/CodeIgniter/README.md
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
```

0 comments on commit 2439ee9

Please sign in to comment.