Protection from runtime errors during statistics processing
This commit is contained in:
parent
f4a44e3928
commit
c7babf2085
@ -78,8 +78,8 @@ public class DefaultRuleEngineStatisticsService implements RuleEngineStatisticsS
|
||||
public void reportQueueStats(long ts, TbRuleEngineConsumerStats ruleEngineStats) {
|
||||
String queueName = ruleEngineStats.getQueueName();
|
||||
ruleEngineStats.getTenantStats().forEach((id, stats) -> {
|
||||
TenantId tenantId = TenantId.fromUUID(id);
|
||||
try {
|
||||
TenantId tenantId = TenantId.fromUUID(id);
|
||||
AssetId serviceAssetId = getServiceAssetId(tenantId, queueName);
|
||||
if (stats.getTotalMsgCounter().get() > 0) {
|
||||
List<TsKvEntry> tsList = stats.getCounters().entrySet().stream()
|
||||
@ -89,19 +89,19 @@ public class DefaultRuleEngineStatisticsService implements RuleEngineStatisticsS
|
||||
tsService.saveAndNotifyInternal(tenantId, serviceAssetId, tsList, CALLBACK);
|
||||
}
|
||||
}
|
||||
} catch (DataValidationException e) {
|
||||
if (!e.getMessage().equalsIgnoreCase("Asset is referencing to non-existent tenant!")) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
if (!"Asset is referencing to non-existent tenant!".equalsIgnoreCase(e.getMessage())) {
|
||||
log.debug("[{}] Failed to store the statistics", id, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
ruleEngineStats.getTenantExceptions().forEach((tenantId, e) -> {
|
||||
TsKvEntry tsKv = new BasicTsKvEntry(e.getTs(), new JsonDataEntry("ruleEngineException", e.toJsonString()));
|
||||
try {
|
||||
TsKvEntry tsKv = new BasicTsKvEntry(e.getTs(), new JsonDataEntry("ruleEngineException", e.toJsonString()));
|
||||
tsService.saveAndNotifyInternal(tenantId, getServiceAssetId(tenantId, queueName), Collections.singletonList(tsKv), CALLBACK);
|
||||
} catch (DataValidationException e2) {
|
||||
if (!e2.getMessage().equalsIgnoreCase("Asset is referencing to non-existent tenant!")) {
|
||||
throw e2;
|
||||
} catch (Exception e2) {
|
||||
if (!"Asset is referencing to non-existent tenant!".equalsIgnoreCase(e2.getMessage())) {
|
||||
log.debug("[{}] Failed to store the statistics", tenantId, e2);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user