{"record":{"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/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L1699-L1735","documentation":"Raised by latency_doctor() (redis/commands/core.py:1717) which is a stub that unconditionally raises NotImplementedError. LATENCY DOCTOR returns a human-readable narrative report intended for the redis-cli, so the python client does not implement it. Related latency commands that ARE supported: latency_history, latency_latest, latency_reset. No arguments are accepted.","triggerScenarios":"Calling r.latency_doctor(). Any call raises immediately.","commonSituations":"Programmatic latency analysis where the developer reaches for a 'doctor' summary instead of the structured history/latest data.","solutions":["Use the structured equivalents: r.latency_latest() and r.latency_history(event) for machine-readable data","Run 'redis-cli LATENCY DOCTOR' for the human-readable narrative","If you must call it from python: r.execute_command(\"LATENCY\", \"DOCTOR\")"],"exampleFix":"# before\nr.latency_doctor()\n# after\nimport pprint; pprint.pprint(r.latency_latest())","handlingStrategy":"fallback","validationCode":"# latency_doctor() is intentionally unimplemented; use structured APIs\ndef latency_summary(r):\n    return r.latency_latest()","typeGuard":null,"tryCatchPattern":"try:\n    r.latency_doctor()\nexcept NotImplementedError:\n    latest = r.latency_latest()","preventionTips":["Use latency_latest()/latency_history() for structured data.","Reserve LATENCY DOCTOR for redis-cli.","Document in your codebase that this method is a permanent stub."],"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"}