class SchedulerInstrumentation extends AbstractInstrumentation

Constants

protected STATE_CONTEXT_KEY

protected DURATION_METRIC

protected EXECUTIONS_METRIC

protected TASK_ATTRIBUTE

protected EXIT_CODE_ATTRIBUTE

protected DURATION_BOUNDARIES

Properties

protected InstrumentationOptions $options from  AbstractInstrumentation
protected TracerInterface|null $tracer
protected HistogramInterface|null $duration
protected CounterInterface|null $executions

Methods

void
register(array $options)

Register the instrumentation with normalized options.

void
registerInstrumentation()

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

Create scheduler instrumentation.

void
start(ScheduledTaskStarting $event)

Start scheduled-task telemetry.

void
finish(Event $task)

Complete a successful or non-zero scheduled task.

void
fail(Event $task, Throwable $exception)

Complete a failed scheduled task.

void
canceled(ScheduledTaskCanceled $event)

Complete a scheduled task that cancellation stopped before its outcome was published.

void
recordMetrics(SchedulerTelemetryState $state, int $finishedAt, array $attributes)

Record enabled scheduled-task metrics.

void
close(SchedulerTelemetryState $state, int $finishedAt)

Close a scheduled-task telemetry scope.

takeState(Event $task)

Remove and return the matching top scheduled-task state.

string
taskName(Event $task)

Return a stable scheduled-task identity.

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

Create scheduler instrumentation.

Parameters

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

at line 133
protected void start(ScheduledTaskStarting $event)

Start scheduled-task telemetry.

Parameters

ScheduledTaskStarting $event

Return Value

void

at line 178
protected void finish(Event $task)

Complete a successful or non-zero scheduled task.

Parameters

Event $task

Return Value

void

at line 215
protected void fail(Event $task, Throwable $exception)

Complete a failed scheduled task.

Parameters

Event $task
Throwable $exception

Return Value

void

at line 253
protected void canceled(ScheduledTaskCanceled $event)

Complete a scheduled task that cancellation stopped before its outcome was published.

Parameters

ScheduledTaskCanceled $event

Return Value

void

at line 296
protected void recordMetrics(SchedulerTelemetryState $state, int $finishedAt, array $attributes)

Record enabled scheduled-task metrics.

Parameters

SchedulerTelemetryState $state
int $finishedAt
array $attributes

Return Value

void

at line 312
protected void close(SchedulerTelemetryState $state, int $finishedAt)

Close a scheduled-task telemetry scope.

Parameters

SchedulerTelemetryState $state
int $finishedAt

Return Value

void

at line 322
protected SchedulerTelemetryState|null takeState(Event $task)

Remove and return the matching top scheduled-task state.

Parameters

Event $task

Return Value

SchedulerTelemetryState|null

at line 346
protected string taskName(Event $task)

Return a stable scheduled-task identity.

Parameters

Event $task

Return Value

string