class HttpServerInstrumentation extends AbstractInstrumentation

Constants

protected DURATION_BOUNDARIES

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.

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
responseSent(ResponseSent $event)

Complete telemetry at the response transport boundary.

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 106
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 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 89
__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 194
protected void requestReceived(RequestReceived $event)

Start telemetry for an accepted request.

Parameters

RequestReceived $event

Return Value

void

at line 272
protected void requestHandled(RequestHandled $event)

Inject configured response propagation before transport send.

Parameters

RequestHandled $event

Return Value

void

at line 293
protected void responseSent(ResponseSent $event)

Complete telemetry at the response transport boundary.

Parameters

ResponseSent $event

Return Value

void

at line 372
protected array methodAttributes(Request $request)

Return normalized method attributes for a server request.

Parameters

Request $request

Return Value

array

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

Return attributes available when request processing starts.

Parameters

Request $request
array $methodAttributes

Return Value

array

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

Return recording-only request attributes.

Parameters

Request $request
array $methodAttributes

Return Value

array

at line 436
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 460
protected array responseTraceAttributes(Response $response)

Return recording-only response attributes.

Parameters

Response $response

Return Value

array

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

Return the application exception retained by a Hypervel response.

Parameters

Response|null $response

Return Value

Throwable|null