1 | /*!
|
2 | * Copyright 2017 Google Inc. All Rights Reserved.
|
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 | */
|
16 | export interface HistogramOptions {
|
17 | min?: number;
|
18 | max?: number;
|
19 | }
|
20 | /*!
|
21 | * The Histogram class is used to capture the lifespan of messages within the
|
22 | * the client. These durations are then used to calculate the 99th percentile
|
23 | * of ack deadlines for future messages.
|
24 | *
|
25 | * @private
|
26 | * @class
|
27 | */
|
28 | export declare class Histogram {
|
29 | options: HistogramOptions;
|
30 | data: Map<number, number>;
|
31 | length: number;
|
32 | constructor(options?: HistogramOptions);
|
33 | /*!
|
34 | * Adds a value to the histogram.
|
35 | *
|
36 | * @private
|
37 | * @param {numnber} value - The value in milliseconds.
|
38 | */
|
39 | add(value: number): void;
|
40 | /*!
|
41 | * Retrieves the nth percentile of recorded values.
|
42 | *
|
43 | * @private
|
44 | * @param {number} percent The requested percentage.
|
45 | * @return {number}
|
46 | */
|
47 | percentile(percent: number): number;
|
48 | }
|