class CacheInstrumentation extends AbstractInstrumentation

Traits

LogsMessagesTrait

Constants

protected OPERATIONS_METRIC

Properties

protected InstrumentationOptions $options from  AbstractInstrumentation
protected bool $traceEvents
protected bool $captureKey
protected int|null $keyMaxLength
protected CounterInterface|null $operations

Methods

void
register(array $options)

Register the instrumentation with normalized options.

void
registerInstrumentation()

Register cache 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, MeterProviderInterface $meterProvider, OpenTelemetryManager $openTelemetry)

Create cache instrumentation.

void
record(string $operation, string $result, string|null $store, int $count = 1, Throwable|null $exception = null, string|null $key = null, int|null $timeToLive = null, string|null $failedStore = null)

Record one completed cache operation.

SpanInterface|null
recordingSpan()

Return the recording active span when trace events are enabled.

string|null
key(string $key, string|null $store)

Resolve the bounded cache key.

Details

final void register(array $options)

Register the instrumentation with normalized options.

Parameters

array $options

Return Value

void

at line 59
protected void registerInstrumentation()

Register cache 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 49
__construct(Dispatcher $events, MeterProviderInterface $meterProvider, OpenTelemetryManager $openTelemetry)

Create cache instrumentation.

Parameters

Dispatcher $events
MeterProviderInterface $meterProvider
OpenTelemetryManager $openTelemetry

at line 141
protected void record(string $operation, string $result, string|null $store, int $count = 1, Throwable|null $exception = null, string|null $key = null, int|null $timeToLive = null, string|null $failedStore = null)

Record one completed cache operation.

Parameters

string $operation
string $result
string|null $store
int $count
Throwable|null $exception
string|null $key
int|null $timeToLive
string|null $failedStore

Return Value

void

at line 189
protected SpanInterface|null recordingSpan()

Return the recording active span when trace events are enabled.

Return Value

SpanInterface|null

at line 203
protected string|null key(string $key, string|null $store)

Resolve the bounded cache key.

Parameters

string $key
string|null $store

Return Value

string|null