Skip to main content

Redis

The Redis instrumentation traces every Redis command executed through Laravel’s Redis facade or the underlying Predis/PhpRedis client. Each command produces a dedicated CLIENT span. Spans are only created when a trace is already active. Commands executed outside any active trace are ignored.

Span Details

  • Span name: The Redis command name in uppercase — e.g. GET, SET, HGETALL.
  • Span kind: CLIENT
  • Attributes captured: db.system.name (redis), db.operation.name, db.namespace (database index), db.query.text (command with parameters, truncated to 500 characters), server.address.

Configuration

In config/opentelemetry.php:
use Keepsuit\LaravelOpenTelemetry\Instrumentation;

'instrumentation' => [
    Instrumentation\RedisInstrumentation::class => env('OTEL_INSTRUMENTATION_REDIS', true),
],

Metrics

MetricTypeUnitDescription
db.client.operation.durationHistogramsecondsDuration of Redis client operations.

Disabling Redis

OTEL_INSTRUMENTATION_REDIS=false
Alternatively, remove RedisInstrumentation::class from the instrumentation array in config/opentelemetry.php.

Cache

The Cache instrumentation records Laravel cache operations as events on the current active span rather than creating separate child spans. This keeps your trace tree clean while still surfacing cache activity. The following cache events are recorded:
Event nameTrigger
cache hitA cached value was found for the key.
cache missNo cached value was found for the key.
cache setA value was written to the cache. Includes expires_at, expires_in_seconds, and expires_in_human attributes.
cache forgetA cached key was deleted.
Each event includes the key and tags attributes.
Cache events are attached to the currently active span. If no span is active (e.g. outside of an instrumented request or job), the events are silently discarded.

Configuration

In config/opentelemetry.php:
use Keepsuit\LaravelOpenTelemetry\Instrumentation;

'instrumentation' => [
    Instrumentation\CacheInstrumentation::class => env('OTEL_INSTRUMENTATION_CACHE', true),
],

Disabling Cache

OTEL_INSTRUMENTATION_CACHE=false
Alternatively, remove CacheInstrumentation::class from the instrumentation array in config/opentelemetry.php.

Build docs developers (and LLMs) love