Tracing

November 30, 2024 ยท View on GitHub

Tracing is implemented via the tracing crate. This page describes the spans used by the client and the fields emitted on each of the spans.

See the benchmark application for an example showing how to configure tracing with a local Jaeger instance. This crate ships with a small example that uses docker-compose to run a local Jaeger instance.

Spans

This table shows the spans emitted by the client. The Partial Trace column describes whether the span will appear when only the partial-tracing feature flag is enabled.

NameDescriptionPartial Trace
fred.commandThe top level span used for all redis commands.x
fred.prepareTime spent checking and preparing arguments.
fred.queuedTime spent waiting in the in-memory queue before being sent to the server. Pipelining and backpressure settings can significantly affect this.
fred.writeTime spent routing and writing a command to the socket.
fred.rttTime spent waiting on a response from the server, starting from when the first byte is fed to the socket and ending when the full response has been decoded.x
fred.pubsubTime spent parsing a publish-subscribe message.

Tracing levels for the two tracing features can be configured separately through the TracingConfig.

Events

NameDescription
fred.backpressureEmitted when a command hits backpressure due to too many in-flight commands.

Attributes

NameDescription
client.idThe ID of the client instance (client.id()).
client.queuedThe length of the in-memory command queue.
cmd.nameThe redis command name.
cmd.reqThe size (in bytes) of the command's arguments.
cmd.resThe size (in bytes) of the command's response.
cmd.argsThe number of arguments being sent to the server.
cmd.flushWhether the socket was flushed while sending the command.
msg.channelThe channel on which a pubsub message was received.
durationThe duration of a pause, in milliseconds, of a backpressure event.