@resolveio/server-lib 4.6.18 → 4.6.19
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/methods/logs.js +158 -92
- package/package.json +1 -1
package/methods/logs.js
CHANGED
|
@@ -92,10 +92,10 @@ function loadLogMethods(methodManager) {
|
|
|
92
92
|
},
|
|
93
93
|
superadminAPM: {
|
|
94
94
|
skipQueue: true,
|
|
95
|
-
function: function (date_start, date_end) {
|
|
95
|
+
function: function (date_start, date_end, graphInterval) {
|
|
96
96
|
var _this = this;
|
|
97
97
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
98
|
-
var latencies, subscriptions, methodGraphData, subGraphData;
|
|
98
|
+
var latencies, subscriptions, groupId, groupSort, methodGraphData, subGraphData;
|
|
99
99
|
return __generator(this, function (_a) {
|
|
100
100
|
switch (_a.label) {
|
|
101
101
|
case 0: return [4 /*yield*/, log_method_latency_collection_1.LogMethodLatencies.aggregate([
|
|
@@ -147,6 +147,158 @@ function loadLogMethods(methodManager) {
|
|
|
147
147
|
]).allowDiskUse(true)];
|
|
148
148
|
case 2:
|
|
149
149
|
subscriptions = _a.sent();
|
|
150
|
+
groupId = {};
|
|
151
|
+
groupSort = {};
|
|
152
|
+
if (graphInterval === 'seconds') {
|
|
153
|
+
groupId = {
|
|
154
|
+
second: {
|
|
155
|
+
$second: {
|
|
156
|
+
date: '$createdAt',
|
|
157
|
+
timezone: "America/Chicago"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
minute: {
|
|
161
|
+
$minute: {
|
|
162
|
+
date: '$createdAt',
|
|
163
|
+
timezone: "America/Chicago"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
hour: {
|
|
167
|
+
$hour: {
|
|
168
|
+
date: '$createdAt',
|
|
169
|
+
timezone: "America/Chicago"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
day: {
|
|
173
|
+
$dayOfMonth: {
|
|
174
|
+
date: '$createdAt',
|
|
175
|
+
timezone: "America/Chicago"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
month: {
|
|
179
|
+
$month: {
|
|
180
|
+
date: '$createdAt',
|
|
181
|
+
timezone: "America/Chicago"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
year: {
|
|
185
|
+
$year: {
|
|
186
|
+
date: '$createdAt',
|
|
187
|
+
timezone: "America/Chicago"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
groupSort = {
|
|
192
|
+
'_id.year': 1,
|
|
193
|
+
'_id.month': 1,
|
|
194
|
+
'_id.day': 1,
|
|
195
|
+
'_id.hour': 1,
|
|
196
|
+
'_id.minute': 1,
|
|
197
|
+
'_id.second': 1
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
else if (graphInterval === 'minutes') {
|
|
201
|
+
groupId = {
|
|
202
|
+
minute: {
|
|
203
|
+
$minute: {
|
|
204
|
+
date: '$createdAt',
|
|
205
|
+
timezone: "America/Chicago"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
hour: {
|
|
209
|
+
$hour: {
|
|
210
|
+
date: '$createdAt',
|
|
211
|
+
timezone: "America/Chicago"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
day: {
|
|
215
|
+
$dayOfMonth: {
|
|
216
|
+
date: '$createdAt',
|
|
217
|
+
timezone: "America/Chicago"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
month: {
|
|
221
|
+
$month: {
|
|
222
|
+
date: '$createdAt',
|
|
223
|
+
timezone: "America/Chicago"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
year: {
|
|
227
|
+
$year: {
|
|
228
|
+
date: '$createdAt',
|
|
229
|
+
timezone: "America/Chicago"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
groupSort = {
|
|
234
|
+
'_id.year': 1,
|
|
235
|
+
'_id.month': 1,
|
|
236
|
+
'_id.day': 1,
|
|
237
|
+
'_id.hour': 1,
|
|
238
|
+
'_id.minute': 1
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
else if (graphInterval === 'hours') {
|
|
242
|
+
groupId = {
|
|
243
|
+
hour: {
|
|
244
|
+
$hour: {
|
|
245
|
+
date: '$createdAt',
|
|
246
|
+
timezone: "America/Chicago"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
day: {
|
|
250
|
+
$dayOfMonth: {
|
|
251
|
+
date: '$createdAt',
|
|
252
|
+
timezone: "America/Chicago"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
month: {
|
|
256
|
+
$month: {
|
|
257
|
+
date: '$createdAt',
|
|
258
|
+
timezone: "America/Chicago"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
year: {
|
|
262
|
+
$year: {
|
|
263
|
+
date: '$createdAt',
|
|
264
|
+
timezone: "America/Chicago"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
groupSort = {
|
|
269
|
+
'_id.year': 1,
|
|
270
|
+
'_id.month': 1,
|
|
271
|
+
'_id.day': 1,
|
|
272
|
+
'_id.hour': 1
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
groupId = {
|
|
277
|
+
day: {
|
|
278
|
+
$dayOfMonth: {
|
|
279
|
+
date: '$createdAt',
|
|
280
|
+
timezone: "America/Chicago"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
month: {
|
|
284
|
+
$month: {
|
|
285
|
+
date: '$createdAt',
|
|
286
|
+
timezone: "America/Chicago"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
year: {
|
|
290
|
+
$year: {
|
|
291
|
+
date: '$createdAt',
|
|
292
|
+
timezone: "America/Chicago"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
groupSort = {
|
|
297
|
+
'_id.year': 1,
|
|
298
|
+
'_id.month': 1,
|
|
299
|
+
'_id.day': 1
|
|
300
|
+
};
|
|
301
|
+
}
|
|
150
302
|
return [4 /*yield*/, log_method_latency_collection_1.LogMethodLatencies.aggregate([
|
|
151
303
|
{
|
|
152
304
|
$match: {
|
|
@@ -162,57 +314,14 @@ function loadLogMethods(methodManager) {
|
|
|
162
314
|
},
|
|
163
315
|
{
|
|
164
316
|
$group: {
|
|
165
|
-
_id:
|
|
166
|
-
// second: {
|
|
167
|
-
// $second: {
|
|
168
|
-
// date: '$createdAt',
|
|
169
|
-
// timezone: "America/Chicago"
|
|
170
|
-
// }
|
|
171
|
-
// },
|
|
172
|
-
minute: {
|
|
173
|
-
$minute: {
|
|
174
|
-
date: '$createdAt',
|
|
175
|
-
timezone: "America/Chicago"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
hour: {
|
|
179
|
-
$hour: {
|
|
180
|
-
date: '$createdAt',
|
|
181
|
-
timezone: "America/Chicago"
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
day: {
|
|
185
|
-
$dayOfMonth: {
|
|
186
|
-
date: '$createdAt',
|
|
187
|
-
timezone: "America/Chicago"
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
month: {
|
|
191
|
-
$month: {
|
|
192
|
-
date: '$createdAt',
|
|
193
|
-
timezone: "America/Chicago"
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
year: {
|
|
197
|
-
$year: {
|
|
198
|
-
date: '$createdAt',
|
|
199
|
-
timezone: "America/Chicago"
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
},
|
|
317
|
+
_id: groupId,
|
|
203
318
|
count: {
|
|
204
319
|
$sum: 1
|
|
205
320
|
}
|
|
206
321
|
}
|
|
207
322
|
},
|
|
208
323
|
{
|
|
209
|
-
$sort:
|
|
210
|
-
'_id.year': 1,
|
|
211
|
-
'_id.month': 1,
|
|
212
|
-
'_id.day': 1,
|
|
213
|
-
'_id.hour': 1,
|
|
214
|
-
'_id.minute': 1,
|
|
215
|
-
}
|
|
324
|
+
$sort: groupSort
|
|
216
325
|
}
|
|
217
326
|
]).allowDiskUse(true)];
|
|
218
327
|
case 3:
|
|
@@ -232,57 +341,14 @@ function loadLogMethods(methodManager) {
|
|
|
232
341
|
},
|
|
233
342
|
{
|
|
234
343
|
$group: {
|
|
235
|
-
_id:
|
|
236
|
-
// second: {
|
|
237
|
-
// $second: {
|
|
238
|
-
// date: '$createdAt',
|
|
239
|
-
// timezone: "America/Chicago"
|
|
240
|
-
// }
|
|
241
|
-
// },
|
|
242
|
-
minute: {
|
|
243
|
-
$minute: {
|
|
244
|
-
date: '$createdAt',
|
|
245
|
-
timezone: "America/Chicago"
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
hour: {
|
|
249
|
-
$hour: {
|
|
250
|
-
date: '$createdAt',
|
|
251
|
-
timezone: "America/Chicago"
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
day: {
|
|
255
|
-
$dayOfMonth: {
|
|
256
|
-
date: '$createdAt',
|
|
257
|
-
timezone: "America/Chicago"
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
month: {
|
|
261
|
-
$month: {
|
|
262
|
-
date: '$createdAt',
|
|
263
|
-
timezone: "America/Chicago"
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
year: {
|
|
267
|
-
$year: {
|
|
268
|
-
date: '$createdAt',
|
|
269
|
-
timezone: "America/Chicago"
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
},
|
|
344
|
+
_id: groupId,
|
|
273
345
|
count: {
|
|
274
346
|
$sum: 1
|
|
275
347
|
}
|
|
276
348
|
}
|
|
277
349
|
},
|
|
278
350
|
{
|
|
279
|
-
$sort:
|
|
280
|
-
'_id.year': 1,
|
|
281
|
-
'_id.month': 1,
|
|
282
|
-
'_id.day': 1,
|
|
283
|
-
'_id.hour': 1,
|
|
284
|
-
'_id.minute': 1,
|
|
285
|
-
}
|
|
351
|
+
$sort: groupSort
|
|
286
352
|
}
|
|
287
353
|
]).allowDiskUse(true)];
|
|
288
354
|
case 4:
|