Repository navigation
Conversation
…ealth diagnostics ClientRegistrationDiagnostics records one bounded observation per registration identity at the boundaries the registration flow already passes through: acknowledged persist returns, failed persists and retry attempts in FailbackRegistryRepository, retry exhaustion at the owner-aware removal, and orderly close which retires entries as offline. The vocabulary distinguishes registered, retrying, exhausted, offline and unknown, carries timestamps, an attempt counter and a bounded credential-free failure reason; retained identities are hard-capped with overflow counted, and aggregate counters stay unbounded primitives. The disruptor enqueue side contributes a queued-events aggregate only, since per-event identity is not reliably available before a completion boundary. Applications read ClientRegistrationDiagnostics.snapshot() programmatically; an opt-in Spring Boot health contributor ships in the common client starter, gated on Actuator presence and shenyu.register.diagnostics.health-enabled, and always reports UP with the snapshot in details so liveness never fails by default. No extra registration calls, no second retry chain, no per-request work; existing timing and retry semantics are covered by the unchanged suite plus new boundary fixtures that are red against the silent-omit behavior.
…queue retireAll used an unconditional replace, so a concurrent fresh failure could be overwritten by a stale offline pass; the replace is now conditional on the observed entry. The queued-events aggregate counted before the disruptor enqueue attempt instead of after it.
This branch has not been deployed
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.
Fixes #8430.
The Java client's registration work runs asynchronously on the disruptor: transport failures land in the failback layer's bounded retry (10 s × 18) and then silently disappear, heartbeats only log, and application startup success therefore says nothing about usable gateway registration. This PR gives applications an optional, bounded view of registration progress, written only at the boundaries the flow already passes through — no extra registration calls, no second retry chain, no per-request work.
What changed
ClientRegistrationDiagnostics(inshenyu-register-client-api, next to the failback layer, so every repository implementation inherits it) keeps one bounded observation per registration identity, keyed by the identity the failback layer already builds (config/namespace/protocol scoped).FailbackRegistryRepositoryrecords at each completion boundary: an acknowledged persist return isREGISTERED(this is the Admin acknowledgement, not gateway-observed readiness — nothing is inferred from a successful POST), a failed persist or retry attempt isRETRYINGwith a bounded failure category (TIMEOUTorTRANSPORT, walking the exception cause chain) and a truncated credential-free reason, the owner-aware removal after the retry budget is exhausted isEXHAUSTED(previously a silent disappearance), the compatibility removal becomesUNKNOWN, and orderly close retires every retained entry asOFFLINE. Each entry carries timestamps and an attempt counter; duplicate failures and replaced retry tasks update the same entry instead of inflating logical counts, and a newer failure keeps its own task exactly as before. The disruptor enqueue side contributes a queued-events aggregate only, because per-event identity is not reliably available before a completion boundary.Retained state is hard-capped at 512 identities (rejected overflows only bump a counter), aggregate counters are unbounded primitives, and entries never contain credentials, tokens or raw payloads. Applications read
snapshot()programmatically (bounded entry list, most recently updated first, plus counters); an opt-in Spring Boot health contributor ships in the common client starter — gated on Actuator's presence (@ConditionalOnClass) andshenyu.register.diagnostics.health-enabled=true— and always reports UP with the snapshot in its details, so application liveness never fails by default and a missing Actuator library changes nothing.Tests
FailbackRegistryRepositoryDiagnosticsTestdrives the real boundaries with a controllable repository: the lifecycle fixture walks initial success, transport failure with retry, recovery at the retry boundary, exhaustion and orderly close, asserting the snapshot matches each event; duplicate failures keep one entry without inflating counters; different namespaces scope separate identities; timeouts carry the timeout category; the compatibility removal becomes UNKNOWN; 513 distinct identities overflow the cap into a counter while observations keep flowing; failure reasons are truncated; and queued events are counted at the enqueue boundary without fabricating entries. The health configuration test verifies the opt-in property, the always-UP contributor with snapshot details, and that a classpath without Actuator (filtered loader) leaves the context healthy and contributor-free. All boundary assertions are red against the previous silent-omit behavior. Module results on the current master baseline:shenyu-register-client-api33 (was 25),shenyu-client-core102 unchanged,shenyu-register-client-httpandshenyu-spring-boot-starter-client-commongreen; checkstyle clean.