Telemetry events emitted by Redis.
Events
[:redis_ex, :connection, :connect]- successful connection- Measurements:
%{duration: native_time} - Metadata:
%{host: host, port: port}
- Measurements:
[:redis_ex, :connection, :disconnect]- connection lost- Measurements:
%{} - Metadata:
%{host: host, port: port, reason: reason}
- Measurements:
[:redis_ex, :pipeline, :start]- pipeline/command started- Measurements:
%{system_time: native_time} - Metadata:
%{commands: commands}
- Measurements:
[:redis_ex, :pipeline, :stop]- pipeline/command completed- Measurements:
%{duration: native_time} - Metadata:
%{commands: commands}
- Measurements:
[:redis_ex, :pipeline, :exception]- pipeline/command failed- Measurements:
%{duration: native_time} - Metadata:
%{commands: commands, kind: kind, reason: reason}
- Measurements:
[:redis_ex, :auto_pipeline, :flush]- an automatic batch was sent- Measurements:
%{batch_size: count} - Metadata:
%{host: host, port: port, reason: reason}
- Measurements:
Usage
Attach a handler:
:telemetry.attach("redis-logger", [:redis_ex, :pipeline, :stop], fn name, measurements, metadata, _config ->
Logger.info("Redis #{inspect(name)} took #{measurements.duration}ns for #{length(metadata.commands)} commands")
end, nil)Or use the built-in default handler for logging:
Redis.Telemetry.attach_default_handler()
Summary
Functions
Attaches a default log handler for all Redis telemetry events.
Emits a telemetry event. Wraps :telemetry.execute/3 with a no-op
fallback if telemetry is not available.
Spans a telemetry event around a function call.
Functions
Attaches a default log handler for all Redis telemetry events.
Emits a telemetry event. Wraps :telemetry.execute/3 with a no-op
fallback if telemetry is not available.
Spans a telemetry event around a function call.