@promster/metrics 9.1.2 → 9.1.5
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.
|
@@ -386,7 +386,7 @@ const normalizeStatusCode = statusCode => statusCode;
|
|
|
386
386
|
|
|
387
387
|
const urlValueParser = new UrlValueParser__default["default"]();
|
|
388
388
|
|
|
389
|
-
const normalizePath = path => urlValueParser.replacePathValues(url__default["default"].parse(path).pathname);
|
|
389
|
+
const normalizePath = path => urlValueParser.replacePathValues(url__default["default"].parse(path).pathname, '#val');
|
|
390
390
|
|
|
391
391
|
const normalizeMethod = method => method.toLowerCase();
|
|
392
392
|
|
|
@@ -396,121 +396,39 @@ const defaultNormalizers = {
|
|
|
396
396
|
normalizeMethod
|
|
397
397
|
};
|
|
398
398
|
|
|
399
|
-
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
400
|
-
if (privateCollection.has(obj)) {
|
|
401
|
-
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
406
|
-
_checkPrivateRedeclaration(obj, privateMap);
|
|
407
|
-
privateMap.set(obj, value);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
function _defineProperty(obj, key, value) {
|
|
411
|
-
if (key in obj) {
|
|
412
|
-
Object.defineProperty(obj, key, {
|
|
413
|
-
value: value,
|
|
414
|
-
enumerable: true,
|
|
415
|
-
configurable: true,
|
|
416
|
-
writable: true
|
|
417
|
-
});
|
|
418
|
-
} else {
|
|
419
|
-
obj[key] = value;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
return obj;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
426
|
-
if (descriptor.set) {
|
|
427
|
-
descriptor.set.call(receiver, value);
|
|
428
|
-
} else {
|
|
429
|
-
if (!descriptor.writable) {
|
|
430
|
-
throw new TypeError("attempted to set read only private field");
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
descriptor.value = value;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
|
438
|
-
if (!privateMap.has(receiver)) {
|
|
439
|
-
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return privateMap.get(receiver);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
446
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
|
|
447
|
-
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
448
|
-
return value;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
function _classApplyDescriptorGet(receiver, descriptor) {
|
|
452
|
-
if (descriptor.get) {
|
|
453
|
-
return descriptor.get.call(receiver);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
return descriptor.value;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function _classPrivateFieldGet(receiver, privateMap) {
|
|
460
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
461
|
-
return _classApplyDescriptorGet(receiver, descriptor);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
var _startTime = /*#__PURE__*/new WeakMap();
|
|
465
|
-
|
|
466
|
-
var _endTime = /*#__PURE__*/new WeakMap();
|
|
467
|
-
|
|
468
399
|
class Timing {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
value: void 0
|
|
473
|
-
});
|
|
474
|
-
|
|
475
|
-
_classPrivateFieldInitSpec(this, _endTime, {
|
|
476
|
-
writable: true,
|
|
477
|
-
value: void 0
|
|
478
|
-
});
|
|
400
|
+
static NS_PER_SEC = BigInt(1e9);
|
|
401
|
+
#startTime;
|
|
402
|
+
#endTime;
|
|
479
403
|
|
|
404
|
+
constructor() {
|
|
480
405
|
this.reset();
|
|
481
406
|
}
|
|
482
407
|
|
|
483
408
|
value() {
|
|
484
|
-
const startTime =
|
|
485
|
-
|
|
486
|
-
const endTime = _classPrivateFieldGet(this, _endTime);
|
|
487
|
-
|
|
409
|
+
const startTime = this.#startTime;
|
|
410
|
+
const endTime = this.#endTime;
|
|
488
411
|
if (!endTime || !startTime) return {
|
|
489
412
|
seconds: undefined
|
|
490
413
|
};
|
|
491
414
|
return {
|
|
492
|
-
seconds: Number(
|
|
415
|
+
seconds: Number(endTime - startTime) / Number(Timing.NS_PER_SEC)
|
|
493
416
|
};
|
|
494
417
|
}
|
|
495
418
|
|
|
496
419
|
reset() {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
_classPrivateFieldSet(this, _endTime, undefined);
|
|
500
|
-
|
|
420
|
+
this.#startTime = process.hrtime.bigint();
|
|
421
|
+
this.#endTime = undefined;
|
|
501
422
|
return this;
|
|
502
423
|
}
|
|
503
424
|
|
|
504
425
|
end() {
|
|
505
|
-
|
|
506
|
-
|
|
426
|
+
this.#endTime = process.hrtime.bigint();
|
|
507
427
|
return this;
|
|
508
428
|
}
|
|
509
429
|
|
|
510
430
|
}
|
|
511
431
|
|
|
512
|
-
_defineProperty(Timing, "NS_PER_SEC", BigInt(1e9));
|
|
513
|
-
|
|
514
432
|
const timing = {
|
|
515
433
|
start() {
|
|
516
434
|
return new Timing();
|
|
@@ -386,7 +386,7 @@ const normalizeStatusCode = statusCode => statusCode;
|
|
|
386
386
|
|
|
387
387
|
const urlValueParser = new UrlValueParser__default["default"]();
|
|
388
388
|
|
|
389
|
-
const normalizePath = path => urlValueParser.replacePathValues(url__default["default"].parse(path).pathname);
|
|
389
|
+
const normalizePath = path => urlValueParser.replacePathValues(url__default["default"].parse(path).pathname, '#val');
|
|
390
390
|
|
|
391
391
|
const normalizeMethod = method => method.toLowerCase();
|
|
392
392
|
|
|
@@ -396,121 +396,39 @@ const defaultNormalizers = {
|
|
|
396
396
|
normalizeMethod
|
|
397
397
|
};
|
|
398
398
|
|
|
399
|
-
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
400
|
-
if (privateCollection.has(obj)) {
|
|
401
|
-
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
406
|
-
_checkPrivateRedeclaration(obj, privateMap);
|
|
407
|
-
privateMap.set(obj, value);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
function _defineProperty(obj, key, value) {
|
|
411
|
-
if (key in obj) {
|
|
412
|
-
Object.defineProperty(obj, key, {
|
|
413
|
-
value: value,
|
|
414
|
-
enumerable: true,
|
|
415
|
-
configurable: true,
|
|
416
|
-
writable: true
|
|
417
|
-
});
|
|
418
|
-
} else {
|
|
419
|
-
obj[key] = value;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
return obj;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
426
|
-
if (descriptor.set) {
|
|
427
|
-
descriptor.set.call(receiver, value);
|
|
428
|
-
} else {
|
|
429
|
-
if (!descriptor.writable) {
|
|
430
|
-
throw new TypeError("attempted to set read only private field");
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
descriptor.value = value;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
|
438
|
-
if (!privateMap.has(receiver)) {
|
|
439
|
-
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return privateMap.get(receiver);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
446
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
|
|
447
|
-
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
448
|
-
return value;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
function _classApplyDescriptorGet(receiver, descriptor) {
|
|
452
|
-
if (descriptor.get) {
|
|
453
|
-
return descriptor.get.call(receiver);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
return descriptor.value;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function _classPrivateFieldGet(receiver, privateMap) {
|
|
460
|
-
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
461
|
-
return _classApplyDescriptorGet(receiver, descriptor);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
var _startTime = /*#__PURE__*/new WeakMap();
|
|
465
|
-
|
|
466
|
-
var _endTime = /*#__PURE__*/new WeakMap();
|
|
467
|
-
|
|
468
399
|
class Timing {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
value: void 0
|
|
473
|
-
});
|
|
474
|
-
|
|
475
|
-
_classPrivateFieldInitSpec(this, _endTime, {
|
|
476
|
-
writable: true,
|
|
477
|
-
value: void 0
|
|
478
|
-
});
|
|
400
|
+
static NS_PER_SEC = BigInt(1e9);
|
|
401
|
+
#startTime;
|
|
402
|
+
#endTime;
|
|
479
403
|
|
|
404
|
+
constructor() {
|
|
480
405
|
this.reset();
|
|
481
406
|
}
|
|
482
407
|
|
|
483
408
|
value() {
|
|
484
|
-
const startTime =
|
|
485
|
-
|
|
486
|
-
const endTime = _classPrivateFieldGet(this, _endTime);
|
|
487
|
-
|
|
409
|
+
const startTime = this.#startTime;
|
|
410
|
+
const endTime = this.#endTime;
|
|
488
411
|
if (!endTime || !startTime) return {
|
|
489
412
|
seconds: undefined
|
|
490
413
|
};
|
|
491
414
|
return {
|
|
492
|
-
seconds: Number(
|
|
415
|
+
seconds: Number(endTime - startTime) / Number(Timing.NS_PER_SEC)
|
|
493
416
|
};
|
|
494
417
|
}
|
|
495
418
|
|
|
496
419
|
reset() {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
_classPrivateFieldSet(this, _endTime, undefined);
|
|
500
|
-
|
|
420
|
+
this.#startTime = process.hrtime.bigint();
|
|
421
|
+
this.#endTime = undefined;
|
|
501
422
|
return this;
|
|
502
423
|
}
|
|
503
424
|
|
|
504
425
|
end() {
|
|
505
|
-
|
|
506
|
-
|
|
426
|
+
this.#endTime = process.hrtime.bigint();
|
|
507
427
|
return this;
|
|
508
428
|
}
|
|
509
429
|
|
|
510
430
|
}
|
|
511
431
|
|
|
512
|
-
_defineProperty(Timing, "NS_PER_SEC", BigInt(1e9));
|
|
513
|
-
|
|
514
432
|
const timing = {
|
|
515
433
|
start() {
|
|
516
434
|
return new Timing();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promster/metrics",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.5",
|
|
4
4
|
"description": "Metrics utilities used by all other server integrations",
|
|
5
5
|
"main": "dist/promster-metrics.cjs.js",
|
|
6
6
|
"typings": "dist/promster-metrics.cjs.d.ts",
|
|
@@ -40,19 +40,18 @@
|
|
|
40
40
|
"lodash.once": "4.1.1",
|
|
41
41
|
"merge-options": "3.0.4",
|
|
42
42
|
"optional": "0.1.4",
|
|
43
|
-
"ts-essentials": "9.
|
|
43
|
+
"ts-essentials": "9.1.2",
|
|
44
44
|
"tslib": "2.3.1",
|
|
45
|
-
"url": "0.11.0",
|
|
46
45
|
"url-value-parser": "2.1.0"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
|
-
"@promster/types": "^3.2.
|
|
50
|
-
"@types/lodash": "4.14.
|
|
48
|
+
"@promster/types": "^3.2.4",
|
|
49
|
+
"@types/lodash": "4.14.180",
|
|
51
50
|
"prom-client": "14.0.1",
|
|
52
|
-
"typescript": "4.
|
|
51
|
+
"typescript": "4.6.2"
|
|
53
52
|
},
|
|
54
53
|
"optionalDependencies": {
|
|
55
|
-
"@sematext/gc-stats": "1.5.
|
|
54
|
+
"@sematext/gc-stats": "1.5.7"
|
|
56
55
|
},
|
|
57
56
|
"peerDependencies": {
|
|
58
57
|
"prom-client": "13.x.x || 14.x"
|