-
Notifications
You must be signed in to change notification settings - Fork 0
/
ICounters.ts
73 lines (66 loc) · 2.04 KB
/
ICounters.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/** @module count */
import { Timing } from './Timing';
/**
* Interface for performance counters that measure execution metrics.
*
* The performance counters measure how code is performing:
* how fast or slow, how many transactions performed, how many objects
* are stored, what was the latest transaction time and so on.
*
* They are critical to monitor and improve performance, scalability
* and reliability of code in production.
*/
export interface ICounters {
/**
* Begins measurement of execution time interval.
* It returns [[Timing]] object which has to be called at
* [[Timing.endTiming]] to end the measurement and update the counter.
*
* @param name a counter name of Interval type.
* @returns a [[Timing]] callback object to end timing.
*/
beginTiming(name: string) : Timing;
/**
* Calculates min/average/max statistics based on the current and previous values.
*
* @param name a counter name of Statistics type
* @param value a value to update statistics
*/
stats(name: string, value: number) : void;
/**
* Records the last calculated measurement value.
*
* Usually this method is used by metrics calculated
* externally.
*
* @param name a counter name of Last type.
* @param value a last value to record.
*/
last(name: string, value: number) : void;
/**
* Records the current time as a timestamp.
*
* @param name a counter name of Timestamp type.
*/
timestampNow(name: string) : void;
/**
* Records the given timestamp.
*
* @param name a counter name of Timestamp type.
* @param value a timestamp to record.
*/
timestamp(name: string, value: Date) : void;
/**
* Increments counter by 1.
*
* @param name a counter name of Increment type.
*/
incrementOne(name: string) : void;
/**
* Increments counter by given value.
*
* @param name a counter name of Increment type.
* @param value a value to add to the counter.
*/
increment(name: string, value: number) : void;
}