minor refactoring according to the comments

This commit is contained in:
YevhenBondarenko 2025-03-14 12:03:44 +01:00
parent 97c7db0965
commit 16e24db293
3 changed files with 4 additions and 4 deletions

View File

@ -153,7 +153,7 @@ public class DefaultTbApiUsageStateService extends AbstractPartitionBasedService
List<TransportProtos.UsageStatsServiceMsg> msgs;
//For backward compatibility, remove after release
if (serviceMsg.getTenantIdMSB() != 0) {
if (serviceMsg.getMsgsList().isEmpty()) {
TransportProtos.UsageStatsServiceMsg oldMsg = TransportProtos.UsageStatsServiceMsg.newBuilder()
.setTenantIdMSB(serviceMsg.getTenantIdMSB())
.setTenantIdLSB(serviceMsg.getTenantIdLSB())
@ -211,7 +211,7 @@ public class DefaultTbApiUsageStateService extends AbstractPartitionBasedService
if (StringUtils.isNotEmpty(statsItem.getKey())) {
recordKey = ApiUsageRecordKey.valueOf(statsItem.getKey());
} else {
recordKey = ProtoUtils.fromProto(statsItem.getKeyProto());
recordKey = ProtoUtils.fromProto(statsItem.getRecordKey());
}
StatsCalculationResult calculationResult = usageState.calculate(recordKey, statsItem.getValue(), serviceId);

View File

@ -1737,7 +1737,7 @@ message ToTransportMsg {
message UsageStatsKVProto {
string key = 1 [deprecated=true];
int64 value = 2;
ApiUsageRecordKeyProto keyProto = 3;
ApiUsageRecordKeyProto recordKey = 3;
}
message ToUsageStatsServiceMsg {

View File

@ -119,7 +119,7 @@ public class DefaultTbApiUsageReportClient implements TbApiUsageReportClient {
});
UsageStatsKVProto.Builder statsItem = UsageStatsKVProto.newBuilder()
.setKeyProto(ProtoUtils.toProto(key))
.setRecordKey(ProtoUtils.toProto(key))
.setValue(value);
statsMsg.addValues(statsItem.build());
});