定制 tbachert/otel-sdk-configuration 二次开发

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

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

tbachert/otel-sdk-configuration

最新稳定版本:v0.2.1

Composer 安装命令:

composer require tbachert/otel-sdk-configuration

包简介

OpenTelemetry SDK configuration

README 文档

README

Allows creation of an extensible configuration model according to the OTel file configuration specification.

Installation

composer require tbachert/otel-sdk-configuration

Additionally, you will need either ext-yaml or symfony/yaml to load configuration from yaml config files.

Usage

Parsing config

$factory = new ConfigurationFactory(
    [
        // all available providers ...
    ],
    new OpenTelemetryConfiguration(),
    new EnvSourceReader([
        new ArrayEnvSource($_SERVER),
        new PhpIniEnvSource(),
    ]),
);
$configuration = $factory->parseFile(__DIR__ . '/config.yaml');
$openTelemetry = $configuration->create(new Context());

Defining component providers

See examples for component provider examples.

Example: BatchSpanProcessor
final class SpanProcessorBatch implements ComponentProvider {

    /**
     * @param array{
     *     schedule_delay: int<0, max>,
     *     export_timeout: int<0, max>,
     *     max_queue_size: int<0, max>,
     *     max_export_batch_size: int<0, max>,
     *     exporter: ComponentPlugin<SpanExporter>,
     * } $properties
     */
    public function createPlugin(array $properties, Context $context): SpanProcessor {
        // ...
    }

    public function getConfig(ComponentProviderRegistry $registry): ArrayNodeDefinition {
        $node = new ArrayNodeDefinition('batch');
        $node
            ->children()
                ->integerNode('schedule_delay')->min(0)->defaultValue(5000)->end()
                ->integerNode('export_timeout')->min(0)->defaultValue(30000)->end()
                ->integerNode('max_queue_size')->min(0)->defaultValue(2048)->end()
                ->integerNode('max_export_batch_size')->min(0)->defaultValue(512)->end()
                ->append($registry->component('exporter', SpanExporter::class)->isRequired())
            ->end()
        ;

        return $node;
    }
}

统计信息

  • 总下载量: 376
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-03-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固