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 * as types from './types';
|
19 |
|
20 |
|
21 |
|
22 | export declare class Gauge implements Meter {
|
23 | readonly labelKeys: LabelKey[];
|
24 | readonly constantLabels: Map<LabelKey, LabelValue>;
|
25 | private readonly metricDescriptor;
|
26 | private labelKeysLength;
|
27 | private defaultLabelValues;
|
28 | private registeredPoints;
|
29 | private readonly constantLabelValues;
|
30 | private static readonly LABEL_VALUE;
|
31 | private static readonly LABEL_VALUES;
|
32 | private static readonly ERROR_MESSAGE_INVALID_SIZE;
|
33 | |
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | constructor(name: string, description: string, unit: string, type: MetricDescriptorType, labelKeys: LabelKey[], constantLabels: Map<LabelKey, LabelValue>);
|
44 | /**
|
45 | * Creates a TimeSeries and returns a Point if the specified
|
46 | * labelValues is not already associated with this gauge, else returns an
|
47 | * existing Point.
|
48 | *
|
49 | * It is recommended to keep a reference to the Point instead of always
|
50 | * calling this method for manual operations.
|
51 | *
|
52 | * @param labelValues The list of the label values.
|
53 | * @returns The value of single gauge.
|
54 | */
|
55 | getOrCreateTimeSeries(labelValues: LabelValue[]): types.Point;
|
56 | /**
|
57 | * Returns a Point for a gauge with all labels not set, or default
|
58 | * labels.
|
59 | *
|
60 | * @returns The value of single gauge.
|
61 | */
|
62 | getDefaultTimeSeries(): types.Point;
|
63 | /**
|
64 | * Removes the TimeSeries from the gauge metric, if it is present. i.e.
|
65 | * references to previous Point objects are invalid (not part of the
|
66 | * metric).
|
67 | *
|
68 | * @param labelValues The list of label values.
|
69 | */
|
70 | removeTimeSeries(labelValues: LabelValue[]): void;
|
71 | /**
|
72 | * Removes all TimeSeries from the gauge metric. i.e. references to all
|
73 | * previous Point objects are invalid (not part of the metric).
|
74 | */
|
75 | clear(): void;
|
76 | /**
|
77 | * Registers a TimeSeries and returns a Point if the specified
|
78 | * labelValues is not already associated with this gauge, else returns an
|
79 | * existing Point.
|
80 | *
|
81 | * @param labelValues The list of the label values.
|
82 | * @returns The value of single gauge.
|
83 | */
|
84 | private registerTimeSeries;
|
85 | /**
|
86 | * Provides a Metric with one or more TimeSeries.
|
87 | *
|
88 | * @returns The Metric, or null if TimeSeries is not present in Metric.
|
89 | */
|
90 | getMetric(): Metric | null;
|
91 | }
|
92 | /**
|
93 | * The value of a single point in the Gauge.TimeSeries.
|
94 | */
|
95 | export declare class PointEntry implements types.Point {
|
96 | private readonly labelValues;
|
97 | private value;
|
98 | constructor(labelValues: LabelValue[]);
|
99 | /**
|
100 | * Adds the given value to the current value. The values can be negative.
|
101 | *
|
102 | * @param amt The value to add.
|
103 | */
|
104 | add(amt: number): void;
|
105 | /**
|
106 | * Sets the given value.
|
107 | *
|
108 | * @param val The new value.
|
109 | */
|
110 | set(val: number): void;
|
111 | /**
|
112 | * Returns the TimeSeries with one or more Point.
|
113 | *
|
114 | * @param timestamp The time at which the gauge is recorded.
|
115 | * @returns The TimeSeries.
|
116 | */
|
117 | getTimeSeries(timestamp: Timestamp): TimeSeries;
|
118 | }
|