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.
 
 
 
 
 

1615 lines
115 KiB

/******/ (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, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // 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 = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 14);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = require('babel-runtime/regenerator');
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = require('babel-runtime/core-js/promise');
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path = __webpack_require__(4);
var json_1 = __webpack_require__(6);
var config_1 = __webpack_require__(3);
var fs = __webpack_require__(8);
var crypto = __webpack_require__(12);
var anomaliesNameToIdMap = {};
function loadAnomaliesMap() {
var filename = path.join(config_1.ANOMALIES_PATH, "all_anomalies.json");
if (!fs.existsSync(filename)) {
saveAnomaliesMap();
}
anomaliesNameToIdMap = json_1.getJsonDataSync(filename);
}
function saveAnomaliesMap() {
var 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) {
var hashString = anomaly.name + new Date().toString();
var anomalyId = crypto.createHash('md5').update(hashString).digest('hex');
anomaliesNameToIdMap[anomaly.name] = anomalyId;
saveAnomaliesMap();
// return anomalyId
// const anomalyId:AnomalyId = anomaly.name;
var 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) {
var filename = path.join(config_1.ANOMALIES_PATH, anomalyId + ".json");
fs.unlinkSync(filename);
}
exports.removeAnomaly = removeAnomaly;
function saveAnomaly(anomalyId, anomaly) {
var filename = path.join(config_1.ANOMALIES_PATH, anomalyId + ".json");
return json_1.writeJsonDataSync(filename, anomaly);
}
exports.saveAnomaly = saveAnomaly;
function loadAnomalyById(anomalyId) {
var 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) {
var anomalyId = getAnomalyIdByName(anomalyName);
return loadAnomalyById(anomalyId);
}
exports.loadAnomalyByName = loadAnomalyByName;
function saveAnomalyTypeInfo(info) {
console.log('Saving');
var 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);
}
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) {
var info = loadAnomalyById(anomalyId);
info.status = status;
if (error !== undefined) {
info.error = error;
} else {
info.error = '';
}
saveAnomaly(anomalyId, info);
}
exports.setAnomalyStatus = setAnomalyStatus;
function setAnomalyPredictionTime(anomalyId, lastPredictionTime) {
var info = loadAnomalyById(anomalyId);
info.last_prediction_time = lastPredictionTime;
saveAnomaly(anomalyId, info);
}
exports.setAnomalyPredictionTime = setAnomalyPredictionTime;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path = __webpack_require__(4);
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');
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = require('path');
/***/ }),
/* 5 */
/***/ (function(module, exports) {
module.exports = require('koa-router');
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _stringify = __webpack_require__(7);
var _stringify2 = _interopRequireDefault(_stringify);
var _regenerator = __webpack_require__(0);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = __webpack_require__(1);
var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = _promise2.default))(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 });
var fs = __webpack_require__(8);
function getJsonData(filename) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var data;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return new _promise2.default(function (resolve, reject) {
fs.readFile(filename, 'utf8', function (err, data) {
if (err) {
console.error(err);
reject('Can`t read file');
} else {
resolve(data);
}
});
});
case 2:
data = _context.sent;
_context.prev = 3;
return _context.abrupt("return", JSON.parse(data));
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](3);
console.error(_context.t0);
throw new Error('Wrong file format');
case 11:
case "end":
return _context.stop();
}
}
}, _callee, this, [[3, 7]]);
}));
}
exports.getJsonData = getJsonData;
function writeJsonData(filename, data) {
return new _promise2.default(function (resolve, reject) {
fs.writeFile(filename, (0, _stringify2.default)(data), 'utf8', function (err) {
if (err) {
console.error(err);
reject('Cat`t write file');
} else {
resolve();
}
});
});
}
exports.writeJsonData = writeJsonData;
function getJsonDataSync(filename) {
var data = fs.readFileSync(filename, 'utf8');
try {
return JSON.parse(data);
} catch (e) {
console.error(e);
throw new Error('Wrong file format');
}
}
exports.getJsonDataSync = getJsonDataSync;
function writeJsonDataSync(filename, data) {
fs.writeFileSync(filename, (0, _stringify2.default)(data));
}
exports.writeJsonDataSync = writeJsonDataSync;
/***/ }),
/* 7 */
/***/ (function(module, exports) {
module.exports = require('babel-runtime/core-js/json/stringify');
/***/ }),
/* 8 */
/***/ (function(module, exports) {
module.exports = require('fs');
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _regenerator = __webpack_require__(0);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _stringify = __webpack_require__(7);
var _stringify2 = _interopRequireDefault(_stringify);
var _promise = __webpack_require__(1);
var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = _promise2.default))(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 });
var child_process_1 = __webpack_require__(18);
var config_1 = __webpack_require__(3);
var anomalyType_1 = __webpack_require__(2);
var metrics_1 = __webpack_require__(13);
var segments_1 = __webpack_require__(11);
var event_stream_1 = __webpack_require__(20);
var learnWorker = child_process_1.spawn('python3', ['worker.py'], { cwd: config_1.ANALYTICS_PATH });
learnWorker.stdout.pipe(event_stream_1.split()).pipe(event_stream_1.mapSync(onMessage));
learnWorker.stderr.on('data', function (data) {
return console.error("worker stderr: " + data);
});
var taskMap = {};
var nextTaskId = 0;
function onMessage(data) {
console.log("worker stdout: " + data);
var response = JSON.parse(data);
var taskId = response.__task_id;
// let anomalyName = response.anomaly_name;
// let task = response.task;
var status = response.status;
if (status === 'success' || status === 'failed') {
if (taskId in taskMap) {
var resolver = taskMap[taskId];
resolver(response);
delete taskMap[taskId];
}
}
}
function runTask(task) {
var anomaly = anomalyType_1.loadAnomalyById(task.anomaly_id);
task.metric = {
datasource: anomaly.metric.datasource,
targets: anomaly.metric.targets.map(function (t) {
return metrics_1.getTarget(t);
})
};
task.__task_id = nextTaskId++;
var command = (0, _stringify2.default)(task);
learnWorker.stdin.write(command + "\n");
return new _promise2.default(function (resolve, reject) {
taskMap[task.__task_id] = resolve;
});
}
function runLearning(anomalyId) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var segments, anomaly, pattern, task, result;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
segments = segments_1.getLabeledSegments(anomalyId);
anomalyType_1.setAnomalyStatus(anomalyId, 'learning');
anomaly = anomalyType_1.loadAnomalyById(anomalyId);
pattern = anomaly.pattern;
task = {
type: 'learn',
anomaly_id: anomalyId,
pattern: pattern,
segments: segments
};
_context.next = 7;
return runTask(task);
case 7:
result = _context.sent;
if (result.status === 'success') {
anomalyType_1.setAnomalyStatus(anomalyId, 'ready');
segments_1.insertSegments(anomalyId, result.segments, false);
anomalyType_1.setAnomalyPredictionTime(anomalyId, result.last_prediction_time);
} else {
anomalyType_1.setAnomalyStatus(anomalyId, 'failed', result.error);
}
case 9:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
}
exports.runLearning = runLearning;
function runPredict(anomalyId) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
var anomaly, pattern, task, result, segments, lastOldSegment, firstNewSegment;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
anomaly = anomalyType_1.loadAnomalyById(anomalyId);
pattern = anomaly.pattern;
task = {
type: 'predict',
anomaly_id: anomalyId,
pattern: pattern,
last_prediction_time: anomaly.last_prediction_time
};
_context2.next = 5;
return runTask(task);
case 5:
result = _context2.sent;
if (!(result.status === 'failed')) {
_context2.next = 8;
break;
}
return _context2.abrupt("return", []);
case 8:
// Merging segments
segments = segments_1.getLabeledSegments(anomalyId);
if (segments.length > 0 && result.segments.length > 0) {
lastOldSegment = segments[segments.length - 1];
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 _context2.abrupt("return", result.segments);
case 13:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
}
exports.runPredict = runPredict;
/***/ }),
/* 10 */
/***/ (function(module, exports) {
module.exports = require('babel-runtime/core-js/get-iterator');
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _getIterator2 = __webpack_require__(10);
var _getIterator3 = _interopRequireDefault(_getIterator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Object.defineProperty(exports, "__esModule", { value: true });
var path = __webpack_require__(4);
var json_1 = __webpack_require__(6);
var config_1 = __webpack_require__(3);
var anomalyType_1 = __webpack_require__(2);
var _ = __webpack_require__(19);
function getLabeledSegments(anomalyId) {
var filename = path.join(config_1.SEGMENTS_PATH, anomalyId + "_labeled.json");
var segments = [];
try {
segments = json_1.getJsonDataSync(filename);
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = (0, _getIterator3.default)(segments), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var segment = _step.value;
if (segment.labeled === undefined) {
segment.labeled = false;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
} catch (e) {
console.error(e.message);
}
return segments;
}
exports.getLabeledSegments = getLabeledSegments;
function getPredictedSegments(anomalyId) {
var filename = path.join(config_1.SEGMENTS_PATH, anomalyId + "_segments.json");
var jsonData = void 0;
try {
jsonData = json_1.getJsonDataSync(filename);
} catch (e) {
console.error(e.message);
jsonData = [];
}
return jsonData;
}
exports.getPredictedSegments = getPredictedSegments;
function saveSegments(anomalyId, segments) {
var 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
var info = anomalyType_1.loadAnomalyById(anomalyId);
var segments = getLabeledSegments(anomalyId);
var nextId = info.next_id;
var addedIds = [];
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = (0, _getIterator3.default)(addedSegments), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var segment = _step2.value;
segment.id = nextId;
segment.labeled = labeled;
addedIds.push(nextId);
nextId++;
segments.push(segment);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
info.next_id = nextId;
saveSegments(anomalyId, segments);
anomalyType_1.saveAnomaly(anomalyId, info);
return addedIds;
}
exports.insertSegments = insertSegments;
function removeSegments(anomalyId, removedSegments) {
var segments = getLabeledSegments(anomalyId);
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
var _loop = function _loop() {
var segmentId = _step3.value;
segments = segments.filter(function (el) {
return el.id !== segmentId;
});
};
for (var _iterator3 = (0, _getIterator3.default)(removedSegments), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
_loop();
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
saveSegments(anomalyId, segments);
}
exports.removeSegments = removeSegments;
/***/ }),
/* 12 */
/***/ (function(module, exports) {
module.exports = require('crypto');
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _stringify = __webpack_require__(7);
var _stringify2 = _interopRequireDefault(_stringify);
var _getIterator2 = __webpack_require__(10);
var _getIterator3 = _interopRequireDefault(_getIterator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Object.defineProperty(exports, "__esModule", { value: true });
var path = __webpack_require__(4);
var json_1 = __webpack_require__(6);
var config_1 = __webpack_require__(3);
var crypto = __webpack_require__(12);
function saveTargets(targets) {
var metrics = [];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = (0, _getIterator3.default)(targets), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var target = _step.value;
metrics.push(saveTarget(target));
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return metrics;
}
exports.saveTargets = saveTargets;
function saveTarget(target) {
//const md5 = crypto.createHash('md5')
var targetId = crypto.createHash('md5').update((0, _stringify2.default)(target)).digest('hex');
var filename = path.join(config_1.METRICS_PATH, targetId + ".json");
json_1.writeJsonDataSync(filename, target);
return targetId;
}
function getTarget(targetId) {
var filename = path.join(config_1.METRICS_PATH, targetId + ".json");
return json_1.getJsonDataSync(filename);
}
exports.getTarget = getTarget;
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _regenerator = __webpack_require__(0);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = __webpack_require__(1);
var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = _promise2.default))(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 });
var Koa = __webpack_require__(15);
var Router = __webpack_require__(5);
var bodyParser = __webpack_require__(16);
var anomalies_1 = __webpack_require__(17);
var segments_1 = __webpack_require__(21);
var alerts_1 = __webpack_require__(22);
var data_1 = __webpack_require__(27);
data_1.checkDataFolders();
var app = new Koa();
var PORT = process.env.HASTIC_PORT || 8000;
app.use(bodyParser());
app.use(function (ctx, next) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee() {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
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();
case 4:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
});
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('/', function (ctx) {
return __awaiter(undefined, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
ctx.response.body = { status: 'OK' };
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
});
app.use(rootRouter.routes()).use(rootRouter.allowedMethods());
app.listen(PORT, function () {
console.log("Server is running on :" + PORT);
});
/***/ }),
/* 15 */
/***/ (function(module, exports) {
module.exports = require('koa');
/***/ }),
/* 16 */
/***/ (function(module, exports) {
module.exports = require('koa-bodyparser');
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _regenerator = __webpack_require__(0);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = __webpack_require__(1);
var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = _promise2.default))(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 });
var Router = __webpack_require__(5);
var anomalyType_1 = __webpack_require__(2);
var analytics_1 = __webpack_require__(9);
var metrics_1 = __webpack_require__(13);
function sendAnomalyTypeStatus(ctx) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var id, name, anomaly;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
id = ctx.request.query.id;
name = ctx.request.query.name;
_context.prev = 2;
anomaly = void 0;
if (id !== undefined) {
anomaly = anomalyType_1.loadAnomalyById(id);
} else {
anomaly = anomalyType_1.loadAnomalyByName(name);
}
if (!(anomaly === null)) {
_context.next = 8;
break;
}
ctx.response.status = 404;
return _context.abrupt("return");
case 8:
if (!(anomaly.status === undefined)) {
_context.next = 10;
break;
}
throw new Error('No status for ' + name);
case 10:
ctx.response.body = { status: anomaly.status, errorMessage: anomaly.error };
_context.next = 18;
break;
case 13:
_context.prev = 13;
_context.t0 = _context["catch"](2);
console.error(_context.t0);
// TODO: better send 404 when we know than isn`t found
ctx.response.status = 500;
ctx.response.body = { error: 'Can`t return anything' };
case 18:
case "end":
return _context.stop();
}
}
}, _callee, this, [[2, 13]]);
}));
}
function getAnomaly(ctx) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
var id, name, anomaly;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.prev = 0;
id = ctx.request.query.id;
name = ctx.request.query.name;
anomaly = void 0;
if (id !== undefined) {
anomaly = anomalyType_1.loadAnomalyById(id);
} else {
anomaly = anomalyType_1.loadAnomalyByName(name.toLowerCase());
}
if (!(anomaly === null)) {
_context2.next = 8;
break;
}
ctx.response.status = 404;
return _context2.abrupt("return");
case 8:
ctx.response.body = {
name: anomaly.name,
metric: anomaly.metric,
status: anomaly.status
};
_context2.next = 16;
break;
case 11:
_context2.prev = 11;
_context2.t0 = _context2["catch"](0);
console.error(_context2.t0);
// TODO: better send 404 when we know than isn`t found
ctx.response.status = 500;
ctx.response.body = 'Can`t get anything';
case 16:
case "end":
return _context2.stop();
}
}
}, _callee2, this, [[0, 11]]);
}));
}
function createAnomaly(ctx) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
var body, metric, anomaly, anomalyId;
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
try {
body = ctx.request.body;
metric = {
datasource: body.metric.datasource,
targets: metrics_1.saveTargets(body.metric.targets)
};
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
};
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'
};
}
case 1:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
}
function deleteAnomaly(ctx) {
try {
var id = ctx.request.query.id;
var 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);
/***/ }),
/* 18 */
/***/ (function(module, exports) {
module.exports = require('child_process');
/***/ }),
/* 19 */
/***/ (function(module, exports) {
module.exports = require('lodash');
/***/ }),
/* 20 */
/***/ (function(module, exports) {
module.exports = require('event-stream');
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _regenerator = __webpack_require__(0);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = __webpack_require__(1);
var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = _promise2.default))(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 });
var Router = __webpack_require__(5);
var segments_1 = __webpack_require__(11);
var anomalyType_1 = __webpack_require__(2);
var analytics_1 = __webpack_require__(9);
function sendSegments(ctx) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var anomalyId, anomaly, lastSegmentId, timeFrom, timeTo, segments;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
anomalyId = ctx.request.query.anomaly_id;
anomaly = anomalyType_1.loadAnomalyById(anomalyId);
if (anomaly === null) {
anomalyId = anomalyType_1.getAnomalyIdByName(anomalyId);
}
lastSegmentId = ctx.request.query.last_segment;
timeFrom = ctx.request.query.from;
timeTo = ctx.request.query.to;
segments = segments_1.getLabeledSegments(anomalyId);
// Id filtering
if (lastSegmentId !== undefined) {
segments = segments.filter(function (el) {
return el.id > lastSegmentId;
});
}
// Time filtering
if (timeFrom !== undefined) {
segments = segments.filter(function (el) {
return el.finish > timeFrom;
});
}
if (timeTo !== undefined) {
segments = segments.filter(function (el) {
return el.start < timeTo;
});
}
ctx.response.body = { segments: segments };
case 11:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
}
function updateSegments(ctx) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
var segmentsUpdate, anomalyId, anomalyName, addedIds;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
try {
segmentsUpdate = ctx.request.body;
anomalyId = segmentsUpdate.anomaly_id;
anomalyName = segmentsUpdate.name;
if (anomalyId === undefined) {
anomalyId = anomalyType_1.getAnomalyIdByName(anomalyName.toLowerCase());
}
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'
};
}
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
}
exports.router = new Router();
exports.router.get('/', sendSegments);
exports.router.patch('/', updateSegments);
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var anomalyType_1 = __webpack_require__(2);
var alerts_1 = __webpack_require__(23);
var Router = __webpack_require__(5);
function getAlert(ctx) {
var anomalyId = ctx.request.query.anomaly_id;
var anomaly = anomalyType_1.loadAnomalyById(anomalyId);
if (anomaly == null) {
anomalyId = anomalyType_1.getAnomalyIdByName(anomalyId.toLowerCase());
}
var alertsAnomalies = alerts_1.getAlertsAnomalies();
var pos = alertsAnomalies.indexOf(anomalyId);
var enable = pos !== -1;
ctx.response.body = { enable: enable };
}
function changeAlert(ctx) {
var anomalyId = ctx.request.body.anomaly_id;
var enable = ctx.request.body.enable;
var anomaly = anomalyType_1.loadAnomalyById(anomalyId);
if (anomaly == null) {
anomalyId = anomalyType_1.getAnomalyIdByName(anomalyId.toLowerCase());
}
var alertsAnomalies = alerts_1.getAlertsAnomalies();
var 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);
}
ctx.response.body = { status: 'OK' };
}
exports.router = new Router();
exports.router.get('/', getAlert);
exports.router.post('/', changeAlert);
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _set = __webpack_require__(24);
var _set2 = _interopRequireDefault(_set);
var _regenerator = __webpack_require__(0);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _getIterator2 = __webpack_require__(10);
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _promise = __webpack_require__(1);
var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = _promise2.default))(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 });
var json_1 = __webpack_require__(6);
var analytics_1 = __webpack_require__(9);
var notification_1 = __webpack_require__(25);
var segments_1 = __webpack_require__(11);
var config_1 = __webpack_require__(3);
var path = __webpack_require__(4);
var fs = __webpack_require__(8);
var 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);
}
exports.getAlertsAnomalies = getAlertsAnomalies;
function saveAlertsAnomalies(anomalies) {
return json_1.writeJsonDataSync(ALERTS_DB_PATH, anomalies);
}
exports.saveAlertsAnomalies = saveAlertsAnomalies;
function processAlerts(anomalyId) {
var segments = segments_1.getLabeledSegments(anomalyId);
var currentTime = new Date().getTime();
var activeAlert = activeAlerts.has(anomalyId);
var newActiveAlert = false;
if (segments.length > 0) {
var 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, /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var alertsAnomalies, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, anomalyId;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
alertsAnomalies = getAlertsAnomalies();
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 4;
_iterator = (0, _getIterator3.default)(alertsAnomalies);
case 6:
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
_context.next = 20;
break;
}
anomalyId = _step.value;
_context.prev = 8;
_context.next = 11;
return analytics_1.runPredict(anomalyId);
case 11:
processAlerts(anomalyId);
_context.next = 17;
break;
case 14:
_context.prev = 14;
_context.t0 = _context["catch"](8);
console.error(_context.t0);
case 17:
_iteratorNormalCompletion = true;
_context.next = 6;
break;
case 20:
_context.next = 26;
break;
case 22:
_context.prev = 22;
_context.t1 = _context["catch"](4);
_didIteratorError = true;
_iteratorError = _context.t1;
case 26:
_context.prev = 26;
_context.prev = 27;
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
case 29:
_context.prev = 29;
if (!_didIteratorError) {
_context.next = 32;
break;
}
throw _iteratorError;
case 32:
return _context.finish(29);
case 33:
return _context.finish(26);
case 34:
setTimeout(alertsTick, 5000);
case 35:
case "end":
return _context.stop();
}
}
}, _callee, this, [[4, 22, 26, 34], [8, 14], [27,, 29, 33]]);
}));
}
var alertTimeout = 60000; // ms
var activeAlerts = new _set2.default();
setTimeout(alertsTick, 5000);
/***/ }),
/* 24 */
/***/ (function(module, exports) {
module.exports = require('babel-runtime/core-js/set');
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _regenerator = __webpack_require__(0);
var _regenerator2 = _interopRequireDefault(_regenerator);
var _stringify = __webpack_require__(7);
var _stringify2 = _interopRequireDefault(_stringify);
var _promise = __webpack_require__(1);
var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
return new (P || (P = _promise2.default))(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 });
var axios_1 = __webpack_require__(26);
var anomalyType_1 = __webpack_require__(2);
function sendNotification(anomalyId, active) {
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var anomalyName, notification, endpoint, data;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
anomalyName = anomalyType_1.loadAnomalyById(anomalyId).name;
console.log('Notification ' + anomalyName);
notification = {
anomaly: anomalyName,
status: ''
};
if (active) {
notification.status = 'alert';
} else {
notification.status = 'OK';
}
endpoint = process.env.HASTIC_ALERT_ENDPOINT;
if (!(endpoint === undefined)) {
_context.next = 8;
break;
}
console.error("Can't send alert, env HASTIC_ALERT_ENDPOINT is undefined");
return _context.abrupt("return");
case 8:
_context.prev = 8;
_context.next = 11;
return axios_1.default.post(endpoint, {
method: 'POST',
body: (0, _stringify2.default)(notification)
});
case 11:
data = _context.sent;
console.log(data);
_context.next = 18;
break;
case 15:
_context.prev = 15;
_context.t0 = _context["catch"](8);
console.error("Can't send alert to " + endpoint + ". Error: " + _context.t0);
case 18:
case "end":
return _context.stop();
}
}
}, _callee, this, [[8, 15]]);
}));
}
exports.sendNotification = sendNotification;
/***/ }),
/* 26 */
/***/ (function(module, exports) {
module.exports = require('axios');
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config = __webpack_require__(3);
var fs = __webpack_require__(8);
// 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;
/***/ })
/******/ ]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAgNTVhNzY2MjNiNzUwOTAwNzY0NWEiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwicmVxdWlyZSgnYmFiZWwtcnVudGltZS9yZWdlbmVyYXRvcicpXCIiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwicmVxdWlyZSgnYmFiZWwtcnVudGltZS9jb3JlLWpzL3Byb21pc2UnKVwiIiwid2VicGFjazovLy8uL3NlcnZpY2VzL2Fub21hbHlUeXBlLnRzIiwid2VicGFjazovLy8uL2NvbmZpZy50cyIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJyZXF1aXJlKCdwYXRoJylcIiIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJyZXF1aXJlKCdrb2Etcm91dGVyJylcIiIsIndlYnBhY2s6Ly8vLi9zZXJ2aWNlcy9qc29uLnRzIiwid2VicGFjazovLy9leHRlcm5hbCBcInJlcXVpcmUoJ2JhYmVsLXJ1bnRpbWUvY29yZS1qcy9qc29uL3N0cmluZ2lmeScpXCIiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwicmVxdWlyZSgnZnMnKVwiIiwid2VicGFjazovLy8uL3NlcnZpY2VzL2FuYWx5dGljcy50cyIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJyZXF1aXJlKCdiYWJlbC1ydW50aW1lL2NvcmUtan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