class HttpServerInstrumentation extends AbstractInstrumentation

Constants

protected DURATION_BOUNDARIES

protected ACTIVE_REQUESTS_METRIC

Properties

protected InstrumentationOptions $options from  AbstractInstrumentation
protected array<string, true> $knownMethods
protected array<string, true> $excludedMethods
protected list<string> $excludedPaths
protected bool $userContext
protected bool $userContextOnly
protected TracerInterface|null $tracer
protected HistogramInterface|null $duration
protected UpDownCounterInterface|null $activeRequests
protected HttpTelemetryAttributes $httpAttributes

Methods

void
register(array $options)

Register the instrumentation with normalized options.

void
registerInstrumentation()

Register HTTP server listeners and instruments.

bool
tracesEnabled()

Determine whether trace output is enabled.

bool
metricEnabled(string $name)

Determine whether a metric is enabled.

bool
isDirectCancellation(Throwable|null $exception)

Determine whether the throwable is a direct coroutine cancellation.

string
schemaUrl()

Return the semantic conventions schema URL for Hypervel instrumentation scopes.

array
indexObservers(array $names, array $observers)

Index callback observers by their matching instrument name.

__construct(Dispatcher $events, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, TextMapPropagatorInterface $propagator, ResponsePropagatorInterface $responsePropagator, HeaderBagGetter $headerGetter, ResponseHeadersSetter $responseSetter, ClockInterface $clock, LogContextScopeFactory $logContextScopes, UserContextResolver $userContexts)

Create HTTP server instrumentation.

void
requestReceived(RequestReceived $event)

Start telemetry for an accepted request.

void
requestHandled(RequestHandled $event)

Inject configured response propagation before transport send.

void
complete(Request|null $request, Response|null $response, Throwable|null $exception)

Complete telemetry at the response transport boundary, or where cancellation stopped the request.

array
methodAttributes(Request $request)

Return normalized method attributes for a server request.

array
activeRequestAttributes(Request $request, array $methodAttributes)

Return attributes available when request processing starts.

array
requestTraceAttributes(Request $request, array $methodAttributes)

Return recording-only request attributes.

array
completionAttributes(Request $request, array $startAttributes, int|null $statusCode, string|null $errorType)

Return attributes available when request processing completes.

array
responseTraceAttributes(Response $response)

Return recording-only response attributes.

Throwable|null
responseException(Response|null $response)

Return the application exception retained by a Hypervel response.

Details

final void register(array $options)

Register the instrumentation with normalized options.

Parameters

array $options

Return Value

void

at line 108
protected void registerInstrumentation()

Register HTTP server listeners and instruments.

Return Value

void

protected bool tracesEnabled()

Determine whether trace output is enabled.

Return Value

bool

protected bool metricEnabled(string $name)

Determine whether a metric is enabled.

Parameters

string $name

Return Value

bool

protected bool isDirectCancellation(Throwable|null $exception)

Determine whether the throwable is a direct coroutine cancellation.

Ending an operation by direct cancellation is control flow, not a failure.

Parameters

Throwable|null $exception

Return Value

bool

protected string schemaUrl()

Return the semantic conventions schema URL for Hypervel instrumentation scopes.

Every tracer, meter and logger obtained for one scope must pass the same URL.

Return Value

string

protected array indexObservers(array $names, array $observers)

Index callback observers by their matching instrument name.

The SDK supplies observers in the same order as the instruments passed to batchObserve(), so the unchanged name order is the mapping contract.

Parameters

array $names
array $observers

Return Value

array

at line 91
__construct(Dispatcher $events, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, TextMapPropagatorInterface $propagator, ResponsePropagatorInterface $responsePropagator, HeaderBagGetter $headerGetter, ResponseHeadersSetter $responseSetter, ClockInterface $clock, LogContextScopeFactory $logContextScopes, UserContextResolver $userContexts)

Create HTTP server instrumentation.

Parameters

Dispatcher $events
TracerProviderInterface $tracerProvider
MeterProviderInterface $meterProvider
TextMapPropagatorInterface $propagator
ResponsePropagatorInterface $responsePropagator
HeaderBagGetter $headerGetter
ResponseHeadersSetter $responseSetter
ClockInterface $clock
LogContextScopeFactory $logContextScopes
UserContextResolver $userContexts

at line 206
protected void requestReceived(RequestReceived $event)

Start telemetry for an accepted request.

Parameters

RequestReceived $event

Return Value

void

at line 284
protected void requestHandled(RequestHandled $event)

Inject configured response propagation before transport send.

Parameters

RequestHandled $event

Return Value

void

at line 306
protected void complete(Request|null $request, Response|null $response, Throwable|null $exception)

Complete telemetry at the response transport boundary, or where cancellation stopped the request.

The response is null when none was sent; the exception is the lifecycle failure, if any.

Parameters

Request|null $request
Response|null $response
Throwable|null $exception

Return Value

void

at line 385
protected array methodAttributes(Request $request)

Return normalized method attributes for a server request.

Parameters

Request $request

Return Value

array

at line 409
protected array activeRequestAttributes(Request $request, array $methodAttributes)

Return attributes available when request processing starts.

Parameters

Request $request
array $methodAttributes

Return Value

array

at line 423
protected array requestTraceAttributes(Request $request, array $methodAttributes)

Return recording-only request attributes.

Parameters

Request $request
array $methodAttributes

Return Value

array

at line 449
protected array completionAttributes(Request $request, array $startAttributes, int|null $statusCode, string|null $errorType)

Return attributes available when request processing completes.

Parameters

Request $request
array $startAttributes
int|null $statusCode
string|null $errorType

Return Value

array

at line 473
protected array responseTraceAttributes(Response $response)

Return recording-only response attributes.

Parameters

Response $response

Return Value

array

at line 490
protected Throwable|null responseException(Response|null $response)

Return the application exception retained by a Hypervel response.

Parameters

Response|null $response

Return Value

Throwable|null