You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1251 lines
101 KiB

6 years ago
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
6 years ago
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
6 years ago
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
6 years ago
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
6 years ago
/******/ })
/************************************************************************/
/******/ ({
/***/ "./src/config.ts":
/*!***********************!*\
!*** ./src/config.ts ***!
\***********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(/*! path */ "path");
exports.ANALYTICS_PATH = path.join(__dirname, '../../analytics');
exports.DATA_PATH = path.join(__dirname, '../../data');
exports.DATASETS_PATH = path.join(exports.DATA_PATH, 'datasets');
exports.ANOMALIES_PATH = path.join(exports.DATA_PATH, 'anomalies');
exports.MODELS_PATH = path.join(exports.DATA_PATH, 'models');
exports.METRICS_PATH = path.join(exports.DATA_PATH, 'metrics');
exports.SEGMENTS_PATH = path.join(exports.DATA_PATH, 'segments');
/***/ }),
6 years ago
/***/ "./src/index.ts":
/*!**********************!*\
!*** ./src/index.ts ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
6 years ago
"use strict";
6 years ago
6 years ago
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
6 years ago
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : new P(function (resolve) {
resolve(result.value);
}).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
6 years ago
};
6 years ago
Object.defineProperty(exports, "__esModule", { value: true });
const Koa = __webpack_require__(/*! koa */ "koa");
const Router = __webpack_require__(/*! koa-router */ "koa-router");
const bodyParser = __webpack_require__(/*! koa-bodyparser */ "koa-bodyparser");
const anomalies_1 = __webpack_require__(/*! ./routes/anomalies */ "./src/routes/anomalies.ts");
const segments_1 = __webpack_require__(/*! ./routes/segments */ "./src/routes/segments.ts");
const alerts_1 = __webpack_require__(/*! ./routes/alerts */ "./src/routes/alerts.ts");
const data_1 = __webpack_require__(/*! ./services/data */ "./src/services/data.ts");
data_1.checkDataFolders();
var app = new Koa();
const PORT = process.env.HASTIC_PORT || 8000;
app.use(bodyParser());
app.use(function (ctx, next) {
return __awaiter(this, void 0, void 0, function* () {
ctx.set('Access-Control-Allow-Origin', '*');
ctx.set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH, OPTIONS');
ctx.set('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
next();
6 years ago
});
});
var rootRouter = new Router();
rootRouter.use('/anomalies', anomalies_1.router.routes(), anomalies_1.router.allowedMethods());
rootRouter.use('/segments', segments_1.router.routes(), segments_1.router.allowedMethods());
rootRouter.use('/alerts', alerts_1.router.routes(), alerts_1.router.allowedMethods());
rootRouter.get('/', ctx => __awaiter(undefined, void 0, void 0, function* () {
ctx.response.body = { status: 'Ok ok' };
}));
app.use(rootRouter.routes()).use(rootRouter.allowedMethods());
app.listen(PORT, () => {
console.log(`Server is running on :${PORT}`);
});
6 years ago
6 years ago
/***/ }),
6 years ago
/***/ "./src/routes/alerts.ts":
/*!******************************!*\
!*** ./src/routes/alerts.ts ***!
\******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
6 years ago
"use strict";
6 years ago
Object.defineProperty(exports, "__esModule", { value: true });
const anomalyType_1 = __webpack_require__(/*! ../services/anomalyType */ "./src/services/anomalyType.ts");
const alerts_1 = __webpack_require__(/*! ../services/alerts */ "./src/services/alerts.ts");
const Router = __webpack_require__(/*! koa-router */ "koa-router");
function getAlert(ctx) {
let anomalyId = ctx.request.query.anomaly_id;
let anomaly = anomalyType_1.loadAnomalyById(anomalyId);
if (anomaly == null) {
anomalyId = anomalyType_1.getAnomalyIdByName(anomalyId.toLowerCase());
}
let alertsAnomalies = alerts_1.getAlertsAnomalies();
let pos = alertsAnomalies.indexOf(anomalyId);
let enable = pos !== -1;
ctx.response.body = { enable };
}
function changeAlert(ctx) {
let anomalyId = ctx.request.body.anomaly_id;
let enable = ctx.request.body.enable;
let anomaly = anomalyType_1.loadAnomalyById(anomalyId);
if (anomaly == null) {
anomalyId = anomalyType_1.getAnomalyIdByName(anomalyId.toLowerCase());
6 years ago
}
let alertsAnomalies = alerts_1.getAlertsAnomalies();
let pos = alertsAnomalies.indexOf(anomalyId);
if (enable && pos == -1) {
alertsAnomalies.push(anomalyId);
alerts_1.saveAlertsAnomalies(alertsAnomalies);
} else if (!enable && pos > -1) {
alertsAnomalies.splice(pos, 1);
alerts_1.saveAlertsAnomalies(alertsAnomalies);
6 years ago
}
ctx.response.body = { status: 'OK' };
}
exports.router = new Router();
exports.router.get('/', getAlert);
exports.router.post('/', changeAlert);
/***/ }),
6 years ago
/***/ "./src/routes/anomalies.ts":
/*!*********************************!*\
!*** ./src/routes/anomalies.ts ***!
\*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
6 years ago
"use strict";
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : new P(function (resolve) {
resolve(result.value);
}).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const Router = __webpack_require__(/*! koa-router */ "koa-router");
const anomalyType_1 = __webpack_require__(/*! ../services/anomalyType */ "./src/services/anomalyType.ts");
const analytics_1 = __webpack_require__(/*! ../services/analytics */ "./src/services/analytics.ts");
const metrics_1 = __webpack_require__(/*! ../services/metrics */ "./src/services/metrics.ts");
function sendAnomalyTypeStatus(ctx) {
return __awaiter(this, void 0, void 0, function* () {
let id = ctx.request.query.id;
let name = ctx.request.query.name;
try {
let anomaly;
if (id !== undefined) {
anomaly = anomalyType_1.loadAnomalyById(id);
} else {
anomaly = anomalyType_1.loadAnomalyByName(name);
6 years ago
}
if (anomaly === null) {
ctx.response.status = 404;
return;
}
if (anomaly.status === undefined) {
throw new Error('No status for ' + name);
}
ctx.response.body = { status: anomaly.status, errorMessage: anomaly.error };
} catch (e) {
console.error(e);
// TODO: better send 404 when we know than isn`t found
ctx.response.status = 500;
ctx.response.body = { error: 'Can`t return anything' };
}
});
}
function getAnomaly(ctx) {
return __awaiter(this, void 0, void 0, function* () {
try {
let id = ctx.request.query.id;
let name = ctx.request.query.name;
let anomaly;
if (id !== undefined) {
anomaly = anomalyType_1.loadAnomalyById(id);
} else {
anomaly = anomalyType_1.loadAnomalyByName(name.toLowerCase());
}
if (anomaly === null) {
ctx.response.status = 404;
return;
6 years ago
}
ctx.response.body = {
name: anomaly.name,
metric: anomaly.metric,
status: anomaly.status
};
} catch (e) {
console.error(e);
// TODO: better send 404 when we know than isn`t found
ctx.response.status = 500;
ctx.response.body = 'Can`t get anything';
6 years ago
}
});
}
function createAnomaly(ctx) {
return __awaiter(this, void 0, void 0, function* () {
try {
let body = ctx.request.body;
const metric = {
datasource: body.metric.datasource,
targets: metrics_1.saveTargets(body.metric.targets)
};
const anomaly = {
name: body.name,
panelUrl: body.panelUrl,
pattern: body.pattern.toLowerCase(),
metric: metric,
datasource: body.datasource,
status: 'learning',
last_prediction_time: 0,
next_id: 0
};
let anomalyId = anomalyType_1.insertAnomaly(anomaly);
if (anomalyId === null) {
ctx.response.status = 403;
ctx.response.body = {
code: 403,
message: 'Already exists'
};
}
ctx.response.body = { anomaly_id: anomalyId };
analytics_1.runLearning(anomalyId);
} catch (e) {
ctx.response.status = 500;
ctx.response.body = {
code: 500,
message: 'Internal error'
};
}
});
}
function deleteAnomaly(ctx) {
try {
let id = ctx.request.query.id;
let name = ctx.request.query.name;
if (id !== undefined) {
anomalyType_1.removeAnomaly(id);
} else {
anomalyType_1.removeAnomaly(name.toLowerCase());
}
ctx.response.body = {
code: 200,
message: 'Success'
};
} catch (e) {
ctx.response.status = 500;
ctx.response.body = {
code: 500,
message: 'Internal error'
};
}
}
exports.router = new Router();
exports.router.get('/status', sendAnomalyTypeStatus);
exports.router.get('/', getAnomaly);
exports.router.post('/', createAnomaly);
exports.router.delete('/', deleteAnomaly);
/***/ }),
/***/ "./src/routes/segments.ts":
/*!********************************!*\
!*** ./src/routes/segments.ts ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : new P(function (resolve) {
resolve(result.value);
}).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const Router = __webpack_require__(/*! koa-router */ "koa-router");
const segments_1 = __webpack_require__(/*! ../services/segments */ "./src/services/segments.ts");
const anomalyType_1 = __webpack_require__(/*! ../services/anomalyType */ "./src/services/anomalyType.ts");
const analytics_1 = __webpack_require__(/*! ../services/analytics */ "./src/services/analytics.ts");
function sendSegments(ctx) {
return __awaiter(this, void 0, void 0, function* () {
let anomalyId = ctx.request.query.anomaly_id;
let anomaly = anomalyType_1.loadAnomalyById(anomalyId);
if (anomaly === null) {
anomalyId = anomalyType_1.getAnomalyIdByName(anomalyId);
}
let lastSegmentId = ctx.request.query.last_segment;
let timeFrom = ctx.request.query.from;
let timeTo = ctx.request.query.to;
let segments = segments_1.getLabeledSegments(anomalyId);
// Id filtering
if (lastSegmentId !== undefined) {
segments = segments.filter(el => el.id > lastSegmentId);
}
// Time filtering
if (timeFrom !== undefined) {
segments = segments.filter(el => el.finish > timeFrom);
}
if (timeTo !== undefined) {
segments = segments.filter(el => el.start < timeTo);
}
ctx.response.body = { segments };
});
}
function updateSegments(ctx) {
return __awaiter(this, void 0, void 0, function* () {
try {
let segmentsUpdate = ctx.request.body;
let anomalyId = segmentsUpdate.anomaly_id;
let anomalyName = segmentsUpdate.name;
if (anomalyId === undefined) {
anomalyId = anomalyType_1.getAnomalyIdByName(anomalyName.toLowerCase());
}
let addedIds = segments_1.insertSegments(anomalyId, segmentsUpdate.added_segments, true);
segments_1.removeSegments(anomalyId, segmentsUpdate.removed_segments);
ctx.response.body = { added_ids: addedIds };
analytics_1.runLearning(anomalyId);
} catch (e) {
ctx.response.status = 500;
ctx.response.body = {
code: 500,
message: 'Internal error'
};
}
});
}
exports.router = new Router();
exports.router.get('/', sendSegments);
exports.router.patch('/', updateSegments);
6 years ago
6 years ago
/***/ }),
/***/ "./src/services/alerts.ts":
/*!********************************!*\
!*** ./src/services/alerts.ts ***!
\********************************/
/*! no static exports found */
6 years ago
/***/ (function(module, exports, __webpack_require__) {
6 years ago
6 years ago
"use strict";
6 years ago
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
6 years ago
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : new P(function (resolve) {
resolve(result.value);
}).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const json_1 = __webpack_require__(/*! ./json */ "./src/services/json.ts");
const analytics_1 = __webpack_require__(/*! ./analytics */ "./src/services/analytics.ts");
const notification_1 = __webpack_require__(/*! ./notification */ "./src/services/notification.ts");
const segments_1 = __webpack_require__(/*! ./segments */ "./src/services/segments.ts");
const config_1 = __webpack_require__(/*! ../config */ "./src/config.ts");
const path = __webpack_require__(/*! path */ "path");
const fs = __webpack_require__(/*! fs */ "fs");
const ALERTS_DB_PATH = path.join(config_1.ANOMALIES_PATH, `alerts_anomalies.json`);
function getAlertsAnomalies() {
if (!fs.existsSync(ALERTS_DB_PATH)) {
saveAlertsAnomalies([]);
}
return json_1.getJsonDataSync(ALERTS_DB_PATH);
6 years ago
}
exports.getAlertsAnomalies = getAlertsAnomalies;
function saveAlertsAnomalies(anomalies) {
return json_1.writeJsonDataSync(ALERTS_DB_PATH, anomalies);
}
exports.saveAlertsAnomalies = saveAlertsAnomalies;
function processAlerts(anomalyId) {
let segments = segments_1.getLabeledSegments(anomalyId);
const currentTime = new Date().getTime();
const activeAlert = activeAlerts.has(anomalyId);
let newActiveAlert = false;
if (segments.length > 0) {
let lastSegment = segments[segments.length - 1];
if (lastSegment.finish >= currentTime - alertTimeout) {
newActiveAlert = true;
}
}
if (!activeAlert && newActiveAlert) {
activeAlerts.add(anomalyId);
notification_1.sendNotification(anomalyId, true);
} else if (activeAlert && !newActiveAlert) {
activeAlerts.delete(anomalyId);
notification_1.sendNotification(anomalyId, false);
}
}
function alertsTick() {
return __awaiter(this, void 0, void 0, function* () {
let alertsAnomalies = getAlertsAnomalies();
for (let anomalyId of alertsAnomalies) {
try {
yield analytics_1.runPredict(anomalyId);
processAlerts(anomalyId);
} catch (e) {
console.error(e);
}
}
setTimeout(alertsTick, 5000);
});
}
const alertTimeout = 60000; // ms
const activeAlerts = new Set();
setTimeout(alertsTick, 5000);
6 years ago
6 years ago
/***/ }),
/***/ "./src/services/analytics.ts":
/*!***********************************!*\
!*** ./src/services/analytics.ts ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
6 years ago
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : new P(function (resolve) {
resolve(result.value);
}).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = __webpack_require__(/*! child_process */ "child_process");
const config_1 = __webpack_require__(/*! ../config */ "./src/config.ts");
const anomalyType_1 = __webpack_require__(/*! ./anomalyType */ "./src/services/anomalyType.ts");
const metrics_1 = __webpack_require__(/*! ./metrics */ "./src/services/metrics.ts");
const segments_1 = __webpack_require__(/*! ./segments */ "./src/services/segments.ts");
const event_stream_1 = __webpack_require__(/*! event-stream */ "event-stream");
const fs = __webpack_require__(/*! fs */ "fs");
const path = __webpack_require__(/*! path */ "path");
var learnWorker;
if (fs.existsSync(path.join(config_1.ANALYTICS_PATH, 'dist/worker/worker'))) {
learnWorker = child_process_1.spawn('dist/worker/worker', [], { cwd: config_1.ANALYTICS_PATH });
} else {
// If compiled analytics script doesn't exist - fallback to regular python
learnWorker = child_process_1.spawn('python3', ['worker.py'], { cwd: config_1.ANALYTICS_PATH });
6 years ago
}
learnWorker.stdout.pipe(event_stream_1.split()).pipe(event_stream_1.mapSync(onMessage));
learnWorker.stderr.on('data', data => console.error(`worker stderr: ${data}`));
const taskMap = {};
let nextTaskId = 0;
function onMessage(data) {
console.log(`worker stdout: ${data}`);
let response = JSON.parse(data);
let taskId = response.__task_id;
// let anomalyName = response.anomaly_name;
// let task = response.task;
let status = response.status;
if (status === 'success' || status === 'failed') {
if (taskId in taskMap) {
let resolver = taskMap[taskId];
resolver(response);
delete taskMap[taskId];
}
}
6 years ago
}
function runTask(task) {
let anomaly = anomalyType_1.loadAnomalyById(task.anomaly_id);
task.metric = {
datasource: anomaly.metric.datasource,
targets: anomaly.metric.targets.map(t => metrics_1.getTarget(t))
};
task.__task_id = nextTaskId++;
let command = JSON.stringify(task);
learnWorker.stdin.write(`${command}\n`);
return new Promise((resolve, reject) => {
taskMap[task.__task_id] = resolve;
});
6 years ago
}
function runLearning(anomalyId) {
return __awaiter(this, void 0, void 0, function* () {
let segments = segments_1.getLabeledSegments(anomalyId);
anomalyType_1.setAnomalyStatus(anomalyId, 'learning');
let anomaly = anomalyType_1.loadAnomalyById(anomalyId);
let pattern = anomaly.pattern;
let task = {
type: 'learn',
anomaly_id: anomalyId,
pattern,
segments: segments
};
let result = yield runTask(task);
if (result.status === 'success') {
anomalyType_1.setAnomalyStatus(anomalyId, 'ready');
segments_1.insertSegments(anomalyId, result.segments, false);
anomalyType_1.setAnomalyPredictionTime(anomalyId, result.last_prediction_time);
6 years ago
} else {
anomalyType_1.setAnomalyStatus(anomalyId, 'failed', result.error);
6 years ago
}
});
}
exports.runLearning = runLearning;
function runPredict(anomalyId) {
return __awaiter(this, void 0, void 0, function* () {
let anomaly = anomalyType_1.loadAnomalyById(anomalyId);
let pattern = anomaly.pattern;
let task = {
type: 'predict',
anomaly_id: anomalyId,
pattern,
last_prediction_time: anomaly.last_prediction_time
6 years ago
};
let result = yield runTask(task);
if (result.status === 'failed') {
return [];
}
// Merging segments
let segments = segments_1.getLabeledSegments(anomalyId);
if (segments.length > 0 && result.segments.length > 0) {
let lastOldSegment = segments[segments.length - 1];
let firstNewSegment = result.segments[0];
if (firstNewSegment.start <= lastOldSegment.finish) {
result.segments[0].start = lastOldSegment.start;
segments_1.removeSegments(anomalyId, [lastOldSegment.id]);
}
}
segments_1.insertSegments(anomalyId, result.segments, false);
anomalyType_1.setAnomalyPredictionTime(anomalyId, result.last_prediction_time);
return result.segments;
});
}
exports.runPredict = runPredict;
/***/ }),
/***/ "./src/services/anomalyType.ts":
/*!*************************************!*\
!*** ./src/services/anomalyType.ts ***!
\*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(/*! path */ "path");
const json_1 = __webpack_require__(/*! ./json */ "./src/services/json.ts");
const config_1 = __webpack_require__(/*! ../config */ "./src/config.ts");
const fs = __webpack_require__(/*! fs */ "fs");
const crypto = __webpack_require__(/*! crypto */ "crypto");
let anomaliesNameToIdMap = {};
function loadAnomaliesMap() {
let filename = path.join(config_1.ANOMALIES_PATH, `all_anomalies.json`);
if (!fs.existsSync(filename)) {
saveAnomaliesMap();
}
anomaliesNameToIdMap = json_1.getJsonDataSync(filename);
}
function saveAnomaliesMap() {
let filename = path.join(config_1.ANOMALIES_PATH, `all_anomalies.json`);
json_1.writeJsonDataSync(filename, anomaliesNameToIdMap);
}
function getAnomalyIdByName(anomalyName) {
loadAnomaliesMap();
anomalyName = anomalyName.toLowerCase();
if (anomalyName in anomaliesNameToIdMap) {
return anomaliesNameToIdMap[anomalyName];
}
return anomalyName;
}
exports.getAnomalyIdByName = getAnomalyIdByName;
function insertAnomaly(anomaly) {
const hashString = anomaly.name + new Date().toString();
const anomalyId = crypto.createHash('md5').update(hashString).digest('hex');
anomaliesNameToIdMap[anomaly.name] = anomalyId;
saveAnomaliesMap();
// return anomalyId
// const anomalyId:AnomalyId = anomaly.name;
let filename = path.join(config_1.ANOMALIES_PATH, `${anomalyId}.json`);
if (fs.existsSync(filename)) {
return null;
}
saveAnomaly(anomalyId, anomaly);
return anomalyId;
}
exports.insertAnomaly = insertAnomaly;
function removeAnomaly(anomalyId) {
let filename = path.join(config_1.ANOMALIES_PATH, `${anomalyId}.json`);
fs.unlinkSync(filename);
}
exports.removeAnomaly = removeAnomaly;
function saveAnomaly(anomalyId, anomaly) {
let filename = path.join(config_1.ANOMALIES_PATH, `${anomalyId}.json`);
return json_1.writeJsonDataSync(filename, anomaly);
}
exports.saveAnomaly = saveAnomaly;
function loadAnomalyById(anomalyId) {
let filename = path.join(config_1.ANOMALIES_PATH, `${anomalyId}.json`);
if (!fs.existsSync(filename)) {
return null;
}
return json_1.getJsonDataSync(filename);
}
exports.loadAnomalyById = loadAnomalyById;
function loadAnomalyByName(anomalyName) {
let anomalyId = getAnomalyIdByName(anomalyName);
return loadAnomalyById(anomalyId);
}
exports.loadAnomalyByName = loadAnomalyByName;
function saveAnomalyTypeInfo(info) {
console.log('Saving');
let filename = path.join(config_1.ANOMALIES_PATH, `${info.name}.json`);
if (info.next_id === undefined) {
info.next_id = 0;
}
if (info.last_prediction_time === undefined) {
info.last_prediction_time = 0;
}
return json_1.writeJsonDataSync(filename, info);
6 years ago
}
exports.saveAnomalyTypeInfo = saveAnomalyTypeInfo;
function getAnomalyTypeInfo(name) {
return json_1.getJsonDataSync(path.join(config_1.ANOMALIES_PATH, `${name}.json`));
}
exports.getAnomalyTypeInfo = getAnomalyTypeInfo;
function setAnomalyStatus(anomalyId, status, error) {
let info = loadAnomalyById(anomalyId);
info.status = status;
if (error !== undefined) {
info.error = error;
} else {
info.error = '';
}
saveAnomaly(anomalyId, info);
6 years ago
}
exports.setAnomalyStatus = setAnomalyStatus;
function setAnomalyPredictionTime(anomalyId, lastPredictionTime) {
let info = loadAnomalyById(anomalyId);
info.last_prediction_time = lastPredictionTime;
saveAnomaly(anomalyId, info);
6 years ago
}
exports.setAnomalyPredictionTime = setAnomalyPredictionTime;
6 years ago
/***/ }),
/***/ "./src/services/data.ts":
/*!******************************!*\
!*** ./src/services/data.ts ***!
\******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
6 years ago
"use strict";
6 years ago
Object.defineProperty(exports, "__esModule", { value: true });
const config = __webpack_require__(/*! ../config */ "./src/config.ts");
const fs = __webpack_require__(/*! fs */ "fs");
// see analytics/pattern_detection_model.py with folders available
function maybeCreate(path) {
if (fs.existsSync(path)) {
return;
}
fs.mkdirSync(path);
}
function checkDataFolders() {
var folders = [config.DATA_PATH, config.DATASETS_PATH, config.ANOMALIES_PATH, config.MODELS_PATH, config.METRICS_PATH, config.SEGMENTS_PATH].forEach(maybeCreate);
}
exports.checkDataFolders = checkDataFolders;
6 years ago
/***/ }),
6 years ago
/***/ "./src/services/json.ts":
/*!******************************!*\
!*** ./src/services/json.ts ***!
\******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
6 years ago
"use strict";
6 years ago
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : new P(function (resolve) {
resolve(result.value);
}).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __webpack_require__(/*! fs */ "fs");
function getJsonData(filename) {
return __awaiter(this, void 0, void 0, function* () {
var data = yield new Promise((resolve, reject) => {
fs.readFile(filename, 'utf8', (err, data) => {
if (err) {
console.error(err);
reject('Can`t read file');
} else {
resolve(data);
}
});
});
try {
return JSON.parse(data);
} catch (e) {
console.error(e);
throw new Error('Wrong file format');
}
});
}
exports.getJsonData = getJsonData;
function writeJsonData(filename, data) {
return new Promise((resolve, reject) => {
fs.writeFile(filename, JSON.stringify(data), 'utf8', err => {
if (err) {
console.error(err);
reject('Cat`t write file');
} else {
resolve();
}
});
});
}
exports.writeJsonData = writeJsonData;
function getJsonDataSync(filename) {
let data = fs.readFileSync(filename, 'utf8');
try {
return JSON.parse(data);
} catch (e) {
console.error(e);
throw new Error('Wrong file format');
6 years ago
}
}
exports.getJsonDataSync = getJsonDataSync;
function writeJsonDataSync(filename, data) {
fs.writeFileSync(filename, JSON.stringify(data));
}
exports.writeJsonDataSync = writeJsonDataSync;
/***/ }),
/***/ "./src/services/metrics.ts":
/*!*********************************!*\
!*** ./src/services/metrics.ts ***!
\*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(/*! path */ "path");
const json_1 = __webpack_require__(/*! ./json */ "./src/services/json.ts");
const config_1 = __webpack_require__(/*! ../config */ "./src/config.ts");
const crypto = __webpack_require__(/*! crypto */ "crypto");
function saveTargets(targets) {
let metrics = [];
for (let target of targets) {
metrics.push(saveTarget(target));
6 years ago
}
return metrics;
6 years ago
}
exports.saveTargets = saveTargets;
function saveTarget(target) {
//const md5 = crypto.createHash('md5')
const targetId = crypto.createHash('md5').update(JSON.stringify(target)).digest('hex');
let filename = path.join(config_1.METRICS_PATH, `${targetId}.json`);
json_1.writeJsonDataSync(filename, target);
return targetId;
6 years ago
}
function getTarget(targetId) {
let filename = path.join(config_1.METRICS_PATH, `${targetId}.json`);
return json_1.getJsonDataSync(filename);
}
exports.getTarget = getTarget;
6 years ago
6 years ago
/***/ }),
6 years ago
/***/ "./src/services/notification.ts":
/*!**************************************!*\
!*** ./src/services/notification.ts ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : new P(function (resolve) {
resolve(result.value);
}).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __webpack_require__(/*! axios */ "axios");
const anomalyType_1 = __webpack_require__(/*! ./anomalyType */ "./src/services/anomalyType.ts");
function sendNotification(anomalyId, active) {
return __awaiter(this, void 0, void 0, function* () {
let anomalyName = anomalyType_1.loadAnomalyById(anomalyId).name;
console.log('Notification ' + anomalyName);
let notification = {
anomaly: anomalyName,
status: ''
};
if (active) {
notification.status = 'alert';
} else {
notification.status = 'OK';
}
let endpoint = process.env.HASTIC_ALERT_ENDPOINT;
if (endpoint === undefined) {
console.error(`Can't send alert, env HASTIC_ALERT_ENDPOINT is undefined`);
return;
}
try {
var data = yield axios_1.default.post(endpoint, {
method: 'POST',
body: JSON.stringify(notification)
});
console.log(data);
} catch (err) {
console.error(`Can't send alert to ${endpoint}. Error: ${err}`);
}
});
}
exports.sendNotification = sendNotification;
/***/ }),
/***/ "./src/services/segments.ts":
/*!**********************************!*\
!*** ./src/services/segments.ts ***!
\**********************************/
/*! no static exports found */
6 years ago
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = __webpack_require__(/*! path */ "path");
const json_1 = __webpack_require__(/*! ./json */ "./src/services/json.ts");
const config_1 = __webpack_require__(/*! ../config */ "./src/config.ts");
const anomalyType_1 = __webpack_require__(/*! ./anomalyType */ "./src/services/anomalyType.ts");
const _ = __webpack_require__(/*! lodash */ "lodash");
function getLabeledSegments(anomalyId) {
let filename = path.join(config_1.SEGMENTS_PATH, `${anomalyId}_labeled.json`);
let segments = [];
try {
segments = json_1.getJsonDataSync(filename);
for (let segment of segments) {
if (segment.labeled === undefined) {
segment.labeled = false;
}
}
} catch (e) {
console.error(e.message);
}
return segments;
}
exports.getLabeledSegments = getLabeledSegments;
function getPredictedSegments(anomalyId) {
let filename = path.join(config_1.SEGMENTS_PATH, `${anomalyId}_segments.json`);
let jsonData;
try {
jsonData = json_1.getJsonDataSync(filename);
} catch (e) {
console.error(e.message);
jsonData = [];
}
return jsonData;
}
exports.getPredictedSegments = getPredictedSegments;
function saveSegments(anomalyId, segments) {
let filename = path.join(config_1.SEGMENTS_PATH, `${anomalyId}_labeled.json`);
try {
return json_1.writeJsonDataSync(filename, _.uniqBy(segments, 'start'));
} catch (e) {
console.error(e.message);
throw new Error('Can`t write to db');
}
}
exports.saveSegments = saveSegments;
function insertSegments(anomalyId, addedSegments, labeled) {
// Set status
let info = anomalyType_1.loadAnomalyById(anomalyId);
let segments = getLabeledSegments(anomalyId);
let nextId = info.next_id;
let addedIds = [];
for (let segment of addedSegments) {
segment.id = nextId;
segment.labeled = labeled;
addedIds.push(nextId);
nextId++;
segments.push(segment);
}
info.next_id = nextId;
saveSegments(anomalyId, segments);
anomalyType_1.saveAnomaly(anomalyId, info);
return addedIds;
}
exports.insertSegments = insertSegments;
function removeSegments(anomalyId, removedSegments) {
let segments = getLabeledSegments(anomalyId);
for (let segmentId of removedSegments) {
segments = segments.filter(el => el.id !== segmentId);
}
saveSegments(anomalyId, segments);
}
exports.removeSegments = removeSegments;
6 years ago
/***/ }),
/***/ 0:
/*!****************************!*\
!*** multi ./src/index.ts ***!
\****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! ./src/index.ts */"./src/index.ts");
/***/ }),
/***/ "axios":
/*!***********************************!*\
!*** external "require('axios')" ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require('axios');
/***/ }),
/***/ "child_process":
/*!*******************************************!*\
!*** external "require('child_process')" ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require('child_process');
/***/ }),
/***/ "crypto":
/*!************************************!*\
!*** external "require('crypto')" ***!
\************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require('crypto');
/***/ }),
/***/ "event-stream":
/*!******************************************!*\
!*** external "require('event-stream')" ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require('event-stream');
/***/ }),
/***/ "fs":
/*!********************************!*\
!*** external "require('fs')" ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require('fs');
/***/ }),
/***/ "koa":
/*!*********************************!*\
!*** external "require('koa')" ***!
\*********************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require('koa');
/***/ }),
6 years ago
/***/ "koa-bodyparser":
/*!********************************************!*\
!*** external "require('koa-bodyparser')" ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = require('koa-bodyparser');
/***/ }),
/***/ "koa-router":
/*!****************************************!*\
!*** external "require('koa-router')" ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
6 years ago
module.exports = require('koa-router');
6 years ago
/***/ }),
6 years ago
/***/ "lodash":
/*!************************************!*\
!*** external "require('lodash')" ***!
\************************************/
/*! no static exports found */
/***/ (function(module, exports) {
6 years ago
module.exports = require('lodash');
6 years ago
/***/ }),
/***/ "path":
/*!**********************************!*\
!*** external "require('path')" ***!
\**********************************/
/*! no static exports found */
/***/ (function(module, exports) {
6 years ago
module.exports = require('path');
6 years ago
/***/ })
/******/ });
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vc3JjL2NvbmZpZy50cyIsIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXgudHMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3JvdXRlcy9hbGVydHMudHMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3JvdXRlcy9hbm9tYWxpZXMudHMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3JvdXRlcy9zZWdtZW50cy50cyIsIndlYnBhY2s6Ly8vLi9zcmMvc2VydmljZXMvYWxlcnRzLnRzIiwid2VicGFjazovLy8uL3NyYy9zZXJ2aWNlcy9hbmFseXRpY3MudHMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3NlcnZpY2VzL2Fub21hbHlUeXBlLnRzIiwid2VicGFjazovLy8uL3NyYy9zZXJ2aWNlcy9kYXRhLnRzIiwid2VicGFjazovLy8uL3NyYy9zZXJ2aWN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