@nsshunt/stsappframework 3.0.60 → 3.0.61
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/dist/influxdb/influxDBManagerAgent.js +1 -1
- package/dist/influxdb/influxDBManagerService.js +15 -235
- package/dist/influxdb/influxDBManagerService.js.map +1 -1
- package/package.json +1 -1
- package/src/influxdb/influxDBManagerAgent.ts +1 -1
- package/src/influxdb/influxDBManagerService.ts +15 -256
- package/types/influxdb/influxDBManagerService.d.ts.map +1 -1
|
@@ -91,7 +91,7 @@ globalagentmean =
|
|
|
91
91
|
|> toFloat()
|
|
92
92
|
|
|
93
93
|
union(tables: [globalagentsum, globalagentmean])
|
|
94
|
-
|> map(fn: (r) => ({r with _time: now(), _measurement: "sts-stats-
|
|
94
|
+
|> map(fn: (r) => ({r with _time: now(), _measurement: "sts-stats-globalagent"}))
|
|
95
95
|
|> to(org: "my-org", bucket: "TestBucket01")
|
|
96
96
|
|
|
97
97
|
*/
|
|
@@ -146,7 +146,7 @@ data
|
|
|
146
146
|
|> set(key: "agg_type",value: "count_temp")
|
|
147
147
|
|> to(bucket: "downsampled", org: "my-org", tagColumns: ["agg_type"])
|
|
148
148
|
*/
|
|
149
|
-
#GetSTSCountGenericService = async (measurement, filterClause,
|
|
149
|
+
#GetSTSCountGenericService = async (measurement, filterClause, showOutput = false) => {
|
|
150
150
|
try {
|
|
151
151
|
const query = `r1 = from(bucket: "${this.options.bucket}")
|
|
152
152
|
|> range(start: -5s)
|
|
@@ -168,122 +168,8 @@ data
|
|
|
168
168
|
console.error(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]`.red);
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
#GetSTSCountGenericServiceOldV3 = async (filterClause, groupClause, showOutput = false) => {
|
|
172
|
-
try {
|
|
173
|
-
const query = `data = from(bucket: "${this.options.bucket}")
|
|
174
|
-
|> range(start: -5s)
|
|
175
|
-
|> last()
|
|
176
|
-
|> filter(fn: (r) => r["_measurement"] == "service" ${filterClause})
|
|
177
|
-
|
|
178
|
-
r1 = data
|
|
179
|
-
|> filter(fn: (r) => r["_field"] != "memory")
|
|
180
|
-
|> ${groupClause}
|
|
181
|
-
|> sum()
|
|
182
|
-
|
|
183
|
-
r2 = data
|
|
184
|
-
|> filter(fn: (r) => r["_field"] == "memory")
|
|
185
|
-
|
|
186
|
-
union(tables: [r1, r2])`;
|
|
187
|
-
if (showOutput) {
|
|
188
|
-
console.log(query);
|
|
189
|
-
}
|
|
190
|
-
return this.queryApi.collectRows(query);
|
|
191
|
-
}
|
|
192
|
-
catch (error) {
|
|
193
|
-
console.error(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]`.red);
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
#GetSTSCountGenericServiceOldV2 = async (filterClause, groupClause, showOutput = false) => {
|
|
197
|
-
try {
|
|
198
|
-
const query = `data = from(bucket: "${this.options.bucket}")
|
|
199
|
-
|> range(start: -5s)
|
|
200
|
-
|> filter(fn: (r) => r["_measurement"] == "service" ${filterClause})
|
|
201
|
-
|> last()
|
|
202
|
-
|
|
203
|
-
r1 = data
|
|
204
|
-
|> filter(fn: (r) => r["_field"] == "requestCount"
|
|
205
|
-
or r["_field"] == "errorCount"
|
|
206
|
-
or r["_field"] == "retryCount"
|
|
207
|
-
or r["_field"] == "authenticationCount"
|
|
208
|
-
or r["_field"] == "activeRequestCount"
|
|
209
|
-
or r["_field"] == "connectionCount"
|
|
210
|
-
or r["_field"] == "connectionPoolCount"
|
|
211
|
-
or r["_field"] == "connectionIdleCount"
|
|
212
|
-
or r["_field"] == "connectionWaitingCount"
|
|
213
|
-
or r["_field"] == "coreCount"
|
|
214
|
-
or r["_field"] == "cpu"
|
|
215
|
-
or r["_field"] == "systemcpu"
|
|
216
|
-
or r["_field"] == "velocity"
|
|
217
|
-
or r["_field"] == "timer"
|
|
218
|
-
or r["_field"] == "duration"
|
|
219
|
-
or r["_field"] == "latency")
|
|
220
|
-
|> ${groupClause}
|
|
221
|
-
|> sum()
|
|
222
|
-
|
|
223
|
-
r2 = data
|
|
224
|
-
|> filter(fn: (r) => r["_field"] == "memory")
|
|
225
|
-
|
|
226
|
-
union(tables: [r1, r2])`;
|
|
227
|
-
if (showOutput) {
|
|
228
|
-
console.log(query);
|
|
229
|
-
}
|
|
230
|
-
return this.queryApi.collectRows(query);
|
|
231
|
-
}
|
|
232
|
-
catch (error) {
|
|
233
|
-
console.error(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]`.red);
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
// Counter metrics
|
|
237
|
-
#GetSTSCountGenericServiceOld = async (filterClause, groupClause, showOutput = false) => {
|
|
238
|
-
try {
|
|
239
|
-
const query = `dostscountex = (q, d) =>
|
|
240
|
-
from(bucket: "${this.options.bucket}")
|
|
241
|
-
|> range(start: d)
|
|
242
|
-
|> filter(fn: (r) => r["_measurement"] == "service" ${filterClause})
|
|
243
|
-
|> filter(fn: (r) => r["_field"] == q)
|
|
244
|
-
|> last()
|
|
245
|
-
|> ${groupClause}
|
|
246
|
-
|> sum()
|
|
247
|
-
|
|
248
|
-
dogetmemory = () =>
|
|
249
|
-
from(bucket: "${this.options.bucket}")
|
|
250
|
-
|> range(start: -5s)
|
|
251
|
-
|> filter(fn: (r) => r["_measurement"] == "service" ${filterClause})
|
|
252
|
-
|> filter(fn: (r) => r["_field"] == "memory")
|
|
253
|
-
|> last()
|
|
254
|
-
|
|
255
|
-
dostscount = (d) =>
|
|
256
|
-
union(tables: [
|
|
257
|
-
dostscountex(q: "requestCount", d: d),
|
|
258
|
-
dostscountex(q: "errorCount", d: d),
|
|
259
|
-
dostscountex(q: "retryCount", d: d),
|
|
260
|
-
dostscountex(q: "authenticationCount", d: d),
|
|
261
|
-
dostscountex(q: "activeRequestCount", d: d),
|
|
262
|
-
dostscountex(q: "connectionCount", d: d),
|
|
263
|
-
dostscountex(q: "connectionPoolCount", d: d),
|
|
264
|
-
dostscountex(q: "connectionIdleCount", d: d),
|
|
265
|
-
dostscountex(q: "connectionWaitingCount", d: d),
|
|
266
|
-
dostscountex(q: "coreCount", d: d),
|
|
267
|
-
dostscountex(q: "cpu", d: d),
|
|
268
|
-
dostscountex(q: "systemcpu", d: d),
|
|
269
|
-
dostscountex(q: "velocity", d: d),
|
|
270
|
-
dostscountex(q: "timer", d: d),
|
|
271
|
-
dostscountex(q: "duration", d: d),
|
|
272
|
-
dostscountex(q: "latency", d: d),
|
|
273
|
-
dogetmemory()
|
|
274
|
-
])
|
|
275
|
-
dostscount(d: -5s)`;
|
|
276
|
-
if (showOutput) {
|
|
277
|
-
console.log(query);
|
|
278
|
-
}
|
|
279
|
-
return this.queryApi.collectRows(query);
|
|
280
|
-
}
|
|
281
|
-
catch (error) {
|
|
282
|
-
console.error(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]`.red);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
171
|
// Histo metrics
|
|
286
|
-
#GetSTSHistoGenericService = async (measurement, filterClause
|
|
172
|
+
#GetSTSHistoGenericService = async (measurement, filterClause) => {
|
|
287
173
|
try {
|
|
288
174
|
const query = `import "math"
|
|
289
175
|
from(bucket: "${this.options.bucket}")
|
|
@@ -298,50 +184,8 @@ data
|
|
|
298
184
|
console.error(`${_logPrefix}#GetSTSHistoGeneric: Error: [${error}]`.red);
|
|
299
185
|
}
|
|
300
186
|
};
|
|
301
|
-
#GetSTSHistoGenericServiceOldV2 = async (filterClause, groupClause) => {
|
|
302
|
-
try {
|
|
303
|
-
const query = `import "math"
|
|
304
|
-
from(bucket: "TestBucket01")
|
|
305
|
-
|> range(start: -10m)
|
|
306
|
-
|> filter(fn: (r) => r["_measurement"] == "service" and (r["_field"] =="latency" or
|
|
307
|
-
r["_field"] =="duration") ${filterClause})
|
|
308
|
-
|> ${groupClause}
|
|
309
|
-
|> histogram(bins: [0.0, 10.0, 20.0, 50.0, 100.0, 1000.0, 50000.0, math.mInf(sign: 1) ])
|
|
310
|
-
|> difference()`;
|
|
311
|
-
return this.queryApi.collectRows(query);
|
|
312
|
-
}
|
|
313
|
-
catch (error) {
|
|
314
|
-
console.error(`${_logPrefix}#GetSTSHistoGeneric: Error: [${error}]`.red);
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
#GetSTSHistoGenericServiceOld = async (filterClause, groupClause) => {
|
|
318
|
-
try {
|
|
319
|
-
const query = `import "math"
|
|
320
|
-
|
|
321
|
-
dostshistoex = (q, d) =>
|
|
322
|
-
from(bucket: "${this.options.bucket}")
|
|
323
|
-
|> range(start: d)
|
|
324
|
-
|> filter(fn: (r) => r["_measurement"] == "service")
|
|
325
|
-
|> filter(fn: (r) => r["_field"] == q ${filterClause})
|
|
326
|
-
|> ${groupClause}
|
|
327
|
-
|> histogram(bins: [0.0, 10.0, 20.0, 50.0, 100.0, 1000.0, 50000.0, math.mInf(sign: 1) ])
|
|
328
|
-
|> difference()
|
|
329
|
-
|
|
330
|
-
dostshisto = (d) =>
|
|
331
|
-
union(tables: [
|
|
332
|
-
dostshistoex(q: "latency", d: d),
|
|
333
|
-
dostshistoex(q: "duration", d: d)
|
|
334
|
-
])
|
|
335
|
-
|
|
336
|
-
dostshisto(d: -10m)`;
|
|
337
|
-
return this.queryApi.collectRows(query);
|
|
338
|
-
}
|
|
339
|
-
catch (error) {
|
|
340
|
-
console.error(`${_logPrefix}#GetSTSHistoGeneric: Error: [${error}]`.red);
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
187
|
// Quantile metrics
|
|
344
|
-
#GetSTSQuantileGenericService = async (measurement, filterClause
|
|
188
|
+
#GetSTSQuantileGenericService = async (measurement, filterClause) => {
|
|
345
189
|
try {
|
|
346
190
|
const query = `data = from(bucket: "${this.options.bucket}")
|
|
347
191
|
|> range(start: -10m)
|
|
@@ -370,79 +214,15 @@ data
|
|
|
370
214
|
console.error(`${_logPrefix}#GetSTSQuantileGeneric: Error: [${error}]`.red);
|
|
371
215
|
}
|
|
372
216
|
};
|
|
373
|
-
#GetSTSQuantileGenericServiceOldV2 = async (filterClause, groupClause) => {
|
|
374
|
-
try {
|
|
375
|
-
const query = `data = from(bucket: "${this.options.bucket}")
|
|
376
|
-
|> range(start: -10m)
|
|
377
|
-
|> filter(fn: (r) => r["_measurement"] == "service" and (r["_field"] == "latency" or
|
|
378
|
-
r["_field"] == "duration" or
|
|
379
|
-
r["_field"] == "cpu" or
|
|
380
|
-
r["_field"] == "systemcpu") ${filterClause})
|
|
381
|
-
|> ${groupClause}
|
|
382
|
-
|> aggregateWindow(every: 5s, fn: max, createEmpty: false)
|
|
383
|
-
|
|
384
|
-
dostsquantileex = (q) =>
|
|
385
|
-
data
|
|
386
|
-
|> quantile(q: q, method: "estimate_tdigest", compression: 1000.0)
|
|
387
|
-
|> set(key: "quantile", value: string(v:q))
|
|
388
|
-
|> group(columns: ["quantile"])
|
|
389
|
-
|
|
390
|
-
union(tables: [
|
|
391
|
-
dostsquantileex(q: 0.5),
|
|
392
|
-
dostsquantileex(q: 0.8),
|
|
393
|
-
dostsquantileex(q: 0.9),
|
|
394
|
-
dostsquantileex(q: 0.95),
|
|
395
|
-
dostsquantileex(q: 0.99)
|
|
396
|
-
])`;
|
|
397
|
-
return this.queryApi.collectRows(query);
|
|
398
|
-
}
|
|
399
|
-
catch (error) {
|
|
400
|
-
console.error(`${_logPrefix}#GetSTSQuantileGeneric: Error: [${error}]`.red);
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
#GetSTSQuantileGenericServiceOld = async (filterClause, groupClause) => {
|
|
404
|
-
try {
|
|
405
|
-
const query = `dostsquantileex = (q, d, i, f) =>
|
|
406
|
-
from(bucket: "${this.options.bucket}")
|
|
407
|
-
|> range(start: d)
|
|
408
|
-
|> filter(fn: (r) => r["_measurement"] == "service")
|
|
409
|
-
|> filter(fn: (r) => r["_field"] == f ${filterClause})
|
|
410
|
-
|> ${groupClause}
|
|
411
|
-
|> aggregateWindow(every: i, fn: max, createEmpty: false)
|
|
412
|
-
|> quantile(q: q, method: "estimate_tdigest", compression: 1000.0)
|
|
413
|
-
|> set(key: "quantile", value: string(v:q))
|
|
414
|
-
|> group(columns: ["LatencyType","quantile"])
|
|
415
|
-
|
|
416
|
-
dostsquantile = (d, i, f) =>
|
|
417
|
-
union(tables: [
|
|
418
|
-
dostsquantileex(q: 0.5, d: d, i: i, f: f),
|
|
419
|
-
dostsquantileex(q: 0.8, d: d, i: i, f: f),
|
|
420
|
-
dostsquantileex(q: 0.9, d: d, i: i, f: f),
|
|
421
|
-
dostsquantileex(q: 0.95, d: d, i: i, f: f),
|
|
422
|
-
dostsquantileex(q: 0.99, d: d, i: i, f: f)
|
|
423
|
-
])
|
|
424
|
-
|
|
425
|
-
union(tables: [
|
|
426
|
-
dostsquantile(d: -10m, i: 5s, f: "latency"),
|
|
427
|
-
dostsquantile(d: -10m, i: 5s, f: "duration")
|
|
428
|
-
dostsquantile(d: -10m, i: 5s, f: "cpu")
|
|
429
|
-
dostsquantile(d: -10m, i: 5s, f: "systemcpu")
|
|
430
|
-
])`;
|
|
431
|
-
return this.queryApi.collectRows(query);
|
|
432
|
-
}
|
|
433
|
-
catch (error) {
|
|
434
|
-
console.error(`${_logPrefix}#GetSTSQuantileGeneric: Error: [${error}]`.red);
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
217
|
// Metric queries -------------------------------------------------------------------------------------------------
|
|
438
218
|
// Root level metrics
|
|
439
219
|
async GetInfluxDBResultsRootService(subscriptionKey) {
|
|
440
220
|
let retVal = null;
|
|
441
221
|
try {
|
|
442
222
|
retVal = await this.ProcessInfluxDBResults([
|
|
443
|
-
this.#GetSTSCountGenericService(SERVICE_STATS_GLOBAL, ''
|
|
444
|
-
this.#GetSTSQuantileGenericService(SERVICE_STATS_GLOBAL, ''
|
|
445
|
-
this.#GetSTSHistoGenericService(SERVICE_STATS_GLOBAL, ''
|
|
223
|
+
this.#GetSTSCountGenericService(SERVICE_STATS_GLOBAL, ''),
|
|
224
|
+
this.#GetSTSQuantileGenericService(SERVICE_STATS_GLOBAL, ''),
|
|
225
|
+
this.#GetSTSHistoGenericService(SERVICE_STATS_GLOBAL, '')
|
|
446
226
|
], []);
|
|
447
227
|
}
|
|
448
228
|
catch (error) {
|
|
@@ -458,9 +238,9 @@ data
|
|
|
458
238
|
let retVal = null;
|
|
459
239
|
try {
|
|
460
240
|
retVal = await this.ProcessInfluxDBResults([
|
|
461
|
-
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE, ''
|
|
462
|
-
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE, ''
|
|
463
|
-
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE, ''
|
|
241
|
+
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE, ''),
|
|
242
|
+
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE, ''),
|
|
243
|
+
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE, '')
|
|
464
244
|
], ['serviceId']);
|
|
465
245
|
}
|
|
466
246
|
catch (error) {
|
|
@@ -477,9 +257,9 @@ data
|
|
|
477
257
|
try {
|
|
478
258
|
const serviceId = subscriptionKey.key;
|
|
479
259
|
retVal = await this.ProcessInfluxDBResults([
|
|
480
|
-
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"
|
|
481
|
-
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"
|
|
482
|
-
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"
|
|
260
|
+
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"`),
|
|
261
|
+
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"`),
|
|
262
|
+
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"`)
|
|
483
263
|
], ['serviceId', 'serviceInstanceId']);
|
|
484
264
|
}
|
|
485
265
|
catch (error) {
|
|
@@ -496,9 +276,9 @@ data
|
|
|
496
276
|
try {
|
|
497
277
|
const serviceInstanceId = subscriptionKey.key;
|
|
498
278
|
retVal = await this.ProcessInfluxDBResults([
|
|
499
|
-
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"
|
|
500
|
-
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"
|
|
501
|
-
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"
|
|
279
|
+
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"`),
|
|
280
|
+
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"`),
|
|
281
|
+
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"`)
|
|
502
282
|
], ['serviceId', 'serviceInstanceId', 'serviceInstanceProcessId']);
|
|
503
283
|
}
|
|
504
284
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"influxDBManagerService.js","sourceRoot":"","sources":["../../src/influxdb/influxDBManagerService.ts"],"names":[],"mappings":";AAAA,wFAAwF,CAAE,UAAU;AACpG,4FAA4F;AAC5F,+GAA+G;;;AAE/G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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alagentsum, globalagentmean])
|
|
92
|
-
|> map(fn: (r) => ({r with _time: now(), _measurement: "sts-stats-
|
|
92
|
+
|> map(fn: (r) => ({r with _time: now(), _measurement: "sts-stats-globalagent"}))
|
|
93
93
|
|> to(org: "my-org", bucket: "TestBucket01")
|
|
94
94
|
|
|
95
95
|
*/
|
|
@@ -159,7 +159,7 @@ data
|
|
|
159
159
|
|> to(bucket: "downsampled", org: "my-org", tagColumns: ["agg_type"])
|
|
160
160
|
*/
|
|
161
161
|
|
|
162
|
-
#GetSTSCountGenericService = async (measurement: string, filterClause: string,
|
|
162
|
+
#GetSTSCountGenericService = async (measurement: string, filterClause: string, showOutput: boolean = false): Promise<any> => {
|
|
163
163
|
try {
|
|
164
164
|
const query = `r1 = from(bucket: "${this.options.bucket}")
|
|
165
165
|
|> range(start: -5s)
|
|
@@ -183,128 +183,8 @@ data
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
#GetSTSCountGenericServiceOldV3 = async (filterClause: string, groupClause: string, showOutput: boolean = false): Promise<any> => {
|
|
187
|
-
try {
|
|
188
|
-
const query = `data = from(bucket: "${this.options.bucket}")
|
|
189
|
-
|> range(start: -5s)
|
|
190
|
-
|> last()
|
|
191
|
-
|> filter(fn: (r) => r["_measurement"] == "service" ${filterClause})
|
|
192
|
-
|
|
193
|
-
r1 = data
|
|
194
|
-
|> filter(fn: (r) => r["_field"] != "memory")
|
|
195
|
-
|> ${groupClause}
|
|
196
|
-
|> sum()
|
|
197
|
-
|
|
198
|
-
r2 = data
|
|
199
|
-
|> filter(fn: (r) => r["_field"] == "memory")
|
|
200
|
-
|
|
201
|
-
union(tables: [r1, r2])`;
|
|
202
|
-
|
|
203
|
-
if (showOutput) {
|
|
204
|
-
console.log(query);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return this.queryApi.collectRows(query)
|
|
208
|
-
} catch (error) {
|
|
209
|
-
console.error(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]`.red);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
#GetSTSCountGenericServiceOldV2 = async (filterClause: string, groupClause: string, showOutput: boolean = false): Promise<any> => {
|
|
214
|
-
try {
|
|
215
|
-
const query = `data = from(bucket: "${this.options.bucket}")
|
|
216
|
-
|> range(start: -5s)
|
|
217
|
-
|> filter(fn: (r) => r["_measurement"] == "service" ${filterClause})
|
|
218
|
-
|> last()
|
|
219
|
-
|
|
220
|
-
r1 = data
|
|
221
|
-
|> filter(fn: (r) => r["_field"] == "requestCount"
|
|
222
|
-
or r["_field"] == "errorCount"
|
|
223
|
-
or r["_field"] == "retryCount"
|
|
224
|
-
or r["_field"] == "authenticationCount"
|
|
225
|
-
or r["_field"] == "activeRequestCount"
|
|
226
|
-
or r["_field"] == "connectionCount"
|
|
227
|
-
or r["_field"] == "connectionPoolCount"
|
|
228
|
-
or r["_field"] == "connectionIdleCount"
|
|
229
|
-
or r["_field"] == "connectionWaitingCount"
|
|
230
|
-
or r["_field"] == "coreCount"
|
|
231
|
-
or r["_field"] == "cpu"
|
|
232
|
-
or r["_field"] == "systemcpu"
|
|
233
|
-
or r["_field"] == "velocity"
|
|
234
|
-
or r["_field"] == "timer"
|
|
235
|
-
or r["_field"] == "duration"
|
|
236
|
-
or r["_field"] == "latency")
|
|
237
|
-
|> ${groupClause}
|
|
238
|
-
|> sum()
|
|
239
|
-
|
|
240
|
-
r2 = data
|
|
241
|
-
|> filter(fn: (r) => r["_field"] == "memory")
|
|
242
|
-
|
|
243
|
-
union(tables: [r1, r2])`;
|
|
244
|
-
|
|
245
|
-
if (showOutput) {
|
|
246
|
-
console.log(query);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return this.queryApi.collectRows(query)
|
|
250
|
-
} catch (error) {
|
|
251
|
-
console.error(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]`.red);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Counter metrics
|
|
256
|
-
#GetSTSCountGenericServiceOld = async (filterClause: string, groupClause: string, showOutput: boolean = false): Promise<any> => {
|
|
257
|
-
try {
|
|
258
|
-
const query = `dostscountex = (q, d) =>
|
|
259
|
-
from(bucket: "${this.options.bucket}")
|
|
260
|
-
|> range(start: d)
|
|
261
|
-
|> filter(fn: (r) => r["_measurement"] == "service" ${filterClause})
|
|
262
|
-
|> filter(fn: (r) => r["_field"] == q)
|
|
263
|
-
|> last()
|
|
264
|
-
|> ${groupClause}
|
|
265
|
-
|> sum()
|
|
266
|
-
|
|
267
|
-
dogetmemory = () =>
|
|
268
|
-
from(bucket: "${this.options.bucket}")
|
|
269
|
-
|> range(start: -5s)
|
|
270
|
-
|> filter(fn: (r) => r["_measurement"] == "service" ${filterClause})
|
|
271
|
-
|> filter(fn: (r) => r["_field"] == "memory")
|
|
272
|
-
|> last()
|
|
273
|
-
|
|
274
|
-
dostscount = (d) =>
|
|
275
|
-
union(tables: [
|
|
276
|
-
dostscountex(q: "requestCount", d: d),
|
|
277
|
-
dostscountex(q: "errorCount", d: d),
|
|
278
|
-
dostscountex(q: "retryCount", d: d),
|
|
279
|
-
dostscountex(q: "authenticationCount", d: d),
|
|
280
|
-
dostscountex(q: "activeRequestCount", d: d),
|
|
281
|
-
dostscountex(q: "connectionCount", d: d),
|
|
282
|
-
dostscountex(q: "connectionPoolCount", d: d),
|
|
283
|
-
dostscountex(q: "connectionIdleCount", d: d),
|
|
284
|
-
dostscountex(q: "connectionWaitingCount", d: d),
|
|
285
|
-
dostscountex(q: "coreCount", d: d),
|
|
286
|
-
dostscountex(q: "cpu", d: d),
|
|
287
|
-
dostscountex(q: "systemcpu", d: d),
|
|
288
|
-
dostscountex(q: "velocity", d: d),
|
|
289
|
-
dostscountex(q: "timer", d: d),
|
|
290
|
-
dostscountex(q: "duration", d: d),
|
|
291
|
-
dostscountex(q: "latency", d: d),
|
|
292
|
-
dogetmemory()
|
|
293
|
-
])
|
|
294
|
-
dostscount(d: -5s)`;
|
|
295
|
-
|
|
296
|
-
if (showOutput) {
|
|
297
|
-
console.log(query);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return this.queryApi.collectRows(query)
|
|
301
|
-
} catch (error) {
|
|
302
|
-
console.error(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]`.red);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
186
|
// Histo metrics
|
|
307
|
-
#GetSTSHistoGenericService = async (measurement: string, filterClause: string
|
|
187
|
+
#GetSTSHistoGenericService = async (measurement: string, filterClause: string): Promise<any> => {
|
|
308
188
|
try {
|
|
309
189
|
const query = `import "math"
|
|
310
190
|
from(bucket: "${this.options.bucket}")
|
|
@@ -319,51 +199,8 @@ data
|
|
|
319
199
|
}
|
|
320
200
|
}
|
|
321
201
|
|
|
322
|
-
#GetSTSHistoGenericServiceOldV2 = async (filterClause: string, groupClause: string): Promise<any> => {
|
|
323
|
-
try {
|
|
324
|
-
const query = `import "math"
|
|
325
|
-
from(bucket: "TestBucket01")
|
|
326
|
-
|> range(start: -10m)
|
|
327
|
-
|> filter(fn: (r) => r["_measurement"] == "service" and (r["_field"] =="latency" or
|
|
328
|
-
r["_field"] =="duration") ${filterClause})
|
|
329
|
-
|> ${groupClause}
|
|
330
|
-
|> histogram(bins: [0.0, 10.0, 20.0, 50.0, 100.0, 1000.0, 50000.0, math.mInf(sign: 1) ])
|
|
331
|
-
|> difference()`;
|
|
332
|
-
return this.queryApi.collectRows(query)
|
|
333
|
-
} catch (error) {
|
|
334
|
-
console.error(`${_logPrefix}#GetSTSHistoGeneric: Error: [${error}]`.red);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
#GetSTSHistoGenericServiceOld = async (filterClause: string, groupClause: string): Promise<any> => {
|
|
339
|
-
try {
|
|
340
|
-
const query = `import "math"
|
|
341
|
-
|
|
342
|
-
dostshistoex = (q, d) =>
|
|
343
|
-
from(bucket: "${this.options.bucket}")
|
|
344
|
-
|> range(start: d)
|
|
345
|
-
|> filter(fn: (r) => r["_measurement"] == "service")
|
|
346
|
-
|> filter(fn: (r) => r["_field"] == q ${filterClause})
|
|
347
|
-
|> ${groupClause}
|
|
348
|
-
|> histogram(bins: [0.0, 10.0, 20.0, 50.0, 100.0, 1000.0, 50000.0, math.mInf(sign: 1) ])
|
|
349
|
-
|> difference()
|
|
350
|
-
|
|
351
|
-
dostshisto = (d) =>
|
|
352
|
-
union(tables: [
|
|
353
|
-
dostshistoex(q: "latency", d: d),
|
|
354
|
-
dostshistoex(q: "duration", d: d)
|
|
355
|
-
])
|
|
356
|
-
|
|
357
|
-
dostshisto(d: -10m)`;
|
|
358
|
-
return this.queryApi.collectRows(query)
|
|
359
|
-
} catch (error) {
|
|
360
|
-
console.error(`${_logPrefix}#GetSTSHistoGeneric: Error: [${error}]`.red);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
202
|
// Quantile metrics
|
|
366
|
-
#GetSTSQuantileGenericService = async (measurement: string, filterClause: string
|
|
203
|
+
#GetSTSQuantileGenericService = async (measurement: string, filterClause: string): Promise<any> => {
|
|
367
204
|
try {
|
|
368
205
|
const query = `data = from(bucket: "${this.options.bucket}")
|
|
369
206
|
|> range(start: -10m)
|
|
@@ -393,84 +230,15 @@ data
|
|
|
393
230
|
}
|
|
394
231
|
}
|
|
395
232
|
|
|
396
|
-
#GetSTSQuantileGenericServiceOldV2 = async (filterClause: string, groupClause: string): Promise<any> => {
|
|
397
|
-
try {
|
|
398
|
-
const query = `data = from(bucket: "${this.options.bucket}")
|
|
399
|
-
|> range(start: -10m)
|
|
400
|
-
|> filter(fn: (r) => r["_measurement"] == "service" and (r["_field"] == "latency" or
|
|
401
|
-
r["_field"] == "duration" or
|
|
402
|
-
r["_field"] == "cpu" or
|
|
403
|
-
r["_field"] == "systemcpu") ${filterClause})
|
|
404
|
-
|> ${groupClause}
|
|
405
|
-
|> aggregateWindow(every: 5s, fn: max, createEmpty: false)
|
|
406
|
-
|
|
407
|
-
dostsquantileex = (q) =>
|
|
408
|
-
data
|
|
409
|
-
|> quantile(q: q, method: "estimate_tdigest", compression: 1000.0)
|
|
410
|
-
|> set(key: "quantile", value: string(v:q))
|
|
411
|
-
|> group(columns: ["quantile"])
|
|
412
|
-
|
|
413
|
-
union(tables: [
|
|
414
|
-
dostsquantileex(q: 0.5),
|
|
415
|
-
dostsquantileex(q: 0.8),
|
|
416
|
-
dostsquantileex(q: 0.9),
|
|
417
|
-
dostsquantileex(q: 0.95),
|
|
418
|
-
dostsquantileex(q: 0.99)
|
|
419
|
-
])`;
|
|
420
|
-
|
|
421
|
-
return this.queryApi.collectRows(query)
|
|
422
|
-
} catch (error) {
|
|
423
|
-
console.error(`${_logPrefix}#GetSTSQuantileGeneric: Error: [${error}]`.red);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
#GetSTSQuantileGenericServiceOld = async (filterClause: string, groupClause: string): Promise<any> => {
|
|
428
|
-
try {
|
|
429
|
-
const query = `dostsquantileex = (q, d, i, f) =>
|
|
430
|
-
from(bucket: "${this.options.bucket}")
|
|
431
|
-
|> range(start: d)
|
|
432
|
-
|> filter(fn: (r) => r["_measurement"] == "service")
|
|
433
|
-
|> filter(fn: (r) => r["_field"] == f ${filterClause})
|
|
434
|
-
|> ${groupClause}
|
|
435
|
-
|> aggregateWindow(every: i, fn: max, createEmpty: false)
|
|
436
|
-
|> quantile(q: q, method: "estimate_tdigest", compression: 1000.0)
|
|
437
|
-
|> set(key: "quantile", value: string(v:q))
|
|
438
|
-
|> group(columns: ["LatencyType","quantile"])
|
|
439
|
-
|
|
440
|
-
dostsquantile = (d, i, f) =>
|
|
441
|
-
union(tables: [
|
|
442
|
-
dostsquantileex(q: 0.5, d: d, i: i, f: f),
|
|
443
|
-
dostsquantileex(q: 0.8, d: d, i: i, f: f),
|
|
444
|
-
dostsquantileex(q: 0.9, d: d, i: i, f: f),
|
|
445
|
-
dostsquantileex(q: 0.95, d: d, i: i, f: f),
|
|
446
|
-
dostsquantileex(q: 0.99, d: d, i: i, f: f)
|
|
447
|
-
])
|
|
448
|
-
|
|
449
|
-
union(tables: [
|
|
450
|
-
dostsquantile(d: -10m, i: 5s, f: "latency"),
|
|
451
|
-
dostsquantile(d: -10m, i: 5s, f: "duration")
|
|
452
|
-
dostsquantile(d: -10m, i: 5s, f: "cpu")
|
|
453
|
-
dostsquantile(d: -10m, i: 5s, f: "systemcpu")
|
|
454
|
-
])`;
|
|
455
|
-
|
|
456
|
-
return this.queryApi.collectRows(query)
|
|
457
|
-
} catch (error) {
|
|
458
|
-
console.error(`${_logPrefix}#GetSTSQuantileGeneric: Error: [${error}]`.red);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
233
|
// Metric queries -------------------------------------------------------------------------------------------------
|
|
463
234
|
// Root level metrics
|
|
464
235
|
async GetInfluxDBResultsRootService(subscriptionKey: ISubscriptionKey): Promise<ISubscriptionPayload> {
|
|
465
236
|
let retVal = null;
|
|
466
237
|
try {
|
|
467
238
|
retVal = await this.ProcessInfluxDBResults([
|
|
468
|
-
this.#GetSTSCountGenericService(SERVICE_STATS_GLOBAL,
|
|
469
|
-
|
|
470
|
-
this.#
|
|
471
|
-
'', 'group(columns: ["_field"])'),
|
|
472
|
-
this.#GetSTSHistoGenericService(SERVICE_STATS_GLOBAL,
|
|
473
|
-
'', 'group(columns: ["_field"])')],
|
|
239
|
+
this.#GetSTSCountGenericService(SERVICE_STATS_GLOBAL, ''),
|
|
240
|
+
this.#GetSTSQuantileGenericService(SERVICE_STATS_GLOBAL, ''),
|
|
241
|
+
this.#GetSTSHistoGenericService(SERVICE_STATS_GLOBAL, '')],
|
|
474
242
|
[ ])
|
|
475
243
|
} catch (error) {
|
|
476
244
|
console.error(`${_logPrefix}GetInfluxDBResultsRoot: Error: [${error}]`.red);
|
|
@@ -486,12 +254,9 @@ data
|
|
|
486
254
|
let retVal = null;
|
|
487
255
|
try {
|
|
488
256
|
retVal = await this.ProcessInfluxDBResults([
|
|
489
|
-
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE,
|
|
490
|
-
|
|
491
|
-
this.#
|
|
492
|
-
'', 'group(columns: ["serviceId", "_field"])'),
|
|
493
|
-
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE,
|
|
494
|
-
'', 'group(columns: ["serviceId", "_field"])')],
|
|
257
|
+
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE, ''),
|
|
258
|
+
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE, ''),
|
|
259
|
+
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE, '')],
|
|
495
260
|
['serviceId'])
|
|
496
261
|
} catch (error) {
|
|
497
262
|
console.error(`${_logPrefix}GetInfluxDBResultsService: Error: [${error}]`.red);
|
|
@@ -509,12 +274,9 @@ data
|
|
|
509
274
|
try {
|
|
510
275
|
const serviceId = subscriptionKey.key as string;
|
|
511
276
|
retVal = await this.ProcessInfluxDBResults([
|
|
512
|
-
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE,
|
|
513
|
-
|
|
514
|
-
this.#
|
|
515
|
-
`and r["serviceId"] == "${serviceId}"`, 'group(columns: ["serviceId", "serviceInstanceId", "_field"])'),
|
|
516
|
-
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE,
|
|
517
|
-
`and r["serviceId"] == "${serviceId}"`, 'group(columns: ["serviceId", "serviceInstanceId", "_field"])')],
|
|
277
|
+
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"`),
|
|
278
|
+
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"`),
|
|
279
|
+
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"`)],
|
|
518
280
|
['serviceId', 'serviceInstanceId'])
|
|
519
281
|
} catch (error) {
|
|
520
282
|
console.error(`${_logPrefix}GetInfluxDBResultsServiceInstances: Error: [${error}]`.red);
|
|
@@ -531,12 +293,9 @@ data
|
|
|
531
293
|
try {
|
|
532
294
|
const serviceInstanceId = subscriptionKey.key as string;
|
|
533
295
|
retVal = await this.ProcessInfluxDBResults([
|
|
534
|
-
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS,
|
|
535
|
-
|
|
536
|
-
this.#
|
|
537
|
-
`and r["serviceInstanceId"] == "${serviceInstanceId}"`, 'group(columns: ["serviceId", "serviceInstanceId", "serviceInstanceProcessId", "_field"])'),
|
|
538
|
-
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS,
|
|
539
|
-
`and r["serviceInstanceId"] == "${serviceInstanceId}"`, 'group(columns: ["serviceId", "serviceInstanceId", "serviceInstanceProcessId", "_field"])')],
|
|
296
|
+
this.#GetSTSCountGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"`),
|
|
297
|
+
this.#GetSTSQuantileGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"`),
|
|
298
|
+
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"`)],
|
|
540
299
|
['serviceId', 'serviceInstanceId', 'serviceInstanceProcessId'])
|
|
541
300
|
} catch (error) {
|
|
542
301
|
console.error(`${_logPrefix}GetInfluxDBResultsServiceInstance: Error: [${error}]`.red);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"influxDBManagerService.d.ts","sourceRoot":"","sources":["../../src/influxdb/influxDBManagerService.ts"],"names":[],"mappings":";AA8GA,OAAO,EAAS,QAAQ,EAAE,QAAQ,EAAE,MAAM,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