{"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/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L1946-L1982","documentation":"latency_histogram is a stub that always raises NotImplementedError. Note: this is distinct from the TIMESERIES module's TS MRANGE aggregation or the Redis latency-event histogram. The method exists as a placeholder but does not invoke the server. Use execute_command if the underlying COMMAND LATENCY HISTOGRAM is available on your Redis version.","triggerScenarios":"Calling r.latency_histogram() or r.latency_histogram('GET'). Confusing it with per-event latency history (latency_history).","commonSituations":"Developer expects command-latency percentile data. Confusing latency_histogram with the INFO commandstats output. Migrating from another client library that implemented it.","solutions":["Use r.execute_command('COMMAND', 'LATENCY') if your Redis version exposes command-latency stats.","For per-event latency spikes, use r.latency_history(event).","For aggregate command stats, parse r.info('commandstats')."],"exampleFix":"# before\nr.latency_histogram('GET')\n# after\nr.execute_command('COMMAND', 'LATENCY')  # if supported by server","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    r.latency_histogram()\nexcept NotImplementedError:\n    stats = r.execute_command('COMMAND', 'LATENCY')","preventionTips":["latency_histogram is an intentional stub — don't rely on it.","Distinguish command-latency stats from per-event latency history."],"tags":["not-implemented","latency","api-gap"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}