LuciferYang opened a new pull request, #13438:
URL: https://github.com/apache/gravitino/pull/13438

   ### What changes were proposed in this pull request?
   
   `MetricsSystem` now forwards a source's metrics through its own listener 
(same `"{name}."` prefixing and add/remove semantics, existing metrics replayed 
on attach) instead of `MetricRegistry.register(name, sourceRegistry)`. 
`unregisterSource` removes that listener and clears the forwarded metrics, so 
the source is truly detached.
   
   ### Why are the changes needed?
   
   Dropwizard's `register(name, registry)` installs an unremovable internal 
listener, so unregister could not stop a stale source from re-injecting lazily 
created metrics, leaking ghost metrics and risking an 
`IllegalArgumentException` on same-name re-registration.
   
   Fix: #13437
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `TestMetricsSystem.testUnregisterSeversSourceRegistryLink`, which pins 
that after unregister a source can no longer inject metrics and that same-name 
re-registration works. It fails against the pre-fix code.
   


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