9aman commented on code in PR #16572:
URL: https://github.com/apache/pinot/pull/16572#discussion_r2284298280
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeConsumptionRateManager.java:
##########
@@ -205,33 +224,63 @@ public QuotaUtilizationTracker(ServerMetrics
serverMetrics, String metricKeyName
/**
* Update count and return utilization ratio percentage (0 if not enough
data yet).
*/
- public int update(int numMsgsConsumed, double rateLimit, Instant now) {
+ public int update(int unitsConsumed, double rateLimit, Instant now) {
int ratioPercentage = 0;
long nowInMinutes = now.getEpochSecond() / 60;
if (nowInMinutes == _previousMinute) {
- _aggregateNumMessages += numMsgsConsumed;
+ _aggregateUnits += unitsConsumed;
} else {
if (_previousMinute != -1) { // not first time
- double actualRate = _aggregateNumMessages / ((nowInMinutes -
_previousMinute) * 60.0); // messages per second
+ double actualRate = _aggregateUnits / ((nowInMinutes -
_previousMinute) * 60.0); // units per second
ratioPercentage = (int) Math.round(actualRate / rateLimit * 100);
_serverMetrics.setValueOfTableGauge(_metricKeyName,
ServerGauge.CONSUMPTION_QUOTA_UTILIZATION,
ratioPercentage);
}
- _aggregateNumMessages = numMsgsConsumed;
+ _aggregateUnits = unitsConsumed;
_previousMinute = nowInMinutes;
}
return ratioPercentage;
}
@VisibleForTesting
- int getAggregateNumMessages() {
- return _aggregateNumMessages;
+ int getAggregateUnits() {
+ return _aggregateUnits;
}
}
@FunctionalInterface
public interface ConsumptionRateLimiter {
- void throttle(int numMsgs);
+ void throttle(MessageBatch messageBatch);
+ }
+
Review Comment:
```suggestion
@FunctionalInterface
```
--
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]