UNPKG

2.26 kBTypeScriptView Raw
1/**
2 * Copyright 2019, 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 { MeasureUnit } from './../stats/types';
17import { LabelKey, LabelValue, Metric } from './export/types';
18/** Provides a {@link Metric} with one or more {@link TimeSeries} */
19export interface Meter {
20 /**
21 * Provides a Metric with one or more TimeSeries.
22 *
23 * @returns The Metric, or null if TimeSeries is not present in Metric.
24 */
25 getMetric(): Metric | null;
26}
27/** Options for every metric added to the MetricRegistry. */
28export interface MetricOptions {
29 /** The description of the metric. */
30 readonly description?: string;
31 /** The unit of the metric. */
32 readonly unit?: MeasureUnit;
33 /** The list of the label keys. */
34 readonly labelKeys?: LabelKey[];
35 /** The map of constant labels for the Metric. */
36 readonly constantLabels?: Map<LabelKey, LabelValue>;
37}
38/** Interface for objects with "length()" method. */
39export interface LengthMethodInterface {
40 length(): number;
41}
42/** Interface for objects with "length" attribute (e.g. Array). */
43export interface LengthAttributeInterface {
44 length: number;
45}
46/** Interface for objects with "size" method. */
47export interface SizeMethodInterface {
48 size(): number;
49}
50/** Interface for objects with "size" attribute (e.g. Map, Set). */
51export interface SizeAttributeInterface {
52 size: number;
53}
54/** Interface for objects with "getValue" method. */
55export interface ToValueInterface {
56 getValue(): number;
57}
58export interface AccessorFunction {
59 (): number;
60}
61export declare type AccessorInterface = LengthAttributeInterface | LengthMethodInterface | SizeAttributeInterface | SizeMethodInterface | ToValueInterface | AccessorFunction;