1 | import { Attributes, AttributeValue } from '../common/Attributes';
|
2 | import { Context } from '../context/types';
|
3 | import { BatchObservableResult, ObservableResult } from './ObservableResult';
|
4 |
|
5 |
|
6 |
|
7 | export interface MetricOptions {
|
8 | |
9 |
|
10 |
|
11 |
|
12 | description?: string;
|
13 | |
14 |
|
15 |
|
16 |
|
17 | unit?: string;
|
18 | |
19 |
|
20 |
|
21 |
|
22 | valueType?: ValueType;
|
23 | }
|
24 |
|
25 | export declare enum ValueType {
|
26 | INT = 0,
|
27 | DOUBLE = 1
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | export interface Counter<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
45 | |
46 |
|
47 |
|
48 | add(value: number, attributes?: AttributesTypes, context?: Context): void;
|
49 | }
|
50 | export interface UpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
51 | |
52 |
|
53 |
|
54 | add(value: number, attributes?: AttributesTypes, context?: Context): void;
|
55 | }
|
56 | export interface Histogram<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
57 | |
58 |
|
59 |
|
60 | record(value: number, attributes?: AttributesTypes, context?: Context): void;
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 | export declare type MetricAttributes = Attributes;
|
66 |
|
67 |
|
68 |
|
69 | export declare type MetricAttributeValue = AttributeValue;
|
70 |
|
71 |
|
72 |
|
73 | export declare type ObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (observableResult: ObservableResult<AttributesTypes>) => void | Promise<void>;
|
74 |
|
75 |
|
76 |
|
77 | export declare type BatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (observableResult: BatchObservableResult<AttributesTypes>) => void | Promise<void>;
|
78 | export interface Observable<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
79 | |
80 |
|
81 |
|
82 |
|
83 |
|
84 | addCallback(callback: ObservableCallback<AttributesTypes>): void;
|
85 | |
86 |
|
87 |
|
88 | removeCallback(callback: ObservableCallback<AttributesTypes>): void;
|
89 | }
|
90 | export declare type ObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
91 | export declare type ObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
92 | export declare type ObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
93 |
|
\ | No newline at end of file |