fix(observability): log the cause when the tern health RPC fails - #1026
fix(observability): log the cause when the tern health RPC fails#1026aparajon wants to merge 2 commits into
Conversation
The health RPC returns a sanitized Unavailable to the caller, so the underlying error was discarded entirely — a deployment could be marked unhealthy by the control plane with nothing in the logs explaining why. Log it at warn with the real error before returning. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves operator-facing observability for the Tern gRPC Health RPC by logging the underlying health failure server-side while still returning a sanitized codes.Unavailable to callers, ensuring the control plane’s “unhealthy” signal can be attributed to a concrete cause in logs.
Changes:
- Add a
slog.WarnContextlog onHealthfailures before returning a sanitizedcodes.Unavailable. - Add unit tests asserting (1) failures are logged with the underlying error and (2) successful health checks do not log.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/tern/server.go | Logs underlying Health errors at warn while preserving the sanitized gRPC response. |
| pkg/tern/server_test.go | Adds coverage ensuring failure logs are emitted and healthy checks stay silent. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A caller that hangs up mid-check reports nothing about deployment health and is already recorded on the caller's side, so it logs at debug. An expired deadline stays at warn: the check outran its budget, which is a genuine unhealthy signal that only this side can attribute. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
🤖 Review findings - created by Kiran's code review agent - for pull/1026, 7271a6d. Verdict: 7 findings — 2 non-blocking (predicate tightening + test coverage), 5 suggestions; no blockers, and CI is green (32/32 checks) at head 7271a6d, state OPEN. Non-blocking
General suggestions
The one thing that could have broken, verifiedThe riskiest mechanism is Verified correct
This review was generated by Claude Code (claude-fable-5). |
The tern
HealthRPC returns a sanitizedcodes.Unavailableto the caller, sothe underlying error was discarded entirely. A deployment could be marked
unhealthy by the control plane with nothing in the logs attributing the cause —
the operator sees an unhealthy deployment and has to go find out why by hand.
stays sanitized and the cause is still recoverable from logs alone.
so logging the success path would bury the apply-path logs an operator reads
during a schema change.
This PR was written by Claude Code (claude-opus-5).