zhangshenghang opened a new pull request, #12161:
URL: https://github.com/apache/seatunnel/pull/12161

   ## Purpose
   
   Two small but real gaps in the Zeta cluster health metrics endpoint:
   
   1. **Locale-dependent formatting.** `SeaTunnelHealthMonitor` formats 
percentage, byte, and load values with `String.format("%.2f", ...)`. The 
default formatting uses the JVM default locale, so a cluster started under a 
comma-decimal locale (for example `de_DE`) renders the same metrics with commas 
instead of dots, which breaks downstream consumers that parse the 
comma-separated `key=value` text.
   2. **Unbounded per-member wait.** 
`BaseService.getSystemMonitoringInformationJsonValues` calls 
`InvocationFuture.get()` with no timeout. A single slow or stuck member can 
block the `/system-monitoring-information` response for the whole REST call.
   
   ## Changes
   
   - `SeaTunnelHealthMonitor`: every call site that formats a floating-point 
value (`percentageString`, `numberToUnit`, `renderLoad`, 
`renderOperationService`) now passes `Locale.ROOT` so the rendered string is 
stable regardless of the JVM default locale.
   - `BaseService.getSystemMonitoringInformationJsonValues`: bound the 
per-member wait to 3 seconds, cancel the invocation on timeout, and restore the 
interrupt flag on `InterruptedException`. On timeout the per-member entry is 
rendered as an empty `JsonObject`, so one bad member no longer freezes the 
entire response.
   - `SeaTunnelHealthMonitorTest`: pin the locale-stable behavior for 
`percentageString` and `numberToUnit` by setting the JVM default locale to 
`Locale.GERMANY` around the reflection call and asserting the dot-decimal 
output.
   
   The throttled invalid-metrics logging, per-member failure isolation, and 
malformed-entry handling that the upstream `BaseService` already provides are 
intentionally left alone.
   
   ## Validation
   
   The new `SeaTunnelHealthMonitorTest` exercises `percentageString(12.345) -> 
"12.35%"` and `numberToUnit(2 * 1024 * 1024) -> "2.0M"` under `Locale.GERMANY` 
to assert the locale-stable output.
   
   `./mvnw -pl seatunnel-engine/seatunnel-engine-server 
-Dtest=SeaTunnelHealthMonitorTest test` is currently blocked by a pre-existing 
compilation error in `JettyService` (`HttpConfig.getUploadMaxFileSizeMb` / 
`getUploadMaxRequestSizeMb` not present on the Hazelcast version on the 
classpath), which is unrelated to this change. The test will run cleanly in CI.
   
   ## Impact
   
   - Behavior change: rendered health metrics no longer depend on the JVM 
default locale. The shape and key names are unchanged, only the decimal 
separator in a handful of values is now guaranteed to be `.`. REST clients that 
previously parsed the text on a comma-decimal machine will now see the same 
output as on a dot-decimal machine.
   - Behavior change: `/system-monitoring-information` no longer blocks on a 
stuck member; it returns whatever it has after at most 3 seconds per member.
   - No new public API.


-- 
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