Browse Source

Fix POST /anomalies to receive datasource

pull/1/head
rozetko 7 years ago
parent
commit
b9917d34f9
  1. 2
      server/src/routes/anomalies.ts
  2. 9
      server/src/services/anomalyType.ts

2
server/src/routes/anomalies.ts

@ -1,6 +1,7 @@
import * as express from 'express';
import {
Datasource,
Metric,
Anomaly,
saveAnomaly,
@ -81,6 +82,7 @@ async function createAnomaly(req, res) {
name: req.body.name,
panelUrl: req.body.panelUrl,
metric: metric,
datasource: req.body.datasource,
status: 'learning',
last_prediction_time: 0,
next_id: 0

9
server/src/services/anomalyType.ts

@ -4,6 +4,14 @@ import { ANOMALIES_PATH } from '../config'
import * as fs from 'fs'
import * as crypto from 'crypto';
export type Datasource = {
method: string,
data: Object,
params: Object,
type: string,
url: string
}
export type Metric = {
datasource: string,
targets: string[]
@ -15,6 +23,7 @@ export type Anomaly = {
panelUrl: string,
metric: Metric,
datasource: Datasource
status: string,
last_prediction_time: number,

Loading…
Cancel
Save