[autofix.ci] apply automated fixes
This commit is contained in:
parent
093ddab3aa
commit
e5d85c7fcd
@ -13,4 +13,3 @@ exports.down = function (knex) {
|
||||
table.dropColumn("retry_only_on_status_code_failure");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -683,11 +683,15 @@ class Monitor extends BeanModel {
|
||||
if (status) {
|
||||
bean.status = UP;
|
||||
bean.msg = `JSON query passes (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})`;
|
||||
|
||||
|
||||
// Store numeric value if response is numeric (will be stored after heartbeat is saved)
|
||||
// Store it in a temporary variable, not on the bean, to avoid database column errors
|
||||
if (typeof response === "number" || (typeof response === "string" && !isNaN(parseFloat(response)))) {
|
||||
this._pendingNumericValue = typeof response === "number" ? response : parseFloat(response);
|
||||
if (
|
||||
typeof response === "number" ||
|
||||
(typeof response === "string" && !isNaN(parseFloat(response)))
|
||||
) {
|
||||
this._pendingNumericValue =
|
||||
typeof response === "number" ? response : parseFloat(response);
|
||||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
@ -945,12 +949,13 @@ class Monitor extends BeanModel {
|
||||
// For json-query monitors with retry_only_on_status_code_failure enabled,
|
||||
// only retry if the error is NOT from JSON query evaluation
|
||||
// JSON query errors have the message "JSON query does not pass..."
|
||||
const isJsonQueryError = this.type === "json-query" &&
|
||||
typeof error.message === "string" &&
|
||||
const isJsonQueryError =
|
||||
this.type === "json-query" &&
|
||||
typeof error.message === "string" &&
|
||||
error.message.includes("JSON query does not pass");
|
||||
|
||||
|
||||
const shouldSkipRetry = isJsonQueryError && this.retry_only_on_status_code_failure;
|
||||
|
||||
|
||||
if (shouldSkipRetry) {
|
||||
// Don't retry on JSON query failures, mark as DOWN immediately
|
||||
retries = 0;
|
||||
@ -1063,7 +1068,7 @@ class Monitor extends BeanModel {
|
||||
// Store to database
|
||||
log.debug("monitor", `[${this.name}] Store`);
|
||||
await R.store(bean);
|
||||
|
||||
|
||||
// Store numeric value if available (stored by monitor types like SNMP and JSON-query)
|
||||
// Check for pending numeric value stored during the check (not on bean to avoid DB column errors)
|
||||
if (this._pendingNumericValue !== undefined && this._pendingNumericValue !== null) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user