1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | import { LabelKey, LabelValue, Metric, MetricDescriptorType, TimeSeries, Timestamp } from '../export/types';
|
17 | import { Meter } from '../types';
|
18 | import { CumulativePoint } from './types';
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export declare class Cumulative implements Meter {
|
25 | readonly labelKeys: LabelKey[];
|
26 | readonly constantLabels: Map<LabelKey, LabelValue>;
|
27 | private readonly metricDescriptor;
|
28 | private labelKeysLength;
|
29 | private defaultLabelValues;
|
30 | private registeredPoints;
|
31 | private readonly constantLabelValues;
|
32 | |
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | constructor(name: string, description: string, unit: string, type: MetricDescriptorType, labelKeys: LabelKey[], constantLabels: Map<LabelKey, LabelValue>);
|
43 | /**
|
44 | * Creates a TimeSeries and returns a Point if the specified
|
45 | * labelValues is not already associated with this cumulative, else returns an
|
46 | * existing Point.
|
47 | *
|
48 | * It is recommended to keep a reference to the Point instead of always
|
49 | * calling this method for manual operations.
|
50 | *
|
51 | * @param labelValues The list of the label values.
|
52 | * @returns The value of single cumulative.
|
53 | */
|
54 | getOrCreateTimeSeries(labelValues: LabelValue[]): CumulativePoint;
|
55 | /**
|
56 | * Returns a Point for a cumulative with all labels not set, or default
|
57 | * labels.
|
58 | *
|
59 | * @returns The value of single cumulative.
|
60 | */
|
61 | getDefaultTimeSeries(): CumulativePoint;
|
62 | /**
|
63 | * Removes the TimeSeries from the cumulative metric, if it is present. i.e.
|
64 | * references to previous Point objects are invalid (not part of the
|
65 | * metric).
|
66 | *
|
67 | * @param labelValues The list of label values.
|
68 | */
|
69 | removeTimeSeries(labelValues: LabelValue[]): void;
|
70 | /**
|
71 | * Removes all TimeSeries from the cumulative metric. i.e. references to all
|
72 | * previous Point objects are invalid (not part of the metric).
|
73 | */
|
74 | clear(): void;
|
75 | /**
|
76 | * Registers a TimeSeries and returns a Point if the specified
|
77 | * labelValues is not already associated with this cumulative, else returns an
|
78 | * existing Point.
|
79 | *
|
80 | * @param labelValues The list of the label values.
|
81 | * @returns The value of single cumulative.
|
82 | */
|
83 | private registerTimeSeries;
|
84 | /**
|
85 | * Provides a Metric with one or more TimeSeries.
|
86 | *
|
87 | * @returns The Metric, or null if TimeSeries is not present in Metric.
|
88 | */
|
89 | getMetric(): Metric | null;
|
90 | }
|
91 | /**
|
92 | * The value of a single point in the Cumulative.TimeSeries.
|
93 | */
|
94 | export declare class CumulativePointEntry implements CumulativePoint {
|
95 | private readonly labelValues;
|
96 | private startTimestamp;
|
97 | private value;
|
98 | constructor(labelValues: LabelValue[]);
|
99 | /** Reset cumulative metric. */
|
100 | reset(): void;
|
101 | /**
|
102 | * Increment the cumulative metric.
|
103 | * @param val The new value.
|
104 | */
|
105 | inc(val?: number): void;
|
106 | /**
|
107 | * Returns the TimeSeries with one or more Point.
|
108 | *
|
109 | * @param now The time at which the cumulative is recorded.
|
110 | * @returns The TimeSeries.
|
111 | */
|
112 | getTimeSeries(now: Timestamp): TimeSeries;
|
113 | }
|