Repository navigation
Add health_details: server and stream details in the readiness probes (#144) - #155
Merged
Merged
Conversation
…#144) To learn which nats-server a NUTS instance is connected to, or what its stream's limits and state are, an operator had to query NATS separately. Some behaviour now depends on the server version (a restore keeps or replaces the stream's creation time depending on the server), so seeing it from NUTS helps triage. health_details adds nats_server (version, name, cluster, domain) and stream_info (subjects, storage, replicas, message and byte counts, first and last sequence, consumers, limits, creation time) to the readiness probes' JSON. The stream details come from the read the probe already makes, so there is no extra request. nats_server is left out while disconnected, and stream_info when the stream cannot be read. Off by default: probe paths are often public, and the details name servers, clusters and limits. Closes #144 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Closes #144.
To learn which nats-server a NUTS instance is connected to, or what its stream's limits and state are, an operator had to query NATS separately. Some behaviour now depends on the server version; for example, a restore keeps or replaces the creation time depending on the server (#137). Seeing it from NUTS helps triage.
Changes
health_details [bool], off by default. With it,ready_pathandhealth_pathadd:nats_server: version, name, cluster, domain.stream_info: subjects, storage, replicas, message and byte counts, first and last sequence, consumers,max_msgs,max_bytes,max_age_seconds,max_consumers, creation time.nats_serveris left out while disconnected, andstream_infowhen the stream cannot be read. The status fields and codes are unchanged.nats_server_infometric (mentioned in the issue) would need its own design: several handlers share process-wide metrics, and a server label goes stale after a reconnect.caddyfile.go(no argument meanstrue). Documented in the README (listing, probes section with an example), CONFIGURATION, the website and the CHANGELOG. A new/detailsroute in Caddyfile.test, and a "the response should not contain" step.Tests
TestHandler_HealthDetails, against an embedded server with JetStream domainhub, cluster nameeast, a stream with limits and one durable consumer:true, and a non-boolean value that is rejected./details/readyzwith/events/readyz; 34/34. The full suite passes under-race; lint is clean.caddyfile.go41/0,serve.go220/0./details/readyzreports nats-server 2.15.0 and the example's memory stream (max_msgs10000,max_age_seconds3600,max_consumers10000)./events/readyzis unchanged.🤖 Generated with Claude Code