UNPKG

2.21 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 * as configTypes from '../trace/config/types';
17import * as modelTypes from '../trace/model/types';
18import * as types from './types';
19/** Controls the sending of traces to exporters. */
20export declare class ExporterBuffer {
21 /** The service to send the collected spans. */
22 private exporter;
23 /** Maximum size of a buffer. */
24 private bufferSize;
25 /** Max time for a buffer can wait before being sent */
26 private bufferTimeout;
27 /** Manage when the buffer timeout needs to be reseted */
28 private resetTimeout;
29 /** Indicates when the buffer timeout is running */
30 private bufferTimeoutInProgress;
31 /** An object to log information to */
32 private logger;
33 /** Trace queue of a buffer */
34 private queue;
35 /**
36 * Constructs a new Buffer instance.
37 * @param exporter The service to send the collected spans.
38 * @param config A buffer configuration object to create a buffer.
39 */
40 constructor(exporter: types.Exporter, config: configTypes.BufferConfig);
41 /**
42 * Set the buffer size value.
43 * @param bufferSize The new buffer size.
44 */
45 setBufferSize(bufferSize: number): this;
46 getBufferSize(): number;
47 getQueue(): modelTypes.Span[];
48 /**
49 * Add a span in the buffer.
50 * @param span Span to be added in the buffer.
51 */
52 addToBuffer(span: modelTypes.Span): this;
53 /** Reset the buffer timeout */
54 private resetBufferTimeout;
55 /** Start the buffer timeout, when finished calls flush method */
56 private setBufferTimeout;
57 /** Send the trace queue to all exporters */
58 private flush;
59}