@resolveio/server-lib 4.6.14 → 4.6.16
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 +146 -2
- package/package.json +1 -1
package/methods/logs.js
CHANGED
|
@@ -95,7 +95,7 @@ function loadLogMethods(methodManager) {
|
|
|
95
95
|
function: function (date_start, date_end) {
|
|
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;
|
|
98
|
+
var latencies, subscriptions, 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,9 +147,153 @@ function loadLogMethods(methodManager) {
|
|
|
147
147
|
]).allowDiskUse(true)];
|
|
148
148
|
case 2:
|
|
149
149
|
subscriptions = _a.sent();
|
|
150
|
+
return [4 /*yield*/, log_method_latency_collection_1.LogMethodLatencies.aggregate([
|
|
151
|
+
{
|
|
152
|
+
$match: {
|
|
153
|
+
$and: [
|
|
154
|
+
{
|
|
155
|
+
createdAt: { $gte: date_start }
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
createdAt: { $lte: date_end }
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
$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
|
+
},
|
|
203
|
+
count: {
|
|
204
|
+
$sum: 1
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
$sort: {
|
|
210
|
+
'_id.year': 1,
|
|
211
|
+
'_id.month': 1,
|
|
212
|
+
'_id.day': 1,
|
|
213
|
+
'_id.hour': 1,
|
|
214
|
+
'_id.minute': 1,
|
|
215
|
+
'_id.second': 1
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
]).allowDiskUse(true)];
|
|
219
|
+
case 3:
|
|
220
|
+
methodGraphData = _a.sent();
|
|
221
|
+
return [4 /*yield*/, log_method_latency_collection_1.LogMethodLatencies.aggregate([
|
|
222
|
+
{
|
|
223
|
+
$match: {
|
|
224
|
+
$and: [
|
|
225
|
+
{
|
|
226
|
+
createdAt: { $gte: date_start }
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
createdAt: { $lte: date_end }
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
$group: {
|
|
236
|
+
_id: {
|
|
237
|
+
second: {
|
|
238
|
+
$second: {
|
|
239
|
+
date: '$createdAt',
|
|
240
|
+
timezone: "America/Chicago"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
minute: {
|
|
244
|
+
$minute: {
|
|
245
|
+
date: '$createdAt',
|
|
246
|
+
timezone: "America/Chicago"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
hour: {
|
|
250
|
+
$hour: {
|
|
251
|
+
date: '$createdAt',
|
|
252
|
+
timezone: "America/Chicago"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
day: {
|
|
256
|
+
$dayOfMonth: {
|
|
257
|
+
date: '$createdAt',
|
|
258
|
+
timezone: "America/Chicago"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
month: {
|
|
262
|
+
$month: {
|
|
263
|
+
date: '$createdAt',
|
|
264
|
+
timezone: "America/Chicago"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
year: {
|
|
268
|
+
$year: {
|
|
269
|
+
date: '$createdAt',
|
|
270
|
+
timezone: "America/Chicago"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
count: {
|
|
275
|
+
$sum: 1
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
$sort: {
|
|
281
|
+
'_id.year': 1,
|
|
282
|
+
'_id.month': 1,
|
|
283
|
+
'_id.day': 1,
|
|
284
|
+
'_id.hour': 1,
|
|
285
|
+
'_id.minute': 1,
|
|
286
|
+
'_id.second': 1
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
]).allowDiskUse(true)];
|
|
290
|
+
case 4:
|
|
291
|
+
subGraphData = _a.sent();
|
|
150
292
|
resolve({
|
|
151
293
|
methods: latencies,
|
|
152
|
-
subscriptions: subscriptions
|
|
294
|
+
subscriptions: subscriptions,
|
|
295
|
+
methodGraphData: methodGraphData,
|
|
296
|
+
subGraphData: subGraphData
|
|
153
297
|
});
|
|
154
298
|
return [2 /*return*/];
|
|
155
299
|
}
|