Skip to content

feat(otel): optional OpenTelemetry tracing (ADR-0025)#2

Merged
muhammetsafak merged 1 commit into
mainfrom
feat/otel
Jun 19, 2026
Merged

feat(otel): optional OpenTelemetry tracing (ADR-0025)#2
muhammetsafak merged 1 commit into
mainfrom
feat/otel

Conversation

@muhammetsafak

Copy link
Copy Markdown
Member

The PHP mirror of babelqueue-go/otel / babelqueue.otel / @babelqueue/core/otel (ADR-0025): optional OpenTelemetry tracing as a new BabelQueue\Otel\Tracing, with open-telemetry/api as an optional suggest dependency — so the core stays dependency-light (GR-7).

What

  • traceIdOf/uuidOftrace_id (a UUID) ↔ 32-hex OTel TraceId (otherwise SHA-256). The already-propagated trace_id becomes the shared OTel trace across every hop/SDK — no envelope change (GR-1).
  • Tracing::wrap($tracer, $handler) — a CONSUMER span process <urn> in the trace_id-derived trace, with messaging-semconv attributes + error recording. Mirrors the SchemaValidated::wrap / Idempotent::wrap shape and composes with the ack-on-return / redeliver-on-throw contract.
  • Tracing::publish($tracer, $transport, $urn, $data) — a PRODUCER span publish <urn> that builds the envelope with the active trace's id as trace_id, encodes and publishes through the Transport.

Tests / gates

  • tests/Otel/TracingTest.php (7 tests) against the OTel SDK in-memory exporter. Full suite: 160 tests green; PHPStan level 9 clean. open-telemetry/api + open-telemetry/sdk added to require-dev; open-telemetry/api to suggest.

Honest limit

One correlated trace per trace_id; exact cross-hop span parent-child (W3C traceparent as a transport header) is the documented follow-up.

🤖 Generated with Claude Code

Mirrors the Go/Python/Node otel modules: a new BabelQueue\Otel\Tracing (open-telemetry/api is an optional 'suggest' dependency, so the core stays dependency-light) emitting produce/consume spans correlated across hops via trace_id<->32-hex OTel TraceId. Tracing::wrap (consumer span, mirroring SchemaValidated/Idempotent::wrap) + Tracing::publish (producer span). Envelope untouched (GR-1); opt-in. phpunit 160 green; phpstan level 9 clean.
@muhammetsafak muhammetsafak merged commit caa705a into main Jun 19, 2026
9 checks passed
@muhammetsafak muhammetsafak deleted the feat/otel branch June 19, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant