dybyte opened a new pull request, #11492:
URL: https://github.com/apache/seatunnel/pull/11492
### Purpose of this pull request
This pull request fixes an order-dependent failure in the metrics API when a
Hazelcast node is recreated within the same JVM.
```
2026-07-19T07:51:05.6763144Z [ERROR] Failures:
2026-07-19T07:51:05.6763667Z [ERROR] MetricsApiTest.metricsApiTest:56 1
expectation failed.
2026-07-19T07:51:05.6764122Z Expected status code <200> but was <500>.
```
Previously, both process-wide JVM collectors and node-specific SeaTunnel
collectors were registered in the static `CollectorRegistry.defaultRegistry`.
After the original node was shut down, the registry could retain collectors
referencing that inactive node. A subsequent request to `/metrics` could
therefore return HTTP 500.
This patch:
- Keeps process-wide JVM collectors in `CollectorRegistry.defaultRegistry`.
- Registers SeaTunnel collectors in a node-local registry.
- Exposes metrics from both registries without copying them into an
intermediate collection.
- Allows node-specific collectors and their node references to be reclaimed
after shutdown.
- Adds a deterministic regression test that validates the metrics API before
and after recreating a Hazelcast instance in the same JVM.
### Does this PR introduce *any* user-facing change?
No
### How was this patch tested?
`MetricsApiTest` was updated to:
1. Start a Hazelcast instance and verify the metrics endpoint.
2. Shut down the instance.
3. Create another Hazelcast instance in the same JVM.
4. Verify the metrics endpoint again.
5. Assert that both process-wide JVM metrics and current-node SeaTunnel
metrics are present.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [ ] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the
following files are updated:
1. Update
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
and add new connector information in it
2. Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
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]