Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/websupport-sk/yii-opentracing
OpenTracing extension for Yii 1
https://github.com/websupport-sk/yii-opentracing
jaeger opentracing yii yii-extension
Last synced: about 1 month ago
JSON representation
OpenTracing extension for Yii 1
- Host: GitHub
- URL: https://github.com/websupport-sk/yii-opentracing
- Owner: websupport-sk
- License: bsd-3-clause
- Created: 2019-02-11T13:09:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-24T16:04:59.000Z (almost 4 years ago)
- Last Synced: 2024-11-01T20:45:43.331Z (about 2 months ago)
- Topics: jaeger, opentracing, yii, yii-extension
- Language: PHP
- Homepage:
- Size: 38.1 KB
- Stars: 2
- Watchers: 12
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Code Climate coverage](https://img.shields.io/codeclimate/coverage/websupport-sk/yii-opentracing.svg)](https://codeclimate.com/github/websupport-sk/yii-opentracing)
[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/websupport-sk/yii-opentracing.svg)](https://codeclimate.com/github/websupport-sk/yii-opentracing)
[![Travis](https://img.shields.io/travis/com/websupport-sk/yii-opentracing.svg)](https://travis-ci.com/websupport-sk/yii-opentracing)# Yii OpenTracing extension
OpenTracing extension for Yii 1
## Installation
Install Yii extension with composer
```bash
composer require websupport/yii-opentracing
```Install client library (depends on your tracing system)
```bash
composer require jonahgeorge/jaeger-client-php
```## Configuration
Default (NoopTracer) configuration without client library
```php
# opentracing component must be preloaded
'preload' => ['opentracing'],
...
'components' => [
'opentracing' => [
'class' => \Websupport\OpenTracing\OpenTracing::class,
],
],
```Jaeger client configuration
```php
# opentracing component must be preloaded
'preload' => ['opentracing'],
...
'components' => [
'opentracing' => [
'class' => \Websupport\OpenTracing\JaegerOpenTracing::class,
'agentHost' => 'localhost',
'agentPort' => 5775,
'sampler' => [
'type' => \Jaeger\SAMPLER_TYPE_CONST,
'param' => true,
],
'traceIdHeader' => 'x-trace-id',
'baggageHeaderPrefix' => 'x-ctx-trace-',
],
],
```### OpenTracing in `CActiveRecord`
OpenTracing can be enabled in `CActiveRecord` using `behaviors`.
```php
[
'class' => OpenTracingActiveRecordBehavior::class,
'opentracingId' => 'opentracing' // string opentracing component name
]
];
}
}
```### Sentry integration
If you are using [Sentry](https://sentry.io) to track errors and want to store Sentry Event ID within current trace,
you can achieve this in conjunction with [websupport/yii-sentry](https://github.com/websupport-sk/yii-sentry) component.After installing and configuring this component, each trace, where any error occurred will have its `error.sentry_id` tag filled with Sentry Event ID.
```php
'components' => [
'opentracing' => [
'class' => \Websupport\OpenTracing\JaegerOpenTracing::class,
'sentryId' => 'sentry' // or name of your yii-sentry component
...
],
'sentry' => [ // yii-sentry component
'class' => \Websupport\YiiSentry\Client::class
...
]
],
```