Sean-Walker0 opened a new pull request, #7451:
URL: https://github.com/apache/shenyu/pull/7451

   Fixes #6497
   
   ## Modifications
   
   `InstanceCheckService#doCheck` called `collectStateData()` **inside the 
per-instance loop**, so one scheduled cycle appended N history points for N 
tracked instances — and the early points captured intermediate state while 
later instances were still being updated (e.g. instance #1 counted online 
before instance #2 had been marked). The instance visual API therefore rendered 
duplicated samples and a faster-than-real timeline whenever more than one 
instance was tracked.
   
   All instance states are now updated first, then one aggregated sample is 
appended per scheduled cycle:
   
   ```java
   instanceHealthBeatInfo.values().forEach(instance -> { ... });
   // sample the aggregated state once per scheduled cycle, after all instances 
are updated
   collectStateData();
   ```
   
   ## Verifying this change
   
   - [x] New 
`InstanceCheckServiceTest#testDoCheckAppendsOneHistorySamplePerCycle` — two 
fresh instances, one `doCheck()` run, and the visual line data must contain 
exactly one sampled point. Red on the pre-fix code (`expected: <1> but was: 
<2>`), green after.
   - [x] `./mvnw -pl shenyu-admin -am test -B` — full module suite 1732/1732 
green (1 pre-existing skip), checkstyle clean.
   
   ## Notes
   
   - Behavior change: the history timeline advances one point per check cycle 
regardless of instance count; per-point values now always reflect the 
fully-updated aggregate.
   - Orthogonality (verified by line-by-line diff comparison): #7414 modifies 
`syncDB` only; #7183 injects a `Clock` into the timeout comparisons inside the 
same loop but does not touch `collectStateData`; #7042 tightens the state 
comparison in the same loop. None of them address the sampling placement, and 
the changed hunks do not overlap.
   
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true` (module-scoped: `shenyu-admin` with `-am`, 1732 
tests + checkstyle green).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to