@promster/metrics 9.1.0 → 9.1.4
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,118 +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
|
-
|
|
487
|
-
|
|
409
|
+
const startTime = this.#startTime;
|
|
410
|
+
const endTime = this.#endTime;
|
|
411
|
+
if (!endTime || !startTime) return {
|
|
412
|
+
seconds: undefined
|
|
413
|
+
};
|
|
488
414
|
return {
|
|
489
|
-
seconds:
|
|
415
|
+
seconds: Number(endTime - startTime) / Number(Timing.NS_PER_SEC)
|
|
490
416
|
};
|
|
491
417
|
}
|
|
492
418
|
|
|
493
419
|
reset() {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
_classPrivateFieldSet(this, _endTime, undefined);
|
|
497
|
-
|
|
420
|
+
this.#startTime = process.hrtime.bigint();
|
|
421
|
+
this.#endTime = undefined;
|
|
498
422
|
return this;
|
|
499
423
|
}
|
|
500
424
|
|
|
501
425
|
end() {
|
|
502
|
-
|
|
503
|
-
|
|
426
|
+
this.#endTime = process.hrtime.bigint();
|
|
504
427
|
return this;
|
|
505
428
|
}
|
|
506
429
|
|
|
507
430
|
}
|
|
508
431
|
|
|
509
|
-
_defineProperty(Timing, "NS_PER_SEC", BigInt(1e9));
|
|
510
|
-
|
|
511
432
|
const timing = {
|
|
512
433
|
start() {
|
|
513
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,118 +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
|
-
|
|
487
|
-
|
|
409
|
+
const startTime = this.#startTime;
|
|
410
|
+
const endTime = this.#endTime;
|
|
411
|
+
if (!endTime || !startTime) return {
|
|
412
|
+
seconds: undefined
|
|
413
|
+
};
|
|
488
414
|
return {
|
|
489
|
-
seconds:
|
|
415
|
+
seconds: Number(endTime - startTime) / Number(Timing.NS_PER_SEC)
|
|
490
416
|
};
|
|
491
417
|
}
|
|
492
418
|
|
|
493
419
|
reset() {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
_classPrivateFieldSet(this, _endTime, undefined);
|
|
497
|
-
|
|
420
|
+
this.#startTime = process.hrtime.bigint();
|
|
421
|
+
this.#endTime = undefined;
|
|
498
422
|
return this;
|
|
499
423
|
}
|
|
500
424
|
|
|
501
425
|
end() {
|
|
502
|
-
|
|
503
|
-
|
|
426
|
+
this.#endTime = process.hrtime.bigint();
|
|
504
427
|
return this;
|
|
505
428
|
}
|
|
506
429
|
|
|
507
430
|
}
|
|
508
431
|
|
|
509
|
-
_defineProperty(Timing, "NS_PER_SEC", BigInt(1e9));
|
|
510
|
-
|
|
511
432
|
const timing = {
|
|
512
433
|
start() {
|
|
513
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.4",
|
|
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",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/tdeekens/
|
|
24
|
+
"url": "https://github.com/tdeekens/promster.git",
|
|
25
25
|
"directory": "packages/metrics"
|
|
26
26
|
},
|
|
27
27
|
"author": "Tobias Deekens <nerd@tdeekens.name>",
|
|
@@ -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": "
|
|
46
|
-
"url-value-parser": "2.0.3"
|
|
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.3",
|
|
49
|
+
"@types/lodash": "4.14.178",
|
|
51
50
|
"prom-client": "14.0.1",
|
|
52
|
-
"typescript": "4.
|
|
51
|
+
"typescript": "4.5.5"
|
|
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"
|