{"id":"7aafa1c0c2dc567b","repo":"redis/redis-py","slug":"latency-doctor-is-intentionally-not-implemented-in","errorCode":null,"errorMessage":"LATENCY DOCTOR is intentionally not implemented in the client. For more information, see https://redis.io/commands/latency-doctor","messagePattern":"LATENCY DOCTOR is intentionally not implemented in the client\\. For more information, see https://redis\\.io/commands/latency-doctor","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":1717,"sourceCode":"        self: AsyncClientProtocol, **kwargs\n    ) -> Awaitable[datetime.datetime]: ...\n\n    def lastsave(self, **kwargs) -> datetime.datetime | Awaitable[datetime.datetime]:\n        \"\"\"\n        Return a Python datetime object representing the last time the\n        Redis database was saved to disk\n\n        For more information, see https://redis.io/commands/lastsave\n        \"\"\"\n        return self.execute_command(\"LASTSAVE\", **kwargs)\n\n    def latency_doctor(self):\n        \"\"\"Raise a NotImplementedError, as the client will not support LATENCY DOCTOR.\n        This function is best used within the redis-cli.\n\n        For more information, see https://redis.io/commands/latency-doctor\n        \"\"\"\n        raise NotImplementedError(\n            \"\"\"\n            LATENCY DOCTOR is intentionally not implemented in the client.\n\n            For more information, see https://redis.io/commands/latency-doctor\n            \"\"\"\n        )\n\n    def latency_graph(self):\n        \"\"\"Raise a NotImplementedError, as the client will not support LATENCY GRAPH.\n        This function is best used within the redis-cli.\n\n        For more information, see https://redis.io/commands/latency-graph.\n        \"\"\"\n        raise NotImplementedError(\n            \"\"\"\n            LATENCY GRAPH is intentionally not implemented in the client.\n\n            For more information, see https://redis.io/commands/latency-graph","sourceCodeStart":1699,"sourceCodeEnd":1735,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L1699-L1735","documentation":"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.","triggerScenarios":"Calling r.latency_doctor() directly. Building a latency-monitoring dashboard and reaching for the obvious method name.","commonSituations":"Operator wants programmatic latency analysis. Copying redis-cli LATENCY DOCTOR workflow into Python. Monitoring tool enumerates latency_* methods.","solutions":["Use r.execute_command('LATENCY', 'DOCTOR') if you want the raw text report.","For programmatic latency data, use r.latency_history(event) instead.","Use redis-cli for the human-readable DOCTOR output."],"exampleFix":"# before\nr.latency_doctor()\n# after\nreport = r.execute_command('LATENCY', 'DOCTOR')","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    r.latency_doctor()\nexcept NotImplementedError:\n    report = r.execute_command('LATENCY', 'DOCTOR')","preventionTips":["LATENCY DOCTOR is a human-readable report — prefer latency_history for structured data.","Use execute_command for any intentionally-unwrapped latency subcommand."],"tags":["not-implemented","latency","api-gap"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}