Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update codeigniter readme #202

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```
Loading