|
|
@ -25,6 +25,7 @@ export type Anomaly = { |
|
|
|
metric: Metric, |
|
|
|
metric: Metric, |
|
|
|
datasource: Datasource |
|
|
|
datasource: Datasource |
|
|
|
status: string, |
|
|
|
status: string, |
|
|
|
|
|
|
|
error?: string, |
|
|
|
|
|
|
|
|
|
|
|
last_prediction_time: number, |
|
|
|
last_prediction_time: number, |
|
|
|
next_id: number |
|
|
|
next_id: number |
|
|
@ -108,9 +109,14 @@ function getAnomalyTypeInfo(name) { |
|
|
|
return getJsonDataSync(path.join(ANOMALIES_PATH, `${name}.json`)); |
|
|
|
return getJsonDataSync(path.join(ANOMALIES_PATH, `${name}.json`)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setAnomalyStatus(anomalyId:AnomalyId, status:string) { |
|
|
|
function setAnomalyStatus(anomalyId:AnomalyId, status:string, error?:string) { |
|
|
|
let info = loadAnomalyById(anomalyId); |
|
|
|
let info = loadAnomalyById(anomalyId); |
|
|
|
info.status = status; |
|
|
|
info.status = status; |
|
|
|
|
|
|
|
if(error !== undefined) { |
|
|
|
|
|
|
|
info.error = error; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
info.error = ''; |
|
|
|
|
|
|
|
} |
|
|
|
saveAnomaly(anomalyId, info); |
|
|
|
saveAnomaly(anomalyId, info); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|