JackieTien97 opened a new pull request, #18957:
URL: https://github.com/apache/iotdb/pull/18957

   ## Description
   
   Initial Prometheus requests and scheduled snapshot refreshes can collect 
stateful gauges concurrently. This was identified while investigating [a 1C3D 
CI 
failure](https://github.com/apache/iotdb/actions/runs/39541561392/job/119030246374?pr=18952),
 where `disk_io_busy_percentage` was exported as `NaN` and rejected by the 
integration test's format validator.
   
   - Serialize metric collection and snapshot publication using a dedicated 
lock. First requests recheck the cache after acquiring it; requests with an 
existing snapshot retain the fast, lock-free read path.
   - Protect Linux disk refreshes and reads with the same monitor, return 
copies of counter maps, and reuse the timestamp checked for refresh 
eligibility. Zero or backward elapsed intervals retain the previous sample 
instead of reaching the rate calculation.
   - Accept the Prometheus text format's valid `NaN`, `+Inf`, and `-Inf` sample 
values in the integration-test validator while continuing to reject malformed 
values.
   
   The regression tests control overlapping collection calls, exercise snapshot 
initialization/removal, and test Linux disk sampling with temporary proc/sys 
fixtures and a controlled clock.
   
   ## Validation
   
   All checks below passed locally on macOS arm64 with Corretto JDK 17:
   - Clean reactor unit-test build for `PrometheusReporterTest` and 
`LinuxDiskMetricsManagerTest`: **9 tests passed**.
   - Clean `ClusterIT` / `with-integration-tests` verify for `IoTDBMetricIT` 
and `IoTDBMetricFormatIT`: **4 tests passed**, including the original failing 
method.
   - Full-reactor `mvn test-compile -DskipTests`.
   - Full-reactor `mvn test-compile -DskipTests -P with-zh-locale`.
   - Spotless and `git diff --check`.
   
   The four new Prometheus concurrency tests were also run against the pre-fix 
reporter: all four failed, then passed with this change. Local integration 
verification used an external RAT exclusion file to omit pre-existing, 
untracked `diagrams/` SVG files; repository license configuration is unchanged.
   
   This PR has:
   - [x] been self-reviewed, including concurrent reads and writes.
   - [x] added unit and integration regression tests.
   - [x] been tested in a 1 ConfigNode / 3 DataNode cluster.
   
   


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