@resolveio/server-lib 20.0.27 → 20.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-server-app.js +1 -47
- package/client-server-app.js.map +1 -1
- package/collections/app-status.collection.js +1 -50
- package/collections/app-status.collection.js.map +1 -1
- package/collections/counter.collection.js +1 -53
- package/collections/counter.collection.js.map +1 -1
- package/collections/cron-job-history.collection.js +1 -88
- package/collections/cron-job-history.collection.js.map +1 -1
- package/collections/cron-job.collection.js +1 -84
- package/collections/cron-job.collection.js.map +1 -1
- package/collections/email-history.collection.js +1 -65
- package/collections/email-history.collection.js.map +1 -1
- package/collections/email-verified.collection.js +1 -60
- package/collections/email-verified.collection.js.map +1 -1
- package/collections/file.collection.js +1 -72
- package/collections/file.collection.js.map +1 -1
- package/collections/flag.collection.js +1 -55
- package/collections/flag.collection.js.map +1 -1
- package/collections/log-method-latency.collection.js +1 -63
- package/collections/log-method-latency.collection.js.map +1 -1
- package/collections/log-subscription.collection.js +1 -67
- package/collections/log-subscription.collection.js.map +1 -1
- package/collections/log-ts.collection.js +1 -77
- package/collections/log-ts.collection.js.map +1 -1
- package/collections/log.collection.js +1 -76
- package/collections/log.collection.js.map +1 -1
- package/collections/logged-in-users.collection.js +1 -64
- package/collections/logged-in-users.collection.js.map +1 -1
- package/collections/method-response.collection.js +1 -65
- package/collections/method-response.collection.js.map +1 -1
- package/collections/monitor-cpu.collection.js +1 -62
- package/collections/monitor-cpu.collection.js.map +1 -1
- package/collections/monitor-memory.collection.js +1 -74
- package/collections/monitor-memory.collection.js.map +1 -1
- package/collections/monitor-mongo.collection.js +1 -68
- package/collections/monitor-mongo.collection.js.map +1 -1
- package/collections/notification.collection.js +1 -55
- package/collections/notification.collection.js.map +1 -1
- package/collections/report-builder-dashboard-builder.collection.js +1 -108
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -1
- package/collections/report-builder-library.collection.js +1 -86
- package/collections/report-builder-library.collection.js.map +1 -1
- package/collections/report-builder-report.collection.js +1 -148
- package/collections/report-builder-report.collection.js.map +1 -1
- package/collections/user-group.collection.js +1 -93
- package/collections/user-group.collection.js.map +1 -1
- package/collections/user-guide.collection.js +1 -56
- package/collections/user-guide.collection.js.map +1 -1
- package/collections/user.collection.js +1 -265
- package/collections/user.collection.js.map +1 -1
- package/cron/cron.js +1 -101
- package/cron/cron.js.map +1 -1
- package/fixtures/cron-jobs.js +1 -87
- package/fixtures/cron-jobs.js.map +1 -1
- package/fixtures/init.js +1 -58
- package/fixtures/init.js.map +1 -1
- package/http/auth.js +1 -763
- package/http/auth.js.map +1 -1
- package/http/health.js +1 -11
- package/http/health.js.map +1 -1
- package/http/home.js +1 -65
- package/http/home.js.map +1 -1
- package/index.js +1 -126
- package/index.js.map +1 -1
- package/managers/cron.manager.js +1 -322
- package/managers/cron.manager.js.map +1 -1
- package/managers/method.manager.js +1 -593
- package/managers/method.manager.js.map +1 -1
- package/managers/mongo.manager.js +1 -2259
- package/managers/mongo.manager.js.map +1 -1
- package/managers/monitor.manager.js +1 -350
- package/managers/monitor.manager.js.map +1 -1
- package/managers/subscription.manager.js +1 -1110
- package/managers/subscription.manager.js.map +1 -1
- package/managers/subscription.performance.js +1 -102
- package/managers/subscription.performance.js.map +1 -1
- package/methods/accounts.js +1 -291
- package/methods/accounts.js.map +1 -1
- package/methods/aws.js +1 -634
- package/methods/aws.js.map +1 -1
- package/methods/collections.js +1 -499
- package/methods/collections.js.map +1 -1
- package/methods/counters.js +1 -121
- package/methods/counters.js.map +1 -1
- package/methods/cron-jobs.js +1 -1337
- package/methods/cron-jobs.js.map +1 -1
- package/methods/flags.js +1 -8
- package/methods/flags.js.map +1 -1
- package/methods/logs.js +1 -370
- package/methods/logs.js.map +1 -1
- package/methods/monitor.js +1 -564
- package/methods/monitor.js.map +1 -1
- package/methods/pdf.js +1 -731
- package/methods/pdf.js.map +1 -1
- package/methods/report-builder.js +1 -859
- package/methods/report-builder.js.map +1 -1
- package/methods/support.js +1 -245
- package/methods/support.js.map +1 -1
- package/models/app-status.model.js +1 -3
- package/models/app-status.model.js.map +1 -1
- package/models/billing-logged-in-users.model.js +1 -3
- package/models/billing-logged-in-users.model.js.map +1 -1
- package/models/collection-document.model.js +1 -3
- package/models/collection-document.model.js.map +1 -1
- package/models/counter.model.js +1 -3
- package/models/counter.model.js.map +1 -1
- package/models/cron-job-history.model.js +1 -3
- package/models/cron-job-history.model.js.map +1 -1
- package/models/cron-job.model.js +1 -3
- package/models/cron-job.model.js.map +1 -1
- package/models/dialog.model.js +1 -3
- package/models/dialog.model.js.map +1 -1
- package/models/email-history.model.js +1 -3
- package/models/email-history.model.js.map +1 -1
- package/models/email-verified.model.js +1 -3
- package/models/email-verified.model.js.map +1 -1
- package/models/file.model.js +1 -3
- package/models/file.model.js.map +1 -1
- package/models/flag.model.js +1 -3
- package/models/flag.model.js.map +1 -1
- package/models/log-method-latency.model.js +1 -3
- package/models/log-method-latency.model.js.map +1 -1
- package/models/log-subscription.model.js +1 -3
- package/models/log-subscription.model.js.map +1 -1
- package/models/log.model.js +1 -3
- package/models/log.model.js.map +1 -1
- package/models/logged-in-users.model.js +1 -3
- package/models/logged-in-users.model.js.map +1 -1
- package/models/method-response.model.js +1 -3
- package/models/method-response.model.js.map +1 -1
- package/models/method.model.js +1 -3
- package/models/method.model.js.map +1 -1
- package/models/monitor-cpu.model.js +1 -3
- package/models/monitor-cpu.model.js.map +1 -1
- package/models/monitor-memory.model.js +1 -3
- package/models/monitor-memory.model.js.map +1 -1
- package/models/monitor-mongo.model.js +1 -3
- package/models/monitor-mongo.model.js.map +1 -1
- package/models/notification.model.js +1 -3
- package/models/notification.model.js.map +1 -1
- package/models/pagination.model.js +1 -23
- package/models/pagination.model.js.map +1 -1
- package/models/permission.model.js +1 -3
- package/models/permission.model.js.map +1 -1
- package/models/report-builder-dashboard-builder.model.js +1 -3
- package/models/report-builder-dashboard-builder.model.js.map +1 -1
- package/models/report-builder-library.model.js +1 -3
- package/models/report-builder-library.model.js.map +1 -1
- package/models/report-builder-report.model.js +1 -3
- package/models/report-builder-report.model.js.map +1 -1
- package/models/report-builder.model.js +1 -3
- package/models/report-builder.model.js.map +1 -1
- package/models/select-data-label.model.js +1 -3
- package/models/select-data-label.model.js.map +1 -1
- package/models/server-response.model.js +1 -3
- package/models/server-response.model.js.map +1 -1
- package/models/subscription.model.js +1 -3
- package/models/subscription.model.js.map +1 -1
- package/models/support-ticket.model.js +1 -3
- package/models/support-ticket.model.js.map +1 -1
- package/models/user-group.model.js +1 -3
- package/models/user-group.model.js.map +1 -1
- package/models/user-guide.model.js +1 -3
- package/models/user-guide.model.js.map +1 -1
- package/models/user.model.js +1 -3
- package/models/user.model.js.map +1 -1
- package/package.json +6 -4
- package/public_api.js +1 -74
- package/public_api.js.map +1 -1
- package/publications/app-status.js +1 -16
- package/publications/app-status.js.map +1 -1
- package/publications/cron-jobs.js +1 -32
- package/publications/cron-jobs.js.map +1 -1
- package/publications/files.js +1 -36
- package/publications/files.js.map +1 -1
- package/publications/flags.js +1 -22
- package/publications/flags.js.map +1 -1
- package/publications/logs.js +1 -164
- package/publications/logs.js.map +1 -1
- package/publications/method-responses.js +1 -16
- package/publications/method-responses.js.map +1 -1
- package/publications/notifications.js +1 -16
- package/publications/notifications.js.map +1 -1
- package/publications/report-builder-dashboard-builders.js +1 -42
- package/publications/report-builder-dashboard-builders.js.map +1 -1
- package/publications/report-builder-libraries.js +1 -89
- package/publications/report-builder-libraries.js.map +1 -1
- package/publications/report-builder-reports.js +1 -50
- package/publications/report-builder-reports.js.map +1 -1
- package/publications/super-admin.js +1 -16
- package/publications/super-admin.js.map +1 -1
- package/publications/user-groups.js +1 -16
- package/publications/user-groups.js.map +1 -1
- package/publications/user-guides.js +1 -16
- package/publications/user-guides.js.map +1 -1
- package/server-app.js +1 -770
- package/server-app.js.map +1 -1
- package/util/common.js +1 -546
- package/util/common.js.map +1 -1
- package/util/schema-report-builder.js +1 -452
- package/util/schema-report-builder.js.map +1 -1
package/methods/monitor.js
CHANGED
|
@@ -1,565 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.loadMonitorMethods = void 0;
|
|
40
|
-
var monitor_mongo_collection_1 = require("../collections/monitor-mongo.collection");
|
|
41
|
-
var monitor_cpu_collection_1 = require("../collections/monitor-cpu.collection");
|
|
42
|
-
var monitor_memory_collection_1 = require("../collections/monitor-memory.collection");
|
|
43
|
-
var __1 = require("..");
|
|
44
|
-
var common_1 = require("../util/common");
|
|
45
|
-
function loadMonitorMethods(methodManager) {
|
|
46
|
-
methodManager.methods({
|
|
47
|
-
superadminMonitorGraphData: {
|
|
48
|
-
function: function (date_start, date_end, collection, instance, client, graphInterval, variable, variableType) {
|
|
49
|
-
var _this = this;
|
|
50
|
-
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
51
|
-
var groupId, groupDate, query, graphData;
|
|
52
|
-
var _a, _b;
|
|
53
|
-
return __generator(this, function (_c) {
|
|
54
|
-
switch (_c.label) {
|
|
55
|
-
case 0:
|
|
56
|
-
groupId = {};
|
|
57
|
-
groupDate = {};
|
|
58
|
-
if (graphInterval === 'seconds') {
|
|
59
|
-
groupId = {
|
|
60
|
-
second: {
|
|
61
|
-
$second: {
|
|
62
|
-
date: '$date',
|
|
63
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
minute: {
|
|
67
|
-
$minute: {
|
|
68
|
-
date: '$date',
|
|
69
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
hour: {
|
|
73
|
-
$hour: {
|
|
74
|
-
date: '$date',
|
|
75
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
day: {
|
|
79
|
-
$dayOfMonth: {
|
|
80
|
-
date: '$date',
|
|
81
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
month: {
|
|
85
|
-
$month: {
|
|
86
|
-
date: '$date',
|
|
87
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
year: {
|
|
91
|
-
$year: {
|
|
92
|
-
date: '$date',
|
|
93
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
client: '$metadata.client',
|
|
97
|
-
instance: '$metadata.instance'
|
|
98
|
-
};
|
|
99
|
-
groupDate = {
|
|
100
|
-
'year': '$_id.year',
|
|
101
|
-
'month': '$_id.month',
|
|
102
|
-
'day': '$_id.day',
|
|
103
|
-
'hour': '$_id.hour',
|
|
104
|
-
'minute': '$_id.minute',
|
|
105
|
-
'second': '$_id.second'
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
else if (graphInterval === 'minutes') {
|
|
109
|
-
groupId = {
|
|
110
|
-
minute: {
|
|
111
|
-
$minute: {
|
|
112
|
-
date: '$date',
|
|
113
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
hour: {
|
|
117
|
-
$hour: {
|
|
118
|
-
date: '$date',
|
|
119
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
day: {
|
|
123
|
-
$dayOfMonth: {
|
|
124
|
-
date: '$date',
|
|
125
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
month: {
|
|
129
|
-
$month: {
|
|
130
|
-
date: '$date',
|
|
131
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
year: {
|
|
135
|
-
$year: {
|
|
136
|
-
date: '$date',
|
|
137
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
client: '$metadata.client',
|
|
141
|
-
instance: '$metadata.instance'
|
|
142
|
-
};
|
|
143
|
-
groupDate = {
|
|
144
|
-
'year': '$_id.year',
|
|
145
|
-
'month': '$_id.month',
|
|
146
|
-
'day': '$_id.day',
|
|
147
|
-
'hour': '$_id.hour',
|
|
148
|
-
'minute': '$_id.minute'
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
else if (graphInterval === 'hours') {
|
|
152
|
-
groupId = {
|
|
153
|
-
hour: {
|
|
154
|
-
$hour: {
|
|
155
|
-
date: '$date',
|
|
156
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
day: {
|
|
160
|
-
$dayOfMonth: {
|
|
161
|
-
date: '$date',
|
|
162
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
month: {
|
|
166
|
-
$month: {
|
|
167
|
-
date: '$date',
|
|
168
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
year: {
|
|
172
|
-
$year: {
|
|
173
|
-
date: '$date',
|
|
174
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
client: '$metadata.client',
|
|
178
|
-
instance: '$metadata.instance'
|
|
179
|
-
};
|
|
180
|
-
groupDate = {
|
|
181
|
-
'year': '$_id.year',
|
|
182
|
-
'month': '$_id.month',
|
|
183
|
-
'day': '$_id.day',
|
|
184
|
-
'hour': '$_id.hour'
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
groupId = {
|
|
189
|
-
day: {
|
|
190
|
-
$dayOfMonth: {
|
|
191
|
-
date: '$date',
|
|
192
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
month: {
|
|
196
|
-
$month: {
|
|
197
|
-
date: '$date',
|
|
198
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
year: {
|
|
202
|
-
$year: {
|
|
203
|
-
date: '$date',
|
|
204
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
client: '$metadata.client',
|
|
208
|
-
instance: '$metadata.instance'
|
|
209
|
-
};
|
|
210
|
-
groupDate = {
|
|
211
|
-
'year': '$_id.year',
|
|
212
|
-
'month': '$_id.month',
|
|
213
|
-
'day': '$_id.day'
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
query = [
|
|
217
|
-
{
|
|
218
|
-
$match: {
|
|
219
|
-
$and: [
|
|
220
|
-
{
|
|
221
|
-
date: { $gte: date_start }
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
date: { $lte: date_end }
|
|
225
|
-
}
|
|
226
|
-
]
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
];
|
|
230
|
-
if (client) {
|
|
231
|
-
query[0]['$match'].$and.push({ 'metadata.client': client });
|
|
232
|
-
}
|
|
233
|
-
if (instance) {
|
|
234
|
-
query[0]['$match'].$and.push({ 'metadata.instance': instance });
|
|
235
|
-
}
|
|
236
|
-
query.push({
|
|
237
|
-
$group: (_a = {
|
|
238
|
-
_id: groupId
|
|
239
|
-
},
|
|
240
|
-
_a[variable] = variableType === 'count' ? { $sum: 1 } : (_b = {},
|
|
241
|
-
_b['$' + variableType] = '$' + variable,
|
|
242
|
-
_b),
|
|
243
|
-
_a)
|
|
244
|
-
});
|
|
245
|
-
query.push({
|
|
246
|
-
$group: {
|
|
247
|
-
_id: groupDate,
|
|
248
|
-
data: {
|
|
249
|
-
$push: { k: { $concat: ['$_id.client', ' - ', '$_id.instance'] }, v: '$' + variable }
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
query.push({
|
|
254
|
-
$addFields: {
|
|
255
|
-
data: {
|
|
256
|
-
$arrayToObject: '$data'
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
query.push({
|
|
261
|
-
$replaceRoot: {
|
|
262
|
-
newRoot: {
|
|
263
|
-
$mergeObjects: ['$data', '$$ROOT']
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
query.push({
|
|
268
|
-
$project: {
|
|
269
|
-
data: 0
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
return [4 /*yield*/, __1.ResolveIOServer.getMongoManager().collection(collection).aggregate(query, { allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true)];
|
|
273
|
-
case 1:
|
|
274
|
-
graphData = _c.sent();
|
|
275
|
-
resolve(graphData);
|
|
276
|
-
return [2 /*return*/];
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
}); });
|
|
280
|
-
},
|
|
281
|
-
skipValidation: true
|
|
282
|
-
},
|
|
283
|
-
superadminMonitorTableData: {
|
|
284
|
-
function: function (date_start, date_end, collection, instance, client, graphInterval, variable, variableType) {
|
|
285
|
-
var _this = this;
|
|
286
|
-
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
287
|
-
var groupId, groupDate, query, firstGroupId, graphData;
|
|
288
|
-
var _a, _b, _c, _d, _e;
|
|
289
|
-
return __generator(this, function (_f) {
|
|
290
|
-
switch (_f.label) {
|
|
291
|
-
case 0:
|
|
292
|
-
groupId = {};
|
|
293
|
-
groupDate = {};
|
|
294
|
-
if (collection !== 'monitor-mongos') {
|
|
295
|
-
resolve([]);
|
|
296
|
-
return [2 /*return*/];
|
|
297
|
-
}
|
|
298
|
-
if (graphInterval === 'seconds') {
|
|
299
|
-
groupId = {
|
|
300
|
-
second: {
|
|
301
|
-
$second: {
|
|
302
|
-
date: '$date',
|
|
303
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
minute: {
|
|
307
|
-
$minute: {
|
|
308
|
-
date: '$date',
|
|
309
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
hour: {
|
|
313
|
-
$hour: {
|
|
314
|
-
date: '$date',
|
|
315
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
day: {
|
|
319
|
-
$dayOfMonth: {
|
|
320
|
-
date: '$date',
|
|
321
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
month: {
|
|
325
|
-
$month: {
|
|
326
|
-
date: '$date',
|
|
327
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
year: {
|
|
331
|
-
$year: {
|
|
332
|
-
date: '$date',
|
|
333
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
groupDate = {
|
|
338
|
-
'year': '$_id.year',
|
|
339
|
-
'month': '$_id.month',
|
|
340
|
-
'day': '$_id.day',
|
|
341
|
-
'hour': '$_id.hour',
|
|
342
|
-
'minute': '$_id.minute',
|
|
343
|
-
'second': '$_id.second'
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
else if (graphInterval === 'minutes') {
|
|
347
|
-
groupId = {
|
|
348
|
-
minute: {
|
|
349
|
-
$minute: {
|
|
350
|
-
date: '$date',
|
|
351
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
hour: {
|
|
355
|
-
$hour: {
|
|
356
|
-
date: '$date',
|
|
357
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
day: {
|
|
361
|
-
$dayOfMonth: {
|
|
362
|
-
date: '$date',
|
|
363
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
month: {
|
|
367
|
-
$month: {
|
|
368
|
-
date: '$date',
|
|
369
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
year: {
|
|
373
|
-
$year: {
|
|
374
|
-
date: '$date',
|
|
375
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
groupDate = {
|
|
380
|
-
'year': '$_id.year',
|
|
381
|
-
'month': '$_id.month',
|
|
382
|
-
'day': '$_id.day',
|
|
383
|
-
'hour': '$_id.hour',
|
|
384
|
-
'minute': '$_id.minute'
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
else if (graphInterval === 'hours') {
|
|
388
|
-
groupId = {
|
|
389
|
-
hour: {
|
|
390
|
-
$hour: {
|
|
391
|
-
date: '$date',
|
|
392
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
393
|
-
}
|
|
394
|
-
},
|
|
395
|
-
day: {
|
|
396
|
-
$dayOfMonth: {
|
|
397
|
-
date: '$date',
|
|
398
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
month: {
|
|
402
|
-
$month: {
|
|
403
|
-
date: '$date',
|
|
404
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
year: {
|
|
408
|
-
$year: {
|
|
409
|
-
date: '$date',
|
|
410
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
groupDate = {
|
|
415
|
-
'year': '$_id.year',
|
|
416
|
-
'month': '$_id.month',
|
|
417
|
-
'day': '$_id.day',
|
|
418
|
-
'hour': '$_id.hour'
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
groupId = {
|
|
423
|
-
day: {
|
|
424
|
-
$dayOfMonth: {
|
|
425
|
-
date: '$date',
|
|
426
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
427
|
-
}
|
|
428
|
-
},
|
|
429
|
-
month: {
|
|
430
|
-
$month: {
|
|
431
|
-
date: '$date',
|
|
432
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
year: {
|
|
436
|
-
$year: {
|
|
437
|
-
date: '$date',
|
|
438
|
-
timezone: process.env.TZ_CLIENT || 'America/Chicago'
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
groupDate = {
|
|
443
|
-
'year': '$_id.year',
|
|
444
|
-
'month': '$_id.month',
|
|
445
|
-
'day': '$_id.day'
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
query = [
|
|
449
|
-
{
|
|
450
|
-
$match: {
|
|
451
|
-
$and: [
|
|
452
|
-
{
|
|
453
|
-
date: { $gte: date_start }
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
date: { $lte: date_end }
|
|
457
|
-
}
|
|
458
|
-
]
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
];
|
|
462
|
-
if (client) {
|
|
463
|
-
query[0]['$match'].$and.push({ client: 'metadata.client' });
|
|
464
|
-
}
|
|
465
|
-
if (instance) {
|
|
466
|
-
query[0]['$match'].$and.push({ instance: 'metadata.instance' });
|
|
467
|
-
}
|
|
468
|
-
firstGroupId = (0, common_1.deepCopy)(groupId);
|
|
469
|
-
firstGroupId['client'] = '$metadata.client';
|
|
470
|
-
firstGroupId['instance'] = '$metadata.instance';
|
|
471
|
-
firstGroupId[variable] = '$' + variable;
|
|
472
|
-
groupDate[variable] = '$' + variable;
|
|
473
|
-
groupDate['date'] = '$date';
|
|
474
|
-
groupDate['data'] = '$data';
|
|
475
|
-
groupId['client'] = '$_id.client';
|
|
476
|
-
groupId['instance'] = '$_id.instance';
|
|
477
|
-
query.push({
|
|
478
|
-
$group: (_a = {
|
|
479
|
-
_id: firstGroupId
|
|
480
|
-
},
|
|
481
|
-
_a[variable] = {
|
|
482
|
-
'$sum': 1
|
|
483
|
-
},
|
|
484
|
-
_a[variable + '_name'] = {
|
|
485
|
-
$first: '$' + [variable]
|
|
486
|
-
},
|
|
487
|
-
_a.date = {
|
|
488
|
-
$first: '$date'
|
|
489
|
-
},
|
|
490
|
-
_a)
|
|
491
|
-
});
|
|
492
|
-
query.push({
|
|
493
|
-
$addFields: {
|
|
494
|
-
data: (_b = {},
|
|
495
|
-
_b[variable] = '$' + variable,
|
|
496
|
-
_b[variable + '_name'] = '$' + variable + '_name',
|
|
497
|
-
_b)
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
query.push({
|
|
501
|
-
$group: (_c = {
|
|
502
|
-
_id: groupId
|
|
503
|
-
},
|
|
504
|
-
_c[variable] = {
|
|
505
|
-
'$sum': '$data.' + variable
|
|
506
|
-
},
|
|
507
|
-
_c.date = {
|
|
508
|
-
$first: '$date'
|
|
509
|
-
},
|
|
510
|
-
_c.data = {
|
|
511
|
-
$push: '$data'
|
|
512
|
-
},
|
|
513
|
-
_c)
|
|
514
|
-
});
|
|
515
|
-
query.push({
|
|
516
|
-
$addFields: (_d = {},
|
|
517
|
-
_d[variable] = groupDate,
|
|
518
|
-
_d)
|
|
519
|
-
});
|
|
520
|
-
query.push({
|
|
521
|
-
$group: (_e = {
|
|
522
|
-
_id: {
|
|
523
|
-
client: '$_id.client',
|
|
524
|
-
instance: '$_id.instance'
|
|
525
|
-
},
|
|
526
|
-
data: {
|
|
527
|
-
$push: '$' + variable
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
_e[variable] = {
|
|
531
|
-
$sum: '$' + variable + '.' + variable
|
|
532
|
-
},
|
|
533
|
-
_e)
|
|
534
|
-
});
|
|
535
|
-
return [4 /*yield*/, __1.ResolveIOServer.getMongoManager().collection(collection).aggregate(query, { allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true)];
|
|
536
|
-
case 1:
|
|
537
|
-
graphData = _f.sent();
|
|
538
|
-
resolve(graphData);
|
|
539
|
-
return [2 /*return*/];
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
}); });
|
|
543
|
-
},
|
|
544
|
-
skipValidation: true
|
|
545
|
-
},
|
|
546
|
-
monitorMongos: {
|
|
547
|
-
function: function () {
|
|
548
|
-
return monitor_mongo_collection_1.MonitorMongos.find({}, { readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true);
|
|
549
|
-
}
|
|
550
|
-
},
|
|
551
|
-
monitorCPUs: {
|
|
552
|
-
function: function () {
|
|
553
|
-
return monitor_cpu_collection_1.MonitorCPUs.find({}, { readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true);
|
|
554
|
-
}
|
|
555
|
-
},
|
|
556
|
-
monitorMemorys: {
|
|
557
|
-
function: function () {
|
|
558
|
-
return monitor_memory_collection_1.MonitorMemorys.find({}, { readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
exports.loadMonitorMethods = loadMonitorMethods;
|
|
564
|
-
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(e,r,c,d){return new(c=c||Promise)(function(a,t){function o(e){try{i(d.next(e))}catch(e){t(e)}}function n(e){try{i(d.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?a(e.value):((t=e.value)instanceof c?t:new c(function(e){e(t)})).then(o,n)}i((d=d.apply(e,r||[])).next())})},__generator=this&&this.__generator||function(o,n){var i,r,c,d={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]},s={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function e(a){return function(e){var t=[a,e];if(i)throw new TypeError("Generator is already executing.");for(;d=s&&t[s=0]?0:d;)try{if(i=1,r&&(c=2&t[0]?r.return:t[0]?r.throw||((c=r.return)&&c.call(r),0):r.next)&&!(c=c.call(r,t[1])).done)return c;switch(r=0,(t=c?[2&t[0],c.value]:t)[0]){case 0:case 1:c=t;break;case 4:return d.label++,{value:t[1],done:!1};case 5:d.label++,r=t[1],t=[0];continue;case 7:t=d.ops.pop(),d.trys.pop();continue;default:if(!(c=0<(c=d.trys).length&&c[c.length-1])&&(6===t[0]||2===t[0])){d=0;continue}if(3===t[0]&&(!c||t[1]>c[0]&&t[1]<c[3]))d.label=t[1];else if(6===t[0]&&d.label<c[1])d.label=c[1],c=t;else{if(!(c&&d.label<c[2])){c[2]&&d.ops.pop(),d.trys.pop();continue}d.label=c[2],d.ops.push(t)}}t=n.call(o,d)}catch(e){t=[6,e],r=0}finally{i=c=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},monitor_mongo_collection_1=(Object.defineProperty(exports,"__esModule",{value:!0}),exports.loadMonitorMethods=void 0,require("../collections/monitor-mongo.collection")),monitor_cpu_collection_1=require("../collections/monitor-cpu.collection"),monitor_memory_collection_1=require("../collections/monitor-memory.collection"),__1=require(".."),common_1=require("../util/common");function loadMonitorMethods(e){e.methods({superadminMonitorGraphData:{function:function(r,c,d,s,m,$,h,u){var t=this;return new Promise(function(i,e){return __awaiter(t,void 0,void 0,function(){var t,a,o,n;return __generator(this,function(e){switch(e.label){case 0:return o={},t={},t="seconds"===$?(o={second:{$second:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},minute:{$minute:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},hour:{$hour:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},day:{$dayOfMonth:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},month:{$month:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},year:{$year:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},client:"$metadata.client",instance:"$metadata.instance"},{year:"$_id.year",month:"$_id.month",day:"$_id.day",hour:"$_id.hour",minute:"$_id.minute",second:"$_id.second"}):"minutes"===$?(o={minute:{$minute:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},hour:{$hour:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},day:{$dayOfMonth:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},month:{$month:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},year:{$year:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},client:"$metadata.client",instance:"$metadata.instance"},{year:"$_id.year",month:"$_id.month",day:"$_id.day",hour:"$_id.hour",minute:"$_id.minute"}):"hours"===$?(o={hour:{$hour:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},day:{$dayOfMonth:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},month:{$month:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},year:{$year:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},client:"$metadata.client",instance:"$metadata.instance"},{year:"$_id.year",month:"$_id.month",day:"$_id.day",hour:"$_id.hour"}):(o={day:{$dayOfMonth:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},month:{$month:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},year:{$year:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},client:"$metadata.client",instance:"$metadata.instance"},{year:"$_id.year",month:"$_id.month",day:"$_id.day"}),a=[{$match:{$and:[{date:{$gte:r}},{date:{$lte:c}}]}}],m&&a[0].$match.$and.push({"metadata.client":m}),s&&a[0].$match.$and.push({"metadata.instance":s}),a.push({$group:((o={_id:o})[h]="count"===u?{$sum:1}:((n={})["$"+u]="$"+h,n),o)}),a.push({$group:{_id:t,data:{$push:{k:{$concat:["$_id.client"," - ","$_id.instance"]},v:"$"+h}}}}),a.push({$addFields:{data:{$arrayToObject:"$data"}}}),a.push({$replaceRoot:{newRoot:{$mergeObjects:["$data","$$ROOT"]}}}),a.push({$project:{data:0}}),[4,__1.ResolveIOServer.getMongoManager().collection(d).aggregate(a,{allowDiskUse:!0,readPreference:"http://localhost:4200"!==this.serverConfig.ROOT_URL?"secondary":"primary"},!0)];case 1:return n=e.sent(),i(n),[2]}})})})},skipValidation:!0},superadminMonitorTableData:{function:function(r,c,d,s,m,$,h,e){var t=this;return new Promise(function(i,e){return __awaiter(t,void 0,void 0,function(){var t,a,o,n;return __generator(this,function(e){switch(e.label){case 0:return(o={},a={},"monitor-mongos"!==d)?(i([]),[2]):(a="seconds"===$?(o={second:{$second:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},minute:{$minute:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},hour:{$hour:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},day:{$dayOfMonth:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},month:{$month:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},year:{$year:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}}},{year:"$_id.year",month:"$_id.month",day:"$_id.day",hour:"$_id.hour",minute:"$_id.minute",second:"$_id.second"}):"minutes"===$?(o={minute:{$minute:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},hour:{$hour:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},day:{$dayOfMonth:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},month:{$month:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},year:{$year:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}}},{year:"$_id.year",month:"$_id.month",day:"$_id.day",hour:"$_id.hour",minute:"$_id.minute"}):"hours"===$?(o={hour:{$hour:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},day:{$dayOfMonth:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},month:{$month:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},year:{$year:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}}},{year:"$_id.year",month:"$_id.month",day:"$_id.day",hour:"$_id.hour"}):(o={day:{$dayOfMonth:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},month:{$month:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}},year:{$year:{date:"$date",timezone:process.env.TZ_CLIENT||"America/Chicago"}}},{year:"$_id.year",month:"$_id.month",day:"$_id.day"}),t=[{$match:{$and:[{date:{$gte:r}},{date:{$lte:c}}]}}],m&&t[0].$match.$and.push({client:"metadata.client"}),s&&t[0].$match.$and.push({instance:"metadata.instance"}),(n=(0,common_1.deepCopy)(o)).client="$metadata.client",n.instance="$metadata.instance",n[h]="$"+h,a[h]="$"+h,a.date="$date",a.data="$data",o.client="$_id.client",o.instance="$_id.instance",t.push({$group:((n={_id:n})[h]={$sum:1},n[h+"_name"]={$first:"$"+[h]},n.date={$first:"$date"},n)}),t.push({$addFields:{data:((n={})[h]="$"+h,n[h+"_name"]="$"+h+"_name",n)}}),t.push({$group:((n={_id:o})[h]={$sum:"$data."+h},n.date={$first:"$date"},n.data={$push:"$data"},n)}),t.push({$addFields:((o={})[h]=a,o)}),t.push({$group:((n={_id:{client:"$_id.client",instance:"$_id.instance"},data:{$push:"$"+h}})[h]={$sum:"$"+h+"."+h},n)}),[4,__1.ResolveIOServer.getMongoManager().collection(d).aggregate(t,{allowDiskUse:!0,readPreference:"http://localhost:4200"!==this.serverConfig.ROOT_URL?"secondary":"primary"},!0)]);case 1:return a=e.sent(),i(a),[2]}})})})},skipValidation:!0},monitorMongos:{function:function(){return monitor_mongo_collection_1.MonitorMongos.find({},{readPreference:"http://localhost:4200"!==this.serverConfig.ROOT_URL?"secondary":"primary"},!0)}},monitorCPUs:{function:function(){return monitor_cpu_collection_1.MonitorCPUs.find({},{readPreference:"http://localhost:4200"!==this.serverConfig.ROOT_URL?"secondary":"primary"},!0)}},monitorMemorys:{function:function(){return monitor_memory_collection_1.MonitorMemorys.find({},{readPreference:"http://localhost:4200"!==this.serverConfig.ROOT_URL?"secondary":"primary"},!0)}}})}exports.loadMonitorMethods=loadMonitorMethods;
|
|
565
2
|
//# sourceMappingURL=monitor.js.map
|