@resolveio/server-lib 12.1.33 → 12.1.35
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/managers/method.manager.js +6 -6
- package/managers/method.manager.js.map +1 -1
- package/methods/aws.js +11 -11
- package/methods/aws.js.map +1 -1
- package/methods/cloudconvert.js +8 -8
- package/methods/cloudconvert.js.map +1 -1
- package/methods/logs.js +18 -18
- package/methods/logs.js.map +1 -1
- package/methods/monitor.js +36 -36
- package/methods/monitor.js.map +1 -1
- package/methods/pdf.js +28 -28
- package/methods/pdf.js.map +1 -1
- package/methods/report-builder.js +10 -11
- package/methods/report-builder.js.map +1 -1
- package/package.json +1 -1
package/methods/logs.js
CHANGED
|
@@ -152,37 +152,37 @@ function loadLogMethods(methodManager) {
|
|
|
152
152
|
second: {
|
|
153
153
|
$second: {
|
|
154
154
|
date: '$createdAt',
|
|
155
|
-
timezone:
|
|
155
|
+
timezone: process.env.TZ
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
158
|
minute: {
|
|
159
159
|
$minute: {
|
|
160
160
|
date: '$createdAt',
|
|
161
|
-
timezone:
|
|
161
|
+
timezone: process.env.TZ
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
164
|
hour: {
|
|
165
165
|
$hour: {
|
|
166
166
|
date: '$createdAt',
|
|
167
|
-
timezone:
|
|
167
|
+
timezone: process.env.TZ
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
170
|
day: {
|
|
171
171
|
$dayOfMonth: {
|
|
172
172
|
date: '$createdAt',
|
|
173
|
-
timezone:
|
|
173
|
+
timezone: process.env.TZ
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
176
|
month: {
|
|
177
177
|
$month: {
|
|
178
178
|
date: '$createdAt',
|
|
179
|
-
timezone:
|
|
179
|
+
timezone: process.env.TZ
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
182
|
year: {
|
|
183
183
|
$year: {
|
|
184
184
|
date: '$createdAt',
|
|
185
|
-
timezone:
|
|
185
|
+
timezone: process.env.TZ
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
};
|
|
@@ -200,31 +200,31 @@ function loadLogMethods(methodManager) {
|
|
|
200
200
|
minute: {
|
|
201
201
|
$minute: {
|
|
202
202
|
date: '$createdAt',
|
|
203
|
-
timezone:
|
|
203
|
+
timezone: process.env.TZ
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
206
|
hour: {
|
|
207
207
|
$hour: {
|
|
208
208
|
date: '$createdAt',
|
|
209
|
-
timezone:
|
|
209
|
+
timezone: process.env.TZ
|
|
210
210
|
}
|
|
211
211
|
},
|
|
212
212
|
day: {
|
|
213
213
|
$dayOfMonth: {
|
|
214
214
|
date: '$createdAt',
|
|
215
|
-
timezone:
|
|
215
|
+
timezone: process.env.TZ
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
month: {
|
|
219
219
|
$month: {
|
|
220
220
|
date: '$createdAt',
|
|
221
|
-
timezone:
|
|
221
|
+
timezone: process.env.TZ
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
224
|
year: {
|
|
225
225
|
$year: {
|
|
226
226
|
date: '$createdAt',
|
|
227
|
-
timezone:
|
|
227
|
+
timezone: process.env.TZ
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
};
|
|
@@ -241,25 +241,25 @@ function loadLogMethods(methodManager) {
|
|
|
241
241
|
hour: {
|
|
242
242
|
$hour: {
|
|
243
243
|
date: '$createdAt',
|
|
244
|
-
timezone:
|
|
244
|
+
timezone: process.env.TZ
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
247
|
day: {
|
|
248
248
|
$dayOfMonth: {
|
|
249
249
|
date: '$createdAt',
|
|
250
|
-
timezone:
|
|
250
|
+
timezone: process.env.TZ
|
|
251
251
|
}
|
|
252
252
|
},
|
|
253
253
|
month: {
|
|
254
254
|
$month: {
|
|
255
255
|
date: '$createdAt',
|
|
256
|
-
timezone:
|
|
256
|
+
timezone: process.env.TZ
|
|
257
257
|
}
|
|
258
258
|
},
|
|
259
259
|
year: {
|
|
260
260
|
$year: {
|
|
261
261
|
date: '$createdAt',
|
|
262
|
-
timezone:
|
|
262
|
+
timezone: process.env.TZ
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
};
|
|
@@ -275,19 +275,19 @@ function loadLogMethods(methodManager) {
|
|
|
275
275
|
day: {
|
|
276
276
|
$dayOfMonth: {
|
|
277
277
|
date: '$createdAt',
|
|
278
|
-
timezone:
|
|
278
|
+
timezone: process.env.TZ
|
|
279
279
|
}
|
|
280
280
|
},
|
|
281
281
|
month: {
|
|
282
282
|
$month: {
|
|
283
283
|
date: '$createdAt',
|
|
284
|
-
timezone:
|
|
284
|
+
timezone: process.env.TZ
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
287
|
year: {
|
|
288
288
|
$year: {
|
|
289
289
|
date: '$createdAt',
|
|
290
|
-
timezone:
|
|
290
|
+
timezone: process.env.TZ
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
};
|
package/methods/logs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/methods/logs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAAqD;AACrD,0FAA8E;AAC9E,kCAA2C;AAC3C,8FAAkF;AAClF,2DAA8D;AAE9D,SAAgB,cAAc,CAAC,aAA4B;IAC1D,aAAa,CAAC,OAAO,CAAC;QACrB,cAAc,EAAE;YACf,QAAQ,EAAE,UAAS,OAAO,EAAE,IAAI;gBAC/B,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,uBAAe,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAE9J,O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ACD;wDACC,SAAS,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;qDAC3B;iDACD;6CACD;yCACD;wCACD;4CACC,MAAM,EAAE;gDACP,GAAG,EAAE,OAAO;gDACZ,KAAK,EAAE;oDACN,IAAI,EAAE,CAAC;iDACP;6CACD;yCACD;wCACD;4CACC,KAAK,EAAE,SAAS;yCAChB;qCACD,EAAE,EAAC,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,EAAA;;gCAxB/H,YAAY,GAAG,SAwBgH;gCAEnI,OAAO,CAAC;oCACP,OAAO,EAAE,SAAS;oCAClB,aAAa,EAAE,aAAa;oCAC5B,eAAe,EAAE,eAAe;oCAChC,YAAY,EAAE,YAAY;iCAC1B,CAAC,CAAC;;;;qBACH,CAAC,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,IAAI;SACpB;KACD,CAAC,CAAC;AACJ,CAAC;AA/TD,wCA+TC","file":"logs.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { Logs } from '../collections/log.collection';\nimport { LogSubscriptions } from '../collections/log-subscription.collection';\nimport { ResolveIOServer } from '../index';\nimport { LogMethodLatencies } from '../collections/log-method-latency.collection';\nimport { objectIdHexString } from '../managers/mongo.manager';\n\nexport function loadLogMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tinsertErrorLog: {\n\t\t\tfunction: function(message, data) {\n\t\t\t\tthis.sendEmail('dev@resolveio.com', 'Error Detected - ' + ResolveIOServer.getClientName(), this.user + '\\n' + message + '\\n' + JSON.stringify(data, null, 2));\n\n\t\t\t\treturn Logs.insertOne({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\ttype: 'error',\n\t\t\t\t\tcollection: '',\n\t\t\t\t\tid_document: '',\n\t\t\t\t\tpayload: JSON.stringify(data, null, 2),\n\t\t\t\t\tmethod: '',\n\t\t\t\t\tid_user: this.id_user || '',\n\t\t\t\t\tuser: this.user || '',\n\t\t\t\t\tmessageId: 0,\n\t\t\t\t\troute: ''\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tinsertSubscriptionLog: {\n\t\t\tfunction: function(type, subscription, collection_name, subData) {\n\t\t\t\treturn LogSubscriptions.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tdate: new Date(),\n\t\t\t\t\ttype: type,\n\t\t\t\t\tsubscription: subscription,\n\t\t\t\t\tcollection_name: collection_name,\n\t\t\t\t\tsubData: subData\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tinsertMethodLatencyLog: {\n\t\t\tfunction: function(method) {\n\t\t\t\treturn LogMethodLatencies.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tdate_start: new Date(),\n\t\t\t\t\tdate_end: null,\n\t\t\t\t\tlatency_ms: 0,\n\t\t\t\t\tmethod: method\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tsuperadminAPM: {\n\t\t\tfunction: function(date_start: Date, date_end: Date, graphInterval) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet latencies = await LogMethodLatencies.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$method',\n\t\t\t\t\t\t\t\tmethod: {$first: '$method'},\n\t\t\t\t\t\t\t\tcount: {$sum: 1},\n\t\t\t\t\t\t\t\tlatency_min: {$min: '$latency_ms'},\n\t\t\t\t\t\t\t\tlatency_avg: {$avg: '$latency_ms'},\n\t\t\t\t\t\t\t\tlatency_max: {$max: '$latency_ms'}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet subscriptions = await LogSubscriptions.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$subscription',\n\t\t\t\t\t\t\t\tsubscription: {$first: '$subscription'},\n\t\t\t\t\t\t\t\tcount: {$sum: 1}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupSort = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1,\n\t\t\t\t\t\t\t'_id.minute': 1,\n\t\t\t\t\t\t\t'_id.second': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1,\n\t\t\t\t\t\t\t'_id.minute': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tlet methodGraphData = await LogMethodLatencies.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\tcount: {\n\t\t\t\t\t\t\t\t\t$sum: 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: groupSort\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet subGraphData = await LogSubscriptions.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\tcount: {\n\t\t\t\t\t\t\t\t\t$sum: 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: groupSort\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve({\n\t\t\t\t\t\tmethods: latencies,\n\t\t\t\t\t\tsubscriptions: subscriptions,\n\t\t\t\t\t\tmethodGraphData: methodGraphData,\n\t\t\t\t\t\tsubGraphData: subGraphData\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t}\n\t});\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/methods/logs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAAqD;AACrD,0FAA8E;AAC9E,kCAA2C;AAC3C,8FAAkF;AAClF,2DAA8D;AAE9D,SAAgB,cAAc,CAAC,aAA4B;IAC1D,aAAa,CAAC,OAAO,CAAC;QACrB,cAAc,EAAE;YACf,QAAQ,EAAE,UAAS,OAAO,EAAE,IAAI;gBAC/B,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,uBAAe,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,GA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O;gDACZ,KAAK,EAAE;oDACN,IAAI,EAAE,CAAC;iDACP;6CACD;yCACD;wCACD;4CACC,KAAK,EAAE,SAAS;yCAChB;qCACD,EAAE,EAAC,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,EAAA;;gCAxB/H,eAAe,GAAG,SAwB6G;gCAEhH,qBAAM,8CAAgB,CAAC,SAAS,CAAC;wCACnD;4CACC,MAAM,EAAE;gDACP,IAAI,EAAE;oDACL;wDACC,SAAS,EAAE,EAAC,IAAI,EAAE,UAAU,EAAC;qDAC7B;oDACD;wDACC,SAAS,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;qDAC3B;iDACD;6CACD;yCACD;wCACD;4CACC,MAAM,EAAE;gDACP,GAAG,EAAE,OAAO;gDACZ,KAAK,EAAE;oDACN,IAAI,EAAE,CAAC;iDACP;6CACD;yCACD;wCACD;4CACC,KAAK,EAAE,SAAS;yCAChB;qCACD,EAAE,EAAC,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,EAAA;;gCAxB/H,YAAY,GAAG,SAwBgH;gCAEnI,OAAO,CAAC;oCACP,OAAO,EAAE,SAAS;oCAClB,aAAa,EAAE,aAAa;oCAC5B,eAAe,EAAE,eAAe;oCAChC,YAAY,EAAE,YAAY;iCAC1B,CAAC,CAAC;;;;qBACH,CAAC,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,IAAI;SACpB;KACD,CAAC,CAAC;AACJ,CAAC;AA/TD,wCA+TC","file":"logs.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { Logs } from '../collections/log.collection';\nimport { LogSubscriptions } from '../collections/log-subscription.collection';\nimport { ResolveIOServer } from '../index';\nimport { LogMethodLatencies } from '../collections/log-method-latency.collection';\nimport { objectIdHexString } from '../managers/mongo.manager';\n\nexport function loadLogMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tinsertErrorLog: {\n\t\t\tfunction: function(message, data) {\n\t\t\t\tthis.sendEmail('dev@resolveio.com', 'Error Detected - ' + ResolveIOServer.getClientName(), this.user + '\\n' + message + '\\n' + JSON.stringify(data, null, 2));\n\n\t\t\t\treturn Logs.insertOne({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\ttype: 'error',\n\t\t\t\t\tcollection: '',\n\t\t\t\t\tid_document: '',\n\t\t\t\t\tpayload: JSON.stringify(data, null, 2),\n\t\t\t\t\tmethod: '',\n\t\t\t\t\tid_user: this.id_user || '',\n\t\t\t\t\tuser: this.user || '',\n\t\t\t\t\tmessageId: 0,\n\t\t\t\t\troute: ''\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tinsertSubscriptionLog: {\n\t\t\tfunction: function(type, subscription, collection_name, subData) {\n\t\t\t\treturn LogSubscriptions.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tdate: new Date(),\n\t\t\t\t\ttype: type,\n\t\t\t\t\tsubscription: subscription,\n\t\t\t\t\tcollection_name: collection_name,\n\t\t\t\t\tsubData: subData\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tinsertMethodLatencyLog: {\n\t\t\tfunction: function(method) {\n\t\t\t\treturn LogMethodLatencies.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tdate_start: new Date(),\n\t\t\t\t\tdate_end: null,\n\t\t\t\t\tlatency_ms: 0,\n\t\t\t\t\tmethod: method\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t},\n\t\tsuperadminAPM: {\n\t\t\tfunction: function(date_start: Date, date_end: Date, graphInterval) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet latencies = await LogMethodLatencies.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$method',\n\t\t\t\t\t\t\t\tmethod: {$first: '$method'},\n\t\t\t\t\t\t\t\tcount: {$sum: 1},\n\t\t\t\t\t\t\t\tlatency_min: {$min: '$latency_ms'},\n\t\t\t\t\t\t\t\tlatency_avg: {$avg: '$latency_ms'},\n\t\t\t\t\t\t\t\tlatency_max: {$max: '$latency_ms'}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet subscriptions = await LogSubscriptions.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: '$subscription',\n\t\t\t\t\t\t\t\tsubscription: {$first: '$subscription'},\n\t\t\t\t\t\t\t\tcount: {$sum: 1}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupSort = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1,\n\t\t\t\t\t\t\t'_id.minute': 1,\n\t\t\t\t\t\t\t'_id.second': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1,\n\t\t\t\t\t\t\t'_id.minute': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1,\n\t\t\t\t\t\t\t'_id.hour': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$createdAt',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupSort = {\n\t\t\t\t\t\t\t'_id.year': 1,\n\t\t\t\t\t\t\t'_id.month': 1,\n\t\t\t\t\t\t\t'_id.day': 1\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tlet methodGraphData = await LogMethodLatencies.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\tcount: {\n\t\t\t\t\t\t\t\t\t$sum: 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: groupSort\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tlet subGraphData = await LogSubscriptions.aggregate([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$gte: date_start}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcreatedAt: {$lte: date_end}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\tcount: {\n\t\t\t\t\t\t\t\t\t$sum: 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$sort: groupSort\n\t\t\t\t\t\t}\n\t\t\t\t\t], {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve({\n\t\t\t\t\t\tmethods: latencies,\n\t\t\t\t\t\tsubscriptions: subscriptions,\n\t\t\t\t\t\tmethodGraphData: methodGraphData,\n\t\t\t\t\t\tsubGraphData: subGraphData\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n\t\t}\n\t});\n}"]}
|
package/methods/monitor.js
CHANGED
|
@@ -60,37 +60,37 @@ function loadMonitorMethods(methodManager) {
|
|
|
60
60
|
second: {
|
|
61
61
|
$second: {
|
|
62
62
|
date: '$date',
|
|
63
|
-
timezone:
|
|
63
|
+
timezone: process.env.TZ
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
minute: {
|
|
67
67
|
$minute: {
|
|
68
68
|
date: '$date',
|
|
69
|
-
timezone:
|
|
69
|
+
timezone: process.env.TZ
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
hour: {
|
|
73
73
|
$hour: {
|
|
74
74
|
date: '$date',
|
|
75
|
-
timezone:
|
|
75
|
+
timezone: process.env.TZ
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
day: {
|
|
79
79
|
$dayOfMonth: {
|
|
80
80
|
date: '$date',
|
|
81
|
-
timezone:
|
|
81
|
+
timezone: process.env.TZ
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
month: {
|
|
85
85
|
$month: {
|
|
86
86
|
date: '$date',
|
|
87
|
-
timezone:
|
|
87
|
+
timezone: process.env.TZ
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
year: {
|
|
91
91
|
$year: {
|
|
92
92
|
date: '$date',
|
|
93
|
-
timezone:
|
|
93
|
+
timezone: process.env.TZ
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
client: '$metadata.client',
|
|
@@ -110,31 +110,31 @@ function loadMonitorMethods(methodManager) {
|
|
|
110
110
|
minute: {
|
|
111
111
|
$minute: {
|
|
112
112
|
date: '$date',
|
|
113
|
-
timezone:
|
|
113
|
+
timezone: process.env.TZ
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
hour: {
|
|
117
117
|
$hour: {
|
|
118
118
|
date: '$date',
|
|
119
|
-
timezone:
|
|
119
|
+
timezone: process.env.TZ
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
day: {
|
|
123
123
|
$dayOfMonth: {
|
|
124
124
|
date: '$date',
|
|
125
|
-
timezone:
|
|
125
|
+
timezone: process.env.TZ
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
month: {
|
|
129
129
|
$month: {
|
|
130
130
|
date: '$date',
|
|
131
|
-
timezone:
|
|
131
|
+
timezone: process.env.TZ
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
year: {
|
|
135
135
|
$year: {
|
|
136
136
|
date: '$date',
|
|
137
|
-
timezone:
|
|
137
|
+
timezone: process.env.TZ
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
client: '$metadata.client',
|
|
@@ -153,25 +153,25 @@ function loadMonitorMethods(methodManager) {
|
|
|
153
153
|
hour: {
|
|
154
154
|
$hour: {
|
|
155
155
|
date: '$date',
|
|
156
|
-
timezone:
|
|
156
|
+
timezone: process.env.TZ
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
day: {
|
|
160
160
|
$dayOfMonth: {
|
|
161
161
|
date: '$date',
|
|
162
|
-
timezone:
|
|
162
|
+
timezone: process.env.TZ
|
|
163
163
|
}
|
|
164
164
|
},
|
|
165
165
|
month: {
|
|
166
166
|
$month: {
|
|
167
167
|
date: '$date',
|
|
168
|
-
timezone:
|
|
168
|
+
timezone: process.env.TZ
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
171
|
year: {
|
|
172
172
|
$year: {
|
|
173
173
|
date: '$date',
|
|
174
|
-
timezone:
|
|
174
|
+
timezone: process.env.TZ
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
client: '$metadata.client',
|
|
@@ -189,19 +189,19 @@ function loadMonitorMethods(methodManager) {
|
|
|
189
189
|
day: {
|
|
190
190
|
$dayOfMonth: {
|
|
191
191
|
date: '$date',
|
|
192
|
-
timezone:
|
|
192
|
+
timezone: process.env.TZ
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
195
|
month: {
|
|
196
196
|
$month: {
|
|
197
197
|
date: '$date',
|
|
198
|
-
timezone:
|
|
198
|
+
timezone: process.env.TZ
|
|
199
199
|
}
|
|
200
200
|
},
|
|
201
201
|
year: {
|
|
202
202
|
$year: {
|
|
203
203
|
date: '$date',
|
|
204
|
-
timezone:
|
|
204
|
+
timezone: process.env.TZ
|
|
205
205
|
}
|
|
206
206
|
},
|
|
207
207
|
client: '$metadata.client',
|
|
@@ -300,37 +300,37 @@ function loadMonitorMethods(methodManager) {
|
|
|
300
300
|
second: {
|
|
301
301
|
$second: {
|
|
302
302
|
date: '$date',
|
|
303
|
-
timezone:
|
|
303
|
+
timezone: process.env.TZ
|
|
304
304
|
}
|
|
305
305
|
},
|
|
306
306
|
minute: {
|
|
307
307
|
$minute: {
|
|
308
308
|
date: '$date',
|
|
309
|
-
timezone:
|
|
309
|
+
timezone: process.env.TZ
|
|
310
310
|
}
|
|
311
311
|
},
|
|
312
312
|
hour: {
|
|
313
313
|
$hour: {
|
|
314
314
|
date: '$date',
|
|
315
|
-
timezone:
|
|
315
|
+
timezone: process.env.TZ
|
|
316
316
|
}
|
|
317
317
|
},
|
|
318
318
|
day: {
|
|
319
319
|
$dayOfMonth: {
|
|
320
320
|
date: '$date',
|
|
321
|
-
timezone:
|
|
321
|
+
timezone: process.env.TZ
|
|
322
322
|
}
|
|
323
323
|
},
|
|
324
324
|
month: {
|
|
325
325
|
$month: {
|
|
326
326
|
date: '$date',
|
|
327
|
-
timezone:
|
|
327
|
+
timezone: process.env.TZ
|
|
328
328
|
}
|
|
329
329
|
},
|
|
330
330
|
year: {
|
|
331
331
|
$year: {
|
|
332
332
|
date: '$date',
|
|
333
|
-
timezone:
|
|
333
|
+
timezone: process.env.TZ
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
};
|
|
@@ -348,31 +348,31 @@ function loadMonitorMethods(methodManager) {
|
|
|
348
348
|
minute: {
|
|
349
349
|
$minute: {
|
|
350
350
|
date: '$date',
|
|
351
|
-
timezone:
|
|
351
|
+
timezone: process.env.TZ
|
|
352
352
|
}
|
|
353
353
|
},
|
|
354
354
|
hour: {
|
|
355
355
|
$hour: {
|
|
356
356
|
date: '$date',
|
|
357
|
-
timezone:
|
|
357
|
+
timezone: process.env.TZ
|
|
358
358
|
}
|
|
359
359
|
},
|
|
360
360
|
day: {
|
|
361
361
|
$dayOfMonth: {
|
|
362
362
|
date: '$date',
|
|
363
|
-
timezone:
|
|
363
|
+
timezone: process.env.TZ
|
|
364
364
|
}
|
|
365
365
|
},
|
|
366
366
|
month: {
|
|
367
367
|
$month: {
|
|
368
368
|
date: '$date',
|
|
369
|
-
timezone:
|
|
369
|
+
timezone: process.env.TZ
|
|
370
370
|
}
|
|
371
371
|
},
|
|
372
372
|
year: {
|
|
373
373
|
$year: {
|
|
374
374
|
date: '$date',
|
|
375
|
-
timezone:
|
|
375
|
+
timezone: process.env.TZ
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
};
|
|
@@ -389,25 +389,25 @@ function loadMonitorMethods(methodManager) {
|
|
|
389
389
|
hour: {
|
|
390
390
|
$hour: {
|
|
391
391
|
date: '$date',
|
|
392
|
-
timezone:
|
|
392
|
+
timezone: process.env.TZ
|
|
393
393
|
}
|
|
394
394
|
},
|
|
395
395
|
day: {
|
|
396
396
|
$dayOfMonth: {
|
|
397
397
|
date: '$date',
|
|
398
|
-
timezone:
|
|
398
|
+
timezone: process.env.TZ
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
401
|
month: {
|
|
402
402
|
$month: {
|
|
403
403
|
date: '$date',
|
|
404
|
-
timezone:
|
|
404
|
+
timezone: process.env.TZ
|
|
405
405
|
}
|
|
406
406
|
},
|
|
407
407
|
year: {
|
|
408
408
|
$year: {
|
|
409
409
|
date: '$date',
|
|
410
|
-
timezone:
|
|
410
|
+
timezone: process.env.TZ
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
};
|
|
@@ -423,19 +423,19 @@ function loadMonitorMethods(methodManager) {
|
|
|
423
423
|
day: {
|
|
424
424
|
$dayOfMonth: {
|
|
425
425
|
date: '$date',
|
|
426
|
-
timezone:
|
|
426
|
+
timezone: process.env.TZ
|
|
427
427
|
}
|
|
428
428
|
},
|
|
429
429
|
month: {
|
|
430
430
|
$month: {
|
|
431
431
|
date: '$date',
|
|
432
|
-
timezone:
|
|
432
|
+
timezone: process.env.TZ
|
|
433
433
|
}
|
|
434
434
|
},
|
|
435
435
|
year: {
|
|
436
436
|
$year: {
|
|
437
437
|
date: '$date',
|
|
438
|
-
timezone:
|
|
438
|
+
timezone: process.env.TZ
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
};
|
package/methods/monitor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/methods/monitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oFAAwE;AACxE,gFAAoE;AACpE,sFAA0E;AAC1E,wBAAqC;AACrC,yCAA0C;AAE1C,SAAgB,kBAAkB,CAAC,aAA4B;IAC9D,aAAa,CAAC,OAAO,CAAC;QACf,0BAA0B,EAAE;YACxB,QAAQ,EAAE,UAAS,UAAgB,EAAE,QAAc,EAAE,UAAkB,EAAE,QAAgB,EAAE,MAAc,EAAE,aAAqB,EAAE,QAAgB,EAAE,YAAoB;gBAA9J,iBAqPlB;gBApPA,OAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAE,MAAM;;;;;;gCACpC,OAAO,GAAG,EAAE,CAAC;gCACb,SAAS,GAAG,EAAE,CAAC;gCAEnB,IAAI,aAAa,KAAK,SAAS,EAAE;oCAChC,OAAO,GAAG;wCACT,MAAM,EAAE;4CACP,OAAO,EAAE;gDACR,IAAI,EAAE,OAAO;gDACb,QAAQ,EAAE,iBAAiB;6CAC3B;yCACD;wCACD,MAAM,EAAE;4CACP,OAAO,EAAE;gDACR,IAAI,EAAE,OAAO;gDACb,QAAQ,EAAE,iBAAiB;6CAC3B;yCACD;wCACD,IAAI,EAAE;4CACL,KAAK,EAAE;gDACN,IAAI,EAAE,OAAO;gDACb,QAAQ,EAAE,iBAA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UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,EAAA;;gCAA5N,SAAS,GAAG,SAAgN;gCAEhO,OAAO,CAAC,SAAS,CAAC,CAAC;;;;qBACnB,CAAC,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,IAAI;SACd;QACD,aAAa,EAAE;YACX,QAAQ,EAAE;gBACN,OAAO,wCAAa,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAC/I,CAAC;SACJ;QACD,WAAW,EAAE;YACT,QAAQ,EAAE;gBACN,OAAO,oCAAW,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAC7I,CAAC;SACJ;QACD,cAAc,EAAE;YACZ,QAAQ,EAAE;gBACN,OAAO,0CAAc,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAChJ,CAAC;SACJ;KACP,CAAC,CAAC;AACJ,CAAC;AA5hBD,gDA4hBC","file":"monitor.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { MonitorMongos } from '../collections/monitor-mongo.collection';\nimport { MonitorCPUs } from '../collections/monitor-cpu.collection';\nimport { MonitorMemorys } from '../collections/monitor-memory.collection';\nimport { ResolveIOServer } from '..';\nimport { deepCopy } from '../util/common';\n\nexport function loadMonitorMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n superadminMonitorGraphData: {\n function: function(date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupDate = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute',\n\t\t\t\t\t\t\t'second': '$_id.second'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day'\n\t\t\t\t\t\t};\n }\n\n let query = <any>[\n {\n $match: {\n $and: [\n {\n date: {$gte: date_start}\n },\n {\n date: {$lte: date_end}\n }\n ]\n }\n }\n ];\n\n if (client) {\n query[0]['$match'].$and.push({'metadata.client': client});\n }\n\n if (instance) {\n query[0]['$match'].$and.push({'metadata.instance': instance});\n\t\t\t\t\t}\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\t[variable]: variableType === 'count' ? {$sum: 1} : {\n\t\t\t\t\t\t\t\t\t['$' + variableType]: '$' + variable\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupDate,\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$push: {k: {$concat: ['$_id.client', ' - ', '$_id.instance']}, v: '$' + variable}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$arrayToObject: '$data'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replaceRoot: {\n\t\t\t\t\t\t\t\tnewRoot: {\n\t\t\t\t\t\t\t\t\t$mergeObjects: ['$data', '$$ROOT']\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tdata: 0\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tlet graphData = await ResolveIOServer.getMongoManager().collection(collection).aggregate(query, {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve(graphData);\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n },\n\t\tsuperadminMonitorTableData: {\n function: function(date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupDate = {};\n\n\t\t\t\t\tif (collection !== 'monitor-mongos') {\n\t\t\t\t\t\tresolve([]);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n \n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute',\n\t\t\t\t\t\t\t'second': '$_id.second'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n }\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n }\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n }\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day'\n\t\t\t\t\t\t};\n }\n\n let query = <any>[\n {\n $match: {\n $and: [\n {\n date: {$gte: date_start}\n },\n {\n date: {$lte: date_end}\n }\n ]\n }\n }\n ];\n\n if (client) {\n query[0]['$match'].$and.push({client: 'metadata.client'});\n }\n\n if (instance) {\n query[0]['$match'].$and.push({instance: 'metadata.instance'});\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet firstGroupId = deepCopy(groupId);\n\t\t\t\t\tfirstGroupId['client'] = '$metadata.client';\n\t\t\t\t\tfirstGroupId['instance'] = '$metadata.instance';\n\t\t\t\t\tfirstGroupId[variable] = '$' + variable;\n\t\t\t\t\t\n\t\t\t\t\tgroupDate[variable] = '$' + variable;\n\t\t\t\t\tgroupDate['date'] = '$date';\n\t\t\t\t\tgroupDate['data'] = '$data';\n\n\t\t\t\t\tgroupId['client'] = '$_id.client';\n\t\t\t\t\tgroupId['instance'] = '$_id.instance';\n\t\t\t\t\t\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: firstGroupId,\n\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t'$sum': 1\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[variable + '_name']: {\n\t\t\t\t\t\t\t\t\t$first: '$' + [variable]\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t\t$first: '$date'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push({\n\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t[variable]: '$' + variable,\n\t\t\t\t\t\t\t\t[variable + '_name']: '$' + variable + '_name'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tquery.push({\n\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t'$sum': '$data.' + variable\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t$first: '$date'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t$push: '$data'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tquery.push({\n\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t[variable]: groupDate\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: {\n\t\t\t\t\t\t\t\t\tclient: '$_id.client',\n\t\t\t\t\t\t\t\t\tinstance: '$_id.instance'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$push: '$' + variable\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t$sum: '$' + variable + '.' + variable\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tlet graphData = await ResolveIOServer.getMongoManager().collection(collection).aggregate(query, {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve(graphData);\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n },\n monitorMongos: {\n function: function() {\n return MonitorMongos.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorCPUs: {\n function: function() {\n return MonitorCPUs.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorMemorys: {\n function: function() {\n return MonitorMemorys.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n }\n\t});\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/methods/monitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oFAAwE;AACxE,gFAAoE;AACpE,sFAA0E;AAC1E,wBAAqC;AACrC,yCAA0C;AAE1C,SAAgB,kBAAkB,CAAC,aAA4B;IAC9D,aAAa,CAAC,OAAO,CAAC;QACf,0BAA0B,EAAE;YACxB,QAAQ,EAAE,UAAS,UAAgB,EAAE,QAAc,EAAE,UAAkB,EAAE,QAAgB,EAAE,MAAc,EAAE,aAAqB,EAAE,QAAgB,EAAE,YAAoB;gBAA9J,iBAqPlB;gBApPA,OAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAE,MAAM;;;;;;gCACpC,OAAO,GAAG,EAAE,CAAC;gCACb,SAAS,GAAG,EAAE,CAAC;gCAEnB,IAAI,aAAa,KAAK,SAAS,EAAE;oCAChC,OAAO,GAAG;wCAC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,cAAc,EAAE,IAAI;SACd;QACD,aAAa,EAAE;YACX,QAAQ,EAAE;gBACN,OAAO,wCAAa,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAC/I,CAAC;SACJ;QACD,WAAW,EAAE;YACT,QAAQ,EAAE;gBACN,OAAO,oCAAW,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAC7I,CAAC;SACJ;QACD,cAAc,EAAE;YACZ,QAAQ,EAAE;gBACN,OAAO,0CAAc,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAChJ,CAAC;SACJ;KACP,CAAC,CAAC;AACJ,CAAC;AA5hBD,gDA4hBC","file":"monitor.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { MonitorMongos } from '../collections/monitor-mongo.collection';\nimport { MonitorCPUs } from '../collections/monitor-cpu.collection';\nimport { MonitorMemorys } from '../collections/monitor-memory.collection';\nimport { ResolveIOServer } from '..';\nimport { deepCopy } from '../util/common';\n\nexport function loadMonitorMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n superadminMonitorGraphData: {\n function: function(date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupDate = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute',\n\t\t\t\t\t\t\t'second': '$_id.second'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day'\n\t\t\t\t\t\t};\n }\n\n let query = <any>[\n {\n $match: {\n $and: [\n {\n date: {$gte: date_start}\n },\n {\n date: {$lte: date_end}\n }\n ]\n }\n }\n ];\n\n if (client) {\n query[0]['$match'].$and.push({'metadata.client': client});\n }\n\n if (instance) {\n query[0]['$match'].$and.push({'metadata.instance': instance});\n\t\t\t\t\t}\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\t[variable]: variableType === 'count' ? {$sum: 1} : {\n\t\t\t\t\t\t\t\t\t['$' + variableType]: '$' + variable\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupDate,\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$push: {k: {$concat: ['$_id.client', ' - ', '$_id.instance']}, v: '$' + variable}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$arrayToObject: '$data'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replaceRoot: {\n\t\t\t\t\t\t\t\tnewRoot: {\n\t\t\t\t\t\t\t\t\t$mergeObjects: ['$data', '$$ROOT']\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tdata: 0\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tlet graphData = await ResolveIOServer.getMongoManager().collection(collection).aggregate(query, {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve(graphData);\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n },\n\t\tsuperadminMonitorTableData: {\n function: function(date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupDate = {};\n\n\t\t\t\t\tif (collection !== 'monitor-mongos') {\n\t\t\t\t\t\tresolve([]);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n \n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute',\n\t\t\t\t\t\t\t'second': '$_id.second'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n }\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n }\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: process.env.TZ\n\t\t\t\t\t\t\t\t} \n }\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day'\n\t\t\t\t\t\t};\n }\n\n let query = <any>[\n {\n $match: {\n $and: [\n {\n date: {$gte: date_start}\n },\n {\n date: {$lte: date_end}\n }\n ]\n }\n }\n ];\n\n if (client) {\n query[0]['$match'].$and.push({client: 'metadata.client'});\n }\n\n if (instance) {\n query[0]['$match'].$and.push({instance: 'metadata.instance'});\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet firstGroupId = deepCopy(groupId);\n\t\t\t\t\tfirstGroupId['client'] = '$metadata.client';\n\t\t\t\t\tfirstGroupId['instance'] = '$metadata.instance';\n\t\t\t\t\tfirstGroupId[variable] = '$' + variable;\n\t\t\t\t\t\n\t\t\t\t\tgroupDate[variable] = '$' + variable;\n\t\t\t\t\tgroupDate['date'] = '$date';\n\t\t\t\t\tgroupDate['data'] = '$data';\n\n\t\t\t\t\tgroupId['client'] = '$_id.client';\n\t\t\t\t\tgroupId['instance'] = '$_id.instance';\n\t\t\t\t\t\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: firstGroupId,\n\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t'$sum': 1\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[variable + '_name']: {\n\t\t\t\t\t\t\t\t\t$first: '$' + [variable]\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t\t$first: '$date'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push({\n\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t[variable]: '$' + variable,\n\t\t\t\t\t\t\t\t[variable + '_name']: '$' + variable + '_name'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tquery.push({\n\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t'$sum': '$data.' + variable\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t$first: '$date'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t$push: '$data'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tquery.push({\n\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t[variable]: groupDate\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: {\n\t\t\t\t\t\t\t\t\tclient: '$_id.client',\n\t\t\t\t\t\t\t\t\tinstance: '$_id.instance'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$push: '$' + variable\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t$sum: '$' + variable + '.' + variable\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tlet graphData = await ResolveIOServer.getMongoManager().collection(collection).aggregate(query, {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve(graphData);\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n },\n monitorMongos: {\n function: function() {\n return MonitorMongos.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorCPUs: {\n function: function() {\n return MonitorCPUs.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorMemorys: {\n function: function() {\n return MonitorMemorys.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n }\n\t});\n}"]}
|