class ConsoleInstrumentation extends AbstractInstrumentation

Constants

protected STATE_CONTEXT_KEY

protected DURATION_METRIC

protected COMMAND_ATTRIBUTE

protected EXIT_CODE_ATTRIBUTE

protected DURATION_BOUNDARIES

Properties

protected InstrumentationOptions $options from  AbstractInstrumentation
protected list<string> $commands
protected list<string> $excludedCommands
protected TracerInterface|null $tracer
protected HistogramInterface|null $duration

Methods

void
register(array $options)

Register the instrumentation with normalized options.

void
registerInstrumentation()

Register console 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, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity, LogContextScopeFactory $logContextScopes)

Create console instrumentation.

void
start(BeforeHandle $event)

Start console-command telemetry.

void
finish(AfterExecute $event)

Complete console-command telemetry.

takeState(Command $command)

Remove and return the matching top console-command state.

bool
shouldRecord(string $command)

Determine whether a command is included by the configured patterns.

Details

final void register(array $options)

Register the instrumentation with normalized options.

Parameters

array $options

Return Value

void

at line 84
protected void registerInstrumentation()

Register console 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 69
__construct(Dispatcher $events, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, ClockInterface $clock, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity, LogContextScopeFactory $logContextScopes)

Create console instrumentation.

Parameters

Dispatcher $events
TracerProviderInterface $tracerProvider
MeterProviderInterface $meterProvider
ClockInterface $clock
ExceptionContextRegistry $exceptionContexts
OperationOrigin $origins
ProcessIdentity $identity
LogContextScopeFactory $logContextScopes

at line 128
protected void start(BeforeHandle $event)

Start console-command telemetry.

Parameters

BeforeHandle $event

Return Value

void

at line 177
protected void finish(AfterExecute $event)

Complete console-command telemetry.

Parameters

AfterExecute $event

Return Value

void

at line 239
protected ConsoleTelemetryState|null takeState(Command $command)

Remove and return the matching top console-command state.

Parameters

Command $command

Return Value

ConsoleTelemetryState|null

at line 263
protected bool shouldRecord(string $command)

Determine whether a command is included by the configured patterns.

Parameters

string $command

Return Value

bool