定制 websupport/yii-opentracing 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

websupport/yii-opentracing

最新稳定版本:0.4.0

Composer 安装命令:

composer require websupport/yii-opentracing

包简介

OpenTracing component for Yii

README 文档

README

Code Climate coverage Code Climate maintainability Travis

Yii OpenTracing extension

OpenTracing extension for Yii 1

Installation

Install Yii extension with composer

composer require websupport/yii-opentracing

Install client library (depends on your tracing system)

composer require jonahgeorge/jaeger-client-php

Configuration

Default (NoopTracer) configuration without client library

    # opentracing component must be preloaded
    'preload' => ['opentracing'],
    ...
    'components' => [
        'opentracing' => [
            'class' => \Websupport\OpenTracing\OpenTracing::class,
        ],
    ],

Jaeger client configuration

    # 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

use Websupport\OpenTracing\OpenTracingActiveRecordBehavior;

class Model extends CActiveRecord
{
    public function behaviors()
    {
        return [
            'OpenTracingActiveRecordBehavior' => [
                'class' => OpenTracingActiveRecordBehavior::class,
                'opentracingId' => 'opentracing' // string opentracing component name
            ]
        ];
    }
}

Sentry integration

If you are using Sentry to track errors and want to store Sentry Event ID within current trace, you can achieve this in conjunction with websupport/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.

    '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
            ...
        ]
    ],

统计信息

  • 总下载量: 18.51k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 10
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-02-12