MiddlewareSpanDecorator
Wraps a single pipeline middleware in a child span named by its FQCN.
Reproduces, as real spans, what TraceMiddleware already records as a flat name list.
High cardinality/overhead — opt-in only via telemetry.spans.middleware (default false). MiddlewarePipeline::doBuild() only constructs this decorator at all when that setting is on, so a disabled pipeline pays zero cost for this feature, not even an extra object per middleware.
Synopsis
Section titled “Synopsis”final class MiddlewareSpanDecorator implements MiddlewareInterface
| Implements | MiddlewareInterface |
| Source | Telemetry/MiddlewareSpanDecorator.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(MiddlewareInterface $inner, string $label): mixed
| Parameter | Type | Description |
|---|---|---|
$inner | MiddlewareInterface | |
$label | string |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface | Runs the wrapped middleware inside a Quiote.Middleware span named after it. |
process()
Section titled “process()”public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
Runs the wrapped middleware inside a Quiote.Middleware span named after it.
The span is ended in a finally block, so it closes on both the normal and the exceptional path. A throwable is recorded on the span and its status set to error before being rethrown unchanged — this decorator never swallows a failure.
| Parameter | Type | Description |
|---|---|---|
$request | ServerRequestInterface | |
$handler | RequestHandlerInterface |
Returns ResponseInterface