xiangfu0 opened a new pull request, #16676: URL: https://github.com/apache/pinot/pull/16676
## Summary This PR adds a new `QUERIES_THROTTLED` metric to track when queries are throttled due to high heap usage in the `ThrottleOnCriticalHeapUsageExecutor`. ## Changes Made - **Added new metrics**: `ServerMeter.QUERIES_THROTTLED` and `BrokerMeter.QUERIES_THROTTLED` - **Enhanced accounting**: Modified `PerQueryCPUMemAccountantFactory.WatcherTask` to increment the throttle metric when `throttleQuerySubmission()` returns true - **Clean implementation**: Follows the existing pattern used by `HEAP_CRITICAL_LEVEL_EXCEEDED` metric without modifying the `ThrottleOnCriticalHeapUsageExecutor` constructor ## Implementation Details The metric is incremented directly in the `throttleQuerySubmission()` method of `PerQueryCPUMemAccountantFactory`, which is called by `ThrottleOnCriticalHeapUsageExecutor` when checking if queries should be throttled due to heap usage exceeding the alarming level. This approach: - ✅ Follows existing patterns in the codebase (similar to `HEAP_CRITICAL_LEVEL_EXCEEDED`) - ✅ Maintains clean separation of concerns - ✅ Requires no changes to executor constructors - ✅ Provides accurate throttling metrics for monitoring ## Testing - All existing tests pass - Metric is only incremented when actual throttling occurs - Compatible with both server and broker instances ## Files Changed - `pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMeter.java` - Added QUERIES_THROTTLED meter - `pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerMeter.java` - Added QUERIES_THROTTLED meter - `pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java` - Added throttle metric tracking -- 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]
