parent
1104c4e8f6
commit
8b0a1f5538
@ -96,8 +96,7 @@ public class DefaultRuleEngineStatisticsService implements RuleEngineStatisticsS
|
||||
}
|
||||
});
|
||||
ruleEngineStats.getTenantExceptions().forEach((tenantId, e) -> {
|
||||
TsKvEntry tsKv = new BasicTsKvEntry(e.getTs(), new JsonDataEntry("ruleEngineException",
|
||||
JacksonUtil.toString(JacksonUtil.newObjectNode().put("message", e.getMessage()))));
|
||||
TsKvEntry tsKv = new BasicTsKvEntry(e.getTs(), new JsonDataEntry("ruleEngineException", e.toJsonString()));
|
||||
try {
|
||||
tsService.saveAndNotifyInternal(tenantId, getServiceAssetId(tenantId, queueName), Collections.singletonList(tsKv), CALLBACK);
|
||||
} catch (DataValidationException e2) {
|
||||
|
||||
@ -25,11 +25,19 @@ public class RuleEngineException extends Exception {
|
||||
protected static final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@Getter
|
||||
private final long ts;
|
||||
private long ts;
|
||||
|
||||
public RuleEngineException(String message) {
|
||||
super(message != null ? message : "Unknown");
|
||||
this.ts = System.currentTimeMillis();
|
||||
ts = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public String toJsonString() {
|
||||
try {
|
||||
return mapper.writeValueAsString(mapper.createObjectNode().put("message", getMessage()));
|
||||
} catch (JsonProcessingException e) {
|
||||
log.warn("Failed to serialize exception ", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ class AlarmRuleState {
|
||||
var longValue = getLongValue(keyValue);
|
||||
if (longValue == null) {
|
||||
String sourceAttribute = dynamicValue.getSourceAttribute();
|
||||
throw new NumericParseException(String.format("could not parse attribute [%s: %s] from source!", sourceAttribute, getStrValue(keyValue)));
|
||||
throw new NumericParseException(String.format("Could not convert attribute '%s' with value '%s' to numeric value!", sourceAttribute, getStrValue(keyValue)));
|
||||
}
|
||||
return longValue;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ import java.util.function.BiFunction;
|
||||
@Slf4j
|
||||
class AlarmState {
|
||||
|
||||
public static final String ERROR_MSG = "Failed to process alarm state for Device [%s]: %s";
|
||||
public static final String ERROR_MSG = "Failed to process alarm rule for Device [%s]: %s";
|
||||
private final ProfileState deviceProfile;
|
||||
private final EntityId originator;
|
||||
private DeviceProfileAlarm alarmDefinition;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user