Download the PHP package waffle-commons/telemetry-otel without Composer
On this page you can find all versions of the php package waffle-commons/telemetry-otel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waffle-commons/telemetry-otel
More information about waffle-commons/telemetry-otel
Files in waffle-commons/telemetry-otel
Package telemetry-otel
Short Description OpenTelemetry SDK bridge for Waffle Commons: implements the framework TracerInterface with W3C trace-context propagation, keeping the OTel SDK out of the core perimeter.
License MIT
Informations about the package telemetry-otel
Waffle Telemetry β OpenTelemetry Bridge
Release:
0.1.0-beta6|CHANGELOG.mdRFC: RFC-005 (OBS-02) β OpenTelemetry SDK bridge
OpenTelemetry SDK bridge for the Waffle Commons framework. It implements
Waffle\Commons\Contracts\Telemetry\TracerInterface on top of the audited OpenTelemetry PHP SDK and propagates
W3C Trace Context on outbound HTTP calls β isolating the vendor SDK in this adapter so the core packages
stay vendor-free. The SDK-free defaults, the Prometheus endpoint, and the metric collectors live in the
companion waffle-commons/telemetry package.
π¦ Installation
Pulls in open-telemetry/api + open-telemetry/sdk as runtime dependencies β this package is the only
place in the Waffle ecosystem where the OTel SDK is allowed.
π§± Surface
| Class | Role |
|---|---|
Waffle\Commons\TelemetryOtel\Trace\OtelTracer |
final readonly adapter of an OTel TracerInterface to the framework's Contracts\Telemetry\TracerInterface. Activates each started span so nested spans compose through OTel's own context stack. |
Waffle\Commons\TelemetryOtel\Trace\OtelSpan |
final readonly adapter of an OTel span (plus its active ScopeInterface) to Contracts\Telemetry\SpanInterface. end() detaches the scope, then ends the span. |
Waffle\Commons\TelemetryOtel\Trace\OtelSpanContext |
final readonly adapter of an OTel span context to Contracts\Telemetry\SpanContextInterface; renders a W3C traceparent string via toTraceparent(). |
Waffle\Commons\TelemetryOtel\Propagation\W3CTraceContextPropagator |
final readonly TextMapPropagatorInterface β inject() serialises the Waffle span context as traceparent/tracestate; extract() delegates to OTel's audited TraceContextPropagator for parsing. |
Waffle\Commons\TelemetryOtel\Factory\OtelTracerFactory |
Static factory assembling a ready-to-use OtelTracer from any SpanExporterInterface, or console() for a zero-dependency JSON exporter to php://stdout. |
π Usage
Registered as shared services, $tracer and $propagator are consumed unmodified by
waffle-commons/telemetry's TracingMiddleware (per-request server span + inbound traceparent extraction)
and by waffle-commons/http-client's Client (outbound traceparent propagation) β one end-to-end trace
across both directions of a request, with zero code in either package aware that OpenTelemetry exists.
π Span-kind mapping
OtelTracer::startSpan() translates the framework's Contracts\Telemetry\Enum\SpanKind 1:1 onto the OTel
API's SpanKind constants:
Contracts\Telemetry\Enum\SpanKind |
OTel SpanKind |
|---|---|
Internal |
KIND_INTERNAL |
Server |
KIND_SERVER |
Client |
KIND_CLIENT |
Producer |
KIND_PRODUCER |
Consumer |
KIND_CONSUMER |
When an explicit $parent span context is supplied β typically one extracted from an inbound traceparent
by W3CTraceContextPropagator::extract() β the new span continues that remote trace via
OtelApiSpanContext::createFromRemoteParent(); otherwise it parents off OTel's own active context, so nested
startSpan() calls compose naturally without threading a context object through every call site.
π PHP 8.5 features used
final readonly classon every adapter (OtelTracer,OtelSpan,OtelSpanContext,W3CTraceContextPropagator) β each wraps an injected SDK object and mutates nothing of its own.#[\Override]on every interface implementation.matchexpressions for theSpanKindβ OTel-kind andSpanStatusβ OTel-status translations.- Static factory methods (
OtelTracerFactory::create()/::console()) instead of a constructor, since the class assembles aTracerProviderrather than holding state.
π§ Perimeter
The only Waffle package permitted to require the OpenTelemetry SDK (open-telemetry/*) β mago guard's
[guard.perimeter] in mago.toml allows the OpenTelemetry\** namespace here and nowhere
else in the ecosystem. Otherwise depends only on waffle-commons/contracts; production code under
Waffle\Commons\TelemetryOtel may depend only on itself, Contracts\**, the OTel SDK, Psr\**, and PHP core
/ Psl\**. Test code under WaffleTests\Commons\TelemetryOtel is unrestricted (@all).
Contract-first, component-agnostic by construction: components compose through waffle-commons/contracts,
never directly through one another.
π§΅ Worker safety
Every adapter (OtelTracer, OtelSpan, OtelSpanContext, W3CTraceContextPropagator) is final readonly
and holds no per-request mutable state of its own β the OpenTelemetry SDK owns the active-context stack
internally, and a SimpleSpanProcessor exports each span synchronously on end() so nothing is buffered
across requests waiting on a background flush. There is nothing here for a FrankenPHP worker to leak between
requests (wfl igor 0 KO).
π§ͺ Testing
π Documentation
Central framework docs (DiΓ‘taxis) for this component:
- Reference:
reference/telemetry-otel.md - Explanation:
explanation/observability-telemetry.md - Full documentation tree: waffle-commons/documentation
π License
MIT β see LICENSE.md.
All versions of telemetry-otel with dependencies
waffle-commons/contracts Version self.version
open-telemetry/api Version ^1.0
open-telemetry/sdk Version ^1.0
symfony/http-client Version ^8.1
nyholm/psr7 Version ^1.8