@bull-monitor/root
Advanced tools
Comparing version 2.14.1 to 2.15.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.15.0](https://github.com/s-r-x/bull-monitor/compare/v2.14.1...v2.15.0) (2021-12-06) | ||
### Features | ||
* min/max processing time metrics ([a22c234](https://github.com/s-r-x/bull-monitor/commit/a22c234709d175963ba0f545f6364ed12ce0743b)) | ||
## [2.14.1](https://github.com/s-r-x/bull-monitor/compare/v2.14.0...v2.14.1) (2021-11-29) | ||
@@ -8,0 +19,0 @@ |
@@ -12,2 +12,4 @@ /// <reference types="bull" /> | ||
processingTime?: number | undefined; | ||
processingTimeMin?: number | undefined; | ||
processingTimeMax?: number | undefined; | ||
}[]>; | ||
@@ -14,0 +16,0 @@ clearAllMetrics(): Promise<boolean>; |
@@ -10,4 +10,6 @@ "use strict"; | ||
processingTime: Float | ||
processingTimeMin: Float | ||
processingTimeMax: Float | ||
} | ||
`; | ||
//# sourceMappingURL=metrics.js.map |
@@ -9,2 +9,4 @@ import type { JobCounts } from 'bull'; | ||
processingTime?: number; | ||
processingTimeMin?: number; | ||
processingTimeMax?: number; | ||
}; | ||
@@ -34,2 +36,3 @@ export declare class MetricsCollector { | ||
private _extractProcessingTime; | ||
private _normalizeProcessingTime; | ||
private _buildPersistKey; | ||
@@ -36,0 +39,0 @@ private get _redisClient(); |
@@ -91,8 +91,3 @@ "use strict"; | ||
this._processingTimeGauge.set(queue.id, []); | ||
return { | ||
timestamp, | ||
queue: queue.id, | ||
counts: yield queue.getJobCounts(), | ||
processingTime, | ||
}; | ||
return Object.assign({ timestamp, queue: queue.id, counts: yield queue.getJobCounts() }, processingTime); | ||
}))); | ||
@@ -151,9 +146,13 @@ }); | ||
const stats = this._processingTimeGauge.get(queue); | ||
if (isEmpty_1.default(stats)) { | ||
return; | ||
} | ||
else { | ||
return round_1.default(sum_1.default(stats) / stats.length, 2); | ||
} | ||
if (isEmpty_1.default(stats)) | ||
return {}; | ||
return { | ||
processingTime: this._normalizeProcessingTime(sum_1.default(stats) / stats.length), | ||
processingTimeMin: this._normalizeProcessingTime(Math.min(...stats)), | ||
processingTimeMax: this._normalizeProcessingTime(Math.max(...stats)), | ||
}; | ||
} | ||
_normalizeProcessingTime(time) { | ||
return round_1.default(time, 2); | ||
} | ||
_buildPersistKey(queue) { | ||
@@ -160,0 +159,0 @@ return this._config.redisPrefix + queue; |
@@ -253,2 +253,4 @@ export declare type Maybe<T> = T | null; | ||
processingTime?: Maybe<Scalars['Float']>; | ||
processingTimeMin?: Maybe<Scalars['Float']>; | ||
processingTimeMax?: Maybe<Scalars['Float']>; | ||
}; | ||
@@ -255,0 +257,0 @@ export declare type RedisInfo = { |
{ | ||
"name": "@bull-monitor/root", | ||
"version": "2.14.1", | ||
"version": "2.15.0", | ||
"repository": { | ||
@@ -42,3 +42,3 @@ "type": "git", | ||
}, | ||
"gitHead": "b4304e25f8bb4b3996f7ba325c64e573cdf08775" | ||
"gitHead": "d3fa5b6bc945b3214ae49e0d886df847b450ef26" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
133444
2133