UNPKG

5 kBTypeScriptView Raw
1/**
2 * Copyright 2018, OpenCensus Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { Cumulative } from './cumulative/cumulative';
17import { DerivedCumulative } from './cumulative/derived-cumulative';
18import { MetricProducer } from './export/types';
19import { DerivedGauge } from './gauges/derived-gauge';
20import { Gauge } from './gauges/gauge';
21import { MetricOptions } from './types';
22/**
23 * Creates and manages application's set of metrics.
24 */
25export declare class MetricRegistry {
26 private registeredMetrics;
27 private metricProducer;
28 private static readonly NAME;
29 private static readonly LABEL_KEY;
30 private static readonly CONSTANT_LABELS;
31 private static readonly DEFAULT_DESCRIPTION;
32 private static readonly DEFAULT_UNIT;
33 private static readonly DEFAULT_LABEL_KEYS;
34 private static readonly DEFAULT_CONSTANT_LABEL;
35 constructor();
36 /**
37 * Builds a new Int64 gauge to be added to the registry. This is more
38 * convenient form when you want to manually increase and decrease values as
39 * per your service requirements.
40 *
41 * @param name The name of the metric.
42 * @param options The options for the metric.
43 * @returns A Int64 Gauge metric.
44 */
45 addInt64Gauge(name: string, options?: MetricOptions): Gauge;
46 /**
47 * Builds a new double gauge to be added to the registry. This is more
48 * convenient form when you want to manually increase and decrease values as
49 * per your service requirements.
50 *
51 * @param name The name of the metric.
52 * @param options The options for the metric.
53 * @returns A Double Gauge metric.
54 */
55 addDoubleGauge(name: string, options?: MetricOptions): Gauge;
56 /**
57 * Builds a new derived Int64 gauge to be added to the registry. This is more
58 * convenient form when you want to manually increase and decrease values as
59 * per your service requirements.
60 *
61 * @param name The name of the metric.
62 * @param options The options for the metric.
63 * @returns A Int64 DerivedGauge metric.
64 */
65 addDerivedInt64Gauge(name: string, options?: MetricOptions): DerivedGauge;
66 /**
67 * Builds a new derived double gauge to be added to the registry. This is more
68 * convenient form when you want to manually increase and decrease values as
69 * per your service requirements.
70 *
71 * @param name The name of the metric.
72 * @param options The options for the metric.
73 * @returns A Double DerivedGauge metric.
74 */
75 addDerivedDoubleGauge(name: string, options?: MetricOptions): DerivedGauge;
76 /**
77 * Builds a new Int64 cumulative to be added to the registry. This API is
78 * useful when you want to manually increase and reset values as per service
79 * requirements.
80 *
81 * @param name The name of the metric.
82 * @param options The options for the metric.
83 * @returns A Int64 Cumulative metric.
84 */
85 addInt64Cumulative(name: string, options?: MetricOptions): Cumulative;
86 /**
87 * Builds a new double cumulative to be added to the registry. This API is
88 * useful when you want to manually increase and reset values as per service
89 * requirements.
90 *
91 * @param name The name of the metric.
92 * @param options The options for the metric.
93 * @returns A Double Cumulative metric.
94 */
95 addDoubleCumulative(name: string, options?: MetricOptions): Cumulative;
96 /**
97 * Builds a new derived Int64 Cumulative to be added to the registry.
98 *
99 * @param name The name of the metric.
100 * @param options The options for the metric.
101 * @returns A Int64 DerivedCumulative metric.
102 */
103 addDerivedInt64Cumulative(name: string, options?: MetricOptions): DerivedCumulative;
104 /**
105 * Builds a new derived Double Cumulative to be added to the registry.
106 *
107 * @param name The name of the metric.
108 * @param options The options for the metric.
109 * @returns A Double DerivedCumulative metric.
110 */
111 addDerivedDoubleCumulative(name: string, options?: MetricOptions): DerivedCumulative;
112 /**
113 * Registers metric to register.
114 *
115 * @param name The name of the metric.
116 * @param meter The metric to register.
117 */
118 private registerMetric;
119 /**
120 * Gets a metric producer for registry.
121 *
122 * @returns The metric producer.
123 */
124 getMetricProducer(): MetricProducer;
125 /** Validates labelKeys and constantLabels. */
126 private validateLables;
127}