class RedisInstrumentation extends AbstractInstrumentation

Traits

LogsMessagesTrait

Constants

protected CONNECTION_ATTRIBUTE

protected DB_SYSTEM_NAME_REDIS

protected DURATION_BOUNDARIES

Properties

protected InstrumentationOptions $options from  AbstractInstrumentation
protected TracerInterface|null $tracer
protected HistogramInterface|null $duration
protected bool $queryText
protected int|null $queryTextMaxLength

Methods

void
register(array $options)

Register the instrumentation with normalized options.

void
registerInstrumentation()

Register Redis 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, OpenTelemetryManager $openTelemetry, RedisManager $redis, RedisQueryTextFormatter $queryTextFormatter, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity)

Create Redis instrumentation.

void
commandExecuted(CommandExecuted $event)

Record a completed Redis command.

void
commandFailed(CommandFailed $event)

Record a failed Redis command.

void
recordCommand(string $command, array $parameters, float $elapsedMilliseconds, string $connection, Throwable|null $exception = null)

Record one completed Redis operation.

array
attributes(string $operation, string $connection, string|null $errorType)

Return low-cardinality attributes shared by spans and metrics.

string|null
queryText(string $command, string $operation, array $parameters, string $connection)

Resolve the bounded Redis query text.

Details

final void register(array $options)

Register the instrumentation with normalized options.

Parameters

array $options

Return Value

void

at line 82
protected void registerInstrumentation()

Register Redis 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 65
__construct(Dispatcher $events, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, ClockInterface $clock, OpenTelemetryManager $openTelemetry, RedisManager $redis, RedisQueryTextFormatter $queryTextFormatter, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity)

Create Redis instrumentation.

Parameters

Dispatcher $events
TracerProviderInterface $tracerProvider
MeterProviderInterface $meterProvider
ClockInterface $clock
OpenTelemetryManager $openTelemetry
RedisManager $redis
RedisQueryTextFormatter $queryTextFormatter
ExceptionContextRegistry $exceptionContexts
OperationOrigin $origins
ProcessIdentity $identity

at line 120
protected void commandExecuted(CommandExecuted $event)

Record a completed Redis command.

Parameters

CommandExecuted $event

Return Value

void

at line 133
protected void commandFailed(CommandFailed $event)

Record a failed Redis command.

Parameters

CommandFailed $event

Return Value

void

at line 152
protected void recordCommand(string $command, array $parameters, float $elapsedMilliseconds, string $connection, Throwable|null $exception = null)

Record one completed Redis operation.

Parameters

string $command
array $parameters
float $elapsedMilliseconds
string $connection
Throwable|null $exception

Return Value

void

at line 231
protected array attributes(string $operation, string $connection, string|null $errorType)

Return low-cardinality attributes shared by spans and metrics.

Parameters

string $operation
string $connection
string|null $errorType

Return Value

array

at line 246
protected string|null queryText(string $command, string $operation, array $parameters, string $connection)

Resolve the bounded Redis query text.

Parameters

string $command
string $operation
array $parameters
string $connection

Return Value

string|null