{"record":{"id":"ee8aae5533d9ed9e","repo":"redis/redis-py","slug":"latency-histogram-is-intentionally-not-implemented","errorCode":null,"errorMessage":"LATENCY HISTOGRAM is intentionally not implemented in the client.","messagePattern":"LATENCY HISTOGRAM is intentionally not implemented in the client\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":1964,"sourceCode":"    def memory_purge(self: SyncClientProtocol, **kwargs) -> bool: ...\n\n    @overload\n    def memory_purge(self: AsyncClientProtocol, **kwargs) -> Awaitable[bool]: ...\n\n    def memory_purge(self, **kwargs) -> bool | Awaitable[bool]:\n        \"\"\"\n        Attempts to purge dirty pages for reclamation by allocator\n\n        For more information, see https://redis.io/commands/memory-purge\n        \"\"\"\n        return self.execute_command(\"MEMORY PURGE\", **kwargs)\n\n    def latency_histogram(self, *args):\n        \"\"\"\n        This function throws a NotImplementedError since it is intentionally\n        not supported.\n        \"\"\"\n        raise NotImplementedError(\n            \"LATENCY HISTOGRAM is intentionally not implemented in the client.\"\n        )\n\n    @overload\n    def latency_history(self: SyncClientProtocol, event: str) -> list[list[int]]: ...\n\n    @overload\n    def latency_history(\n        self: AsyncClientProtocol, event: str\n    ) -> Awaitable[list[list[int]]]: ...\n\n    def latency_history(\n        self, event: str\n    ) -> list[list[int]] | Awaitable[list[list[int]]]:\n        \"\"\"\n        Returns the raw data of the ``event``'s latency spikes time series.\n\n        For more information, see https://redis.io/commands/latency-history","sourceCodeStart":1946,"sourceCodeEnd":1982,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L1946-L1982","documentation":"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.","triggerScenarios":"Calling r.latency_histogram() or r.latency_histogram(\"GET\"). Any call raises immediately.","commonSituations":"Wanting command latency percentile data and guessing the method name; migrating from a tool that exposed a 'latency histogram'.","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"],"exampleFix":"# before\nr.latency_histogram(\"GET\")\n# after\nhist = r.execute_command(\"INFO\", \"LATENCYSTATS\")","handlingStrategy":"fallback","validationCode":"# latency_histogram() is intentionally unimplemented; use INFO LATENCYSTATS\ndef latency_histograms(r):\n    return r.execute_command(\"INFO\", \"LATENCYSTATS\")","typeGuard":null,"tryCatchPattern":"try:\n    r.latency_histogram()\nexcept NotImplementedError:\n    hist = r.execute_command(\"INFO\", \"LATENCYSTATS\")","preventionTips":["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."],"tags":["latency","notimplemented","intentional"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}