Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/opentelemetry-php/contrib-auto-ext-rdkafka
[READONLY] OpenTelemetry RdKarka instrumentation
https://github.com/opentelemetry-php/contrib-auto-ext-rdkafka
Last synced: about 1 month ago
JSON representation
[READONLY] OpenTelemetry RdKarka instrumentation
- Host: GitHub
- URL: https://github.com/opentelemetry-php/contrib-auto-ext-rdkafka
- Owner: opentelemetry-php
- Created: 2024-07-24T00:58:39.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-24T01:02:10.000Z (5 months ago)
- Last Synced: 2024-11-14T16:49:58.011Z (about 2 months ago)
- Language: PHP
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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 headersThis 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](https://opentelemetry.io/docs/instrumentation/php/sdk/#configuration):```shell
OTEL_PHP_DISABLED_INSTRUMENTATIONS=ext-rdkafka
```