class WebSocketInstrumentation extends AbstractInstrumentation

Constants

protected STATE_CONTEXT_KEY

protected DURATION_METRIC

protected MESSAGES_METRIC

protected ACTIVE_CONNECTIONS_METRIC

protected OPCODE_ATTRIBUTE

protected SERVER_ATTRIBUTE

protected DURATION_BOUNDARIES

Properties

protected InstrumentationOptions $options from  AbstractInstrumentation
protected TracerInterface|null $tracer
protected HistogramInterface|null $duration
protected CounterInterface|null $messages
protected UpDownCounterInterface|null $activeConnections

Methods

void
register(array $options)

Register the instrumentation with normalized options.

void
registerInstrumentation()

Register WebSocket 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, ClockInterface $clock, LogContextScopeFactory $logContextScopes, OperationOrigin $origins)

Create WebSocket instrumentation.

void
start(MessageReceived $event)

Start WebSocket message telemetry.

void
finish(MessageHandled $event)

Complete WebSocket message telemetry.

takeState(Frame $frame)

Remove and return the matching top WebSocket message state.

array
messageAttributes(Frame $frame, string $server)

Return bounded WebSocket message attributes.

Details

final void register(array $options)

Register the instrumentation with normalized options.

Parameters

array $options

Return Value

void

at line 85
protected void registerInstrumentation()

Register WebSocket 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 72
__construct(Dispatcher $events, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, ClockInterface $clock, LogContextScopeFactory $logContextScopes, OperationOrigin $origins)

Create WebSocket instrumentation.

Parameters

Dispatcher $events
TracerProviderInterface $tracerProvider
MeterProviderInterface $meterProvider
ClockInterface $clock
LogContextScopeFactory $logContextScopes
OperationOrigin $origins

at line 148
protected void start(MessageReceived $event)

Start WebSocket message telemetry.

Parameters

MessageReceived $event

Return Value

void

at line 191
protected void finish(MessageHandled $event)

Complete WebSocket message telemetry.

Parameters

MessageHandled $event

Return Value

void

at line 249
protected WebSocketTelemetryState|null takeState(Frame $frame)

Remove and return the matching top WebSocket message state.

Parameters

Frame $frame

Return Value

WebSocketTelemetryState|null

at line 275
protected array messageAttributes(Frame $frame, string $server)

Return bounded WebSocket message attributes.

Parameters

Frame $frame
string $server

Return Value

array