定制 open-telemetry/opentelemetry-auto-ext-rdkafka 二次开发

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

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

open-telemetry/opentelemetry-auto-ext-rdkafka

最新稳定版本:0.0.3

Composer 安装命令:

composer require open-telemetry/opentelemetry-auto-ext-rdkafka

包简介

OpenTelemetry auto-instrumentation for ext-rdkafka Kafka Client

README 文档

README

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

OpenTelemetry ext-rdkafka 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. There will be a new span created for each message that is consumed. The goal of this instrumentation is to allow distributed traces to happen across Kafka in PHP. This means that the following should happen:

  • A span should be created for each message that is consumed
  • The span should be created with the correct parent context- should the inbound message contain a traceparent header
  • The span should be ended when the message offset is committed
  • Any messages produced should have the traceparent header injected into the message headers

This is done by hooking into three methods:

  • \RdKafka\KafkaConsumer::consume- For span creation and context propagation on inbound messages.
  • \RdKafka\ProducerTopic::producev- For injecting the traceparent header into the message headers of produced messages.
    • Note there is an old method called produce. This does not support headers, and thus there was no point hooking into this
  • \RdKafka\KafkaConsumer::commit / \RdKafka\KafkaConsumer::commitAsync - For ending the span when the message offset is committed.

Versions

  • Tested on PHP 8.2 and 8.3 with success

Configuration

The extension can be disabled via runtime configuration:

OTEL_PHP_DISABLED_INSTRUMENTATIONS=ext-rdkafka

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-07-24