Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 18 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import prometheus from 'prom-client'; |
||
2 | |||
3 | import objectOnlyKeys from 'utils/object-only-keys'; |
||
4 | // import objectContains from 'utils/object-contains'; |
||
5 | |||
6 | const { Summary } = prometheus; |
||
7 | |||
8 | export default class Timer extends Summary { |
||
9 | start(untrimmedLabels = {}) { |
||
10 | const { labelNames } = this; |
||
11 | const labels = objectOnlyKeys(untrimmedLabels, labelNames); |
||
12 | const timerStopper = this.startTimer(labels); |
||
13 | return (dirtyEndLabels = {}) => { |
||
14 | const endLabels = objectOnlyKeys(dirtyEndLabels, labelNames); |
||
15 | timerStopper(endLabels); |
||
16 | }; |
||
17 | } |
||
18 | } |
||
19 |