[DO NOT MERGE][MLI-7219] feat(k8s-cache): log + metric on cacher Redis write failure#843
Draft
lorenzo-norcini-scale wants to merge 1 commit into
Conversation
Cacher write failures were observable nowhere: no log, no metric. Entries then expire and the Gateway reports endpoint status as `unknown`. Wrap the write loop in execute() to emit a logger.exception + a new scale_launch.k8s_cache.redis_write_failure counter, then re-raise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
59fc93c to
7eb3546
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the k8s cacher fails to write endpoint status to Redis (bad auth, network partition, expired credentials), the failure was observable nowhere — no log, no metric. Entries then expire (60s TTL) and the Gateway reports endpoint status as
unknown.This wraps the write loop in
ModelEndpointCacheWriteService.execute()to emit alogger.exception(traceback names the cause) and a newscale_launch.k8s_cache.redis_write_failurecounter, then re-raise (visibility, not recovery — crash-loop behavior unchanged). Only the Redis write is wrapped; the k8s read and image cache stay outside.Notes
unknown.Testing
New failure-branch test (raising repo → metric increments and exception propagates); happy-path test asserts the counter stays 0. Cache-service + redis-repo unit tests pass.
Resolves MLI-7219.
🤖 Generated with Claude Code