zihanx opened a new pull request, #15507:
URL: https://github.com/apache/lucene/pull/15507
## Summary
This PR enhances the `runOnMergeFinished` hook in `ConcurrentMergeScheduler`
to provide access to `OneMerge` and `MergeRateLimiter` parameters.
## Motivation
Currently, applications that subclass `ConcurrentMergeScheduler` to monitor
merge behavior have limited context in the `runOnMergeFinished` hook. The
`MergeRateLimiter` contains valuable metrics about merge performance
(pause time, throttling, MB/sec) that would be useful for:
- Monitoring merge performance in production
- Building custom metrics and dashboards
- Debugging merge-related issues
- Optimizing merge scheduler configurations
## Changes
- Changed `runOnMergeFinished` from package-private to `protected` to allow
subclassing
- Added `OneMerge merge` parameter for merge context
- Added `MergeRateLimiter rateLimiter` parameter to expose merge rate metrics
## Backward Compatibility
This is a breaking change for any code that currently overrides
`runOnMergeFinished`,
but since the method was package-private, external impact should be minimal.
## Example Use Case
Applications can now override this method to emit custom metrics:
```java
@Override
protected synchronized void runOnMergeFinished(MergeSource mergeSource,
OneMerge merge,
MergeRateLimiter
rateLimiter) {
super.runOnMergeFinished(mergeSource, merge, rateLimiter);
// Emit custom metrics
recordMetric("merge.paused.ns", rateLimiter.getTotalPausedNS());
recordMetric("merge.stopped.ns", rateLimiter.getTotalStoppedNS());
recordMetric("merge.mbps", rateLimiter.getMBPerSec());
}
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]