redis/redis-py · error · NotImplementedError
LATENCY HISTOGRAM is intentionally not implemented in the…
Error message
LATENCY HISTOGRAM is intentionally not implemented in the client.
What it means
Raised by latency_histogram() (redis/commands/core.py:1964) which is a stub that unconditionally raises NotImplementedError. Note the actual server command for per-command latency histograms is INFO LATENCYSTATS, not LATENCY HISTOGRAM; this stub exists to reserve the name and document that the old LATENCY HISTOGRAM shape is unsupported. Related supported commands: latency_history, latency_latest, latency_reset. Any call raises immediately.
Solutions
- For per-command latency histograms use: r.execute_command("INFO", "LATENCYSTATS") (server-side)
- For event latency time-series use r.latency_history(event) or r.latency_latest()
- Render percentiles client-side from latency_history samples
Example fix
# before
r.latency_histogram("GET")
# after
hist = r.execute_command("INFO", "LATENCYSTATS") Defensive patterns
Strategy: fallback
Validate before calling
# latency_histogram() is intentionally unimplemented; use INFO LATENCYSTATS
def latency_histograms(r):
return r.execute_command("INFO", "LATENCYSTATS") Try / catch
try:
r.latency_histogram()
except NotImplementedError:
hist = r.execute_command("INFO", "LATENCYSTATS") Prevention
- Do not call latency_histogram(); it is a permanent stub.
- Use INFO LATENCYSTATS for per-command latency percentiles.
- Use latency_history()/latency_latest() for event time-series.
When it happens
Trigger: Calling r.latency_histogram() or r.latency_histogram("GET"). Any call raises immediately.
Common situations: Wanting command latency percentile data and guessing the method name; migrating from a tool that exposed a 'latency histogram'.
Related errors
- LATENCY DOCTOR is intentionally not implemented in the…
- LATENCY GRAPH is intentionally not implemented in the…
- COMMAND DOCS is intentionally not implemented in the client.
- COMMAND INFO is intentionally not implemented in the client.
- DEBUG SEGFAULT is intentionally not implemented in the…
AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10).
Data as JSON: /api/errors/ee8aae5533d9ed9e.
Report an issue: GitHub.
Appendix: source
Thrown at redis/commands/core.py:1964
def memory_purge(self: SyncClientProtocol, **kwargs) -> bool: ...
@overload
def memory_purge(self: AsyncClientProtocol, **kwargs) -> Awaitable[bool]: ...
def memory_purge(self, **kwargs) -> bool | Awaitable[bool]:
"""
Attempts to purge dirty pages for reclamation by allocator
For more information, see https://redis.io/commands/memory-purge
"""
return self.execute_command("MEMORY PURGE", **kwargs)
def latency_histogram(self, *args):
"""
This function throws a NotImplementedError since it is intentionally
not supported.
"""
raise NotImplementedError(
"LATENCY HISTOGRAM is intentionally not implemented in the client."
)
@overload
def latency_history(self: SyncClientProtocol, event: str) -> list[list[int]]: ...
@overload
def latency_history(
self: AsyncClientProtocol, event: str
) -> Awaitable[list[list[int]]]: ...
def latency_history(
self, event: str
) -> list[list[int]] | Awaitable[list[list[int]]]:
"""
Returns the raw data of the ``event``'s latency spikes time series.
For more information, see https://redis.io/commands/latency-historyView on GitHub (pinned to 6a6b581b48)