open-telemetry/opentelemetry-auto-psr3 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

open-telemetry/opentelemetry-auto-psr3

最新稳定版本:0.1.1

Composer 安装命令:

composer require open-telemetry/opentelemetry-auto-psr3

包简介

OpenTelemetry auto-instrumentation for PSR-3 (Logger Interface).

README 文档

README

Releases Issues Source Mirror Latest Version Stable

This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.

OpenTelemetry PSR-3 auto-instrumentation

Please read https://opentelemetry.io/docs/instrumentation/php/automatic/ for instructions on how to install and configure the extension and SDK.

Overview

Auto-instrumentation hooks are registered via composer, and depending on the mode, will:

  • automatically inject trace id and span id into log message context of any psr3 logger; or
  • transform the message into the OpenTelemetry LogRecord format, for export to an OpenTelemetry logging-compatible backend

Mode

The package can operate in two modes, controlled by the environment variable OTEL_PHP_PSR3_MODE:

inject

Inject traceId and spanId of the active trace span into the context of each logged message. Depending on the PSR-3 implementation, the values may be written to the log output, or may be available for interpolation into the log message.

For example:

putenv('OTEL_PHP_PSR3_MODE=inject');
require 'vendor/autoload.php';

$logger = /* create logger */
$logger->info('traceId={traceId} spanId={spanId}');

export

The logged output will be processed and emitted by the logger as normal, but the output will also be encoded using the OpenTelemetry log model and can be exported to an OpenTelemetry-compatible backend.

putenv('OTEL_PHP_PSR3_MODE=export');
putenv('OTEL_PHP_AUTOLOAD_ENABLED=true');
putenv('OTEL_LOGS_EXPORTER=console');
require 'vendor/autoload.php';

$logger = /* create logger */
$logger->info('Hello, OTEL');

Configuration

The extension can be disabled via runtime configuration:

OTEL_PHP_DISABLED_INSTRUMENTATIONS=psr3

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2023-06-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固