redis/redis-py · error · NotImplementedError

LATENCY GRAPH is intentionally not implemented in the…

Error message

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

What it means

Raised by latency_graph() (redis/commands/core.py:1731) which is a stub that unconditionally raises NotImplementedError. LATENCY GRAPH produces an ASCII art graph meant for redis-cli, so the python client refuses it. The structured latency_history(event) and latency_latest() commands are available instead. No arguments are accepted.

Solutions

  1. Fetch raw samples with r.latency_history(event) and render the graph yourself
  2. Use r.latency_latest() for the most recent spike per event
  3. Run 'redis-cli LATENCY GRAPH <event>' for the built-in ASCII art

Example fix

# before
r.latency_graph()
# after
samples = r.latency_history("command")
Defensive patterns

Strategy: fallback

Validate before calling

# latency_graph() is intentionally unimplemented; fetch raw samples
def latency_graph_data(r, event):
    return r.latency_history(event)

Try / catch

try:
    r.latency_graph()
except NotImplementedError:
    data = r.latency_history("command")

Prevention

When it happens

Trigger: Calling r.latency_graph(). Any call raises immediately.

Common situations: Wanting a visual latency chart programmatically; assuming every LATENCY subcommand is mirrored.

Related errors


AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10). Data as JSON: /api/errors/f5a6ec09e22f90eb. Report an issue: GitHub.

Appendix: source

Thrown at redis/commands/core.py:1731

        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
            """
        )

    @overload
    def lolwut(
        self: SyncClientProtocol, *version_numbers: Union[str, float], **kwargs
    ) -> bytes | str: ...

    @overload
    def lolwut(
        self: AsyncClientProtocol, *version_numbers: Union[str, float], **kwargs
    ) -> Awaitable[bytes | str]: ...

    def lolwut(self, *version_numbers: Union[str, float], **kwargs) -> (

View on GitHub (pinned to 6a6b581b48)