redis/redis-py · error · NotImplementedError

LATENCY DOCTOR is intentionally not implemented in the clien

Error message

LATENCY DOCTOR is intentionally not implemented in the client. For more information, see https://redis.io/commands/latency-doctor

What it means

latency_doctor is a stub that always raises NotImplementedError. LATENCY DOCTOR returns a human-readable, opinionated diagnostic report intended for the redis-cli console; it is not useful as structured data in a programmatic client, so redis-py does not wrap it.

Source

Thrown at redis/commands/core.py:1717

        self: AsyncClientProtocol, **kwargs
    ) -> Awaitable[datetime.datetime]: ...

    def lastsave(self, **kwargs) -> datetime.datetime | Awaitable[datetime.datetime]:
        """
        Return a Python datetime object representing the last time the
        Redis database was saved to disk

        For more information, see https://redis.io/commands/lastsave
        """
        return self.execute_command("LASTSAVE", **kwargs)

    def latency_doctor(self):
        """Raise a NotImplementedError, as the client will not support LATENCY DOCTOR.
        This function is best used within the redis-cli.

        For more information, see https://redis.io/commands/latency-doctor
        """
        raise NotImplementedError(
            """
            LATENCY DOCTOR is intentionally not implemented in the client.

            For more information, see https://redis.io/commands/latency-doctor
            """
        )

    def latency_graph(self):
        """Raise a NotImplementedError, as the client will not support LATENCY GRAPH.
        This function is best used within the redis-cli.

        For more information, see https://redis.io/commands/latency-graph.
        """
        raise NotImplementedError(
            """
            LATENCY GRAPH is intentionally not implemented in the client.

            For more information, see https://redis.io/commands/latency-graph

View on GitHub (pinned to da03cdc7e8)

Solutions

  1. Use r.execute_command('LATENCY', 'DOCTOR') if you want the raw text report.
  2. For programmatic latency data, use r.latency_history(event) instead.
  3. Use redis-cli for the human-readable DOCTOR output.

Example fix

# before
r.latency_doctor()
# after
report = r.execute_command('LATENCY', 'DOCTOR')
Defensive patterns

Strategy: fallback

Try / catch

try:
    r.latency_doctor()
except NotImplementedError:
    report = r.execute_command('LATENCY', 'DOCTOR')

Prevention

When it happens

Trigger: Calling r.latency_doctor() directly. Building a latency-monitoring dashboard and reaching for the obvious method name.

Common situations: Operator wants programmatic latency analysis. Copying redis-cli LATENCY DOCTOR workflow into Python. Monitoring tool enumerates latency_* methods.

Related errors


AI-assisted analysis of redis/redis-py@da03cdc7e8 (2026-08-04). Data as JSON: /data/errors/7aafa1c0c2dc567b.json. Report an issue: GitHub.