UNPKG

2.69 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 loggerTypes from '../common/types';
17import { Measurement, View } from '../stats/types';
18import { TagKey, TagValue } from '../tags/types';
19import * as modelTypes from '../trace/model/types';
20import { Exporter, ExporterConfig, StatsEventListener } from './types';
21/** Do not send span data */
22export declare class NoopExporter implements Exporter {
23 logger?: loggerTypes.Logger;
24 onStartSpan(span: modelTypes.Span): void;
25 onEndSpan(span: modelTypes.Span): void;
26 publish(spans: modelTypes.Span[]): Promise<void>;
27}
28/** Format and sends span data to the console. */
29export declare class ConsoleExporter implements Exporter {
30 /** Buffer object to store the spans. */
31 logger: loggerTypes.Logger;
32 private buffer;
33 /**
34 * Constructs a new ConsoleExporter instance.
35 * @param config Exporter configuration object to create a console log
36 * exporter.
37 */
38 constructor(config: ExporterConfig);
39 onStartSpan(span: modelTypes.Span): void;
40 /**
41 * Event called when a span is ended.
42 * @param span Ended span.
43 */
44 onEndSpan(span: modelTypes.Span): void;
45 /**
46 * Sends the spans information to the console.
47 * @param spans A list of spans to publish.
48 */
49 publish(spans: modelTypes.Span[]): Promise<void>;
50}
51/** Exporter that receives stats data and shows in the log console. */
52export declare class ConsoleStatsExporter implements StatsEventListener {
53 /**
54 * Event called when a view is registered
55 * @param view registered view
56 */
57 onRegisterView(view: View): void;
58 /**
59 * Event called when a measurement is recorded
60 * @param view recorded view from measurement
61 * @param measurement recorded measurement
62 * @param tags The tags to which the value is applied
63 */
64 onRecord(views: View[], measurement: Measurement, tags: Map<TagKey, TagValue>): void;
65 /**
66 * Starts the Console exporter that polls Metric from Metrics library and
67 * shows in the log console..
68 */
69 start(): void;
70 /** Stops the exporter. */
71 stop(): void;
72}