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 | */
|
16 | import { Measurement, View } from '../stats/types';
|
17 | import { TagKey, TagValue } from '../tags/types';
|
18 | import * as configTypes from '../trace/config/types';
|
19 | import * as modelTypes from '../trace/model/types';
|
20 | /** Defines a trace exporter interface. */
|
21 | export interface Exporter extends modelTypes.SpanEventListener {
|
22 | /**
|
23 | * Sends a list of spans to the service.
|
24 | * @param spans A list of spans to publish.
|
25 | */
|
26 | publish(spans: modelTypes.Span[]): Promise<number | string | void>;
|
27 | }
|
28 | /**
|
29 | * An interface that describes the possible events that will be emitted from a
|
30 | * Stats instance. Stats exporters should implement this interface.
|
31 | */
|
32 | export interface StatsEventListener {
|
33 | /**
|
34 | * Is called whenever a new view is registered
|
35 | * @deprecated since version 0.0.9 - use {@link start} instead
|
36 | * @param view The registered view
|
37 | */
|
38 | onRegisterView(view: View): void;
|
39 | /**
|
40 | * Is called whenever a new measurement is recorded.
|
41 | * @deprecated since version 0.0.9 - use {@link start} instead
|
42 | * @param views The views related to the measurement
|
43 | * @param measurement The recorded measurement
|
44 | * @param tags The tags to which the value is applied
|
45 | */
|
46 | onRecord(views: View[], measurement: Measurement, tags: Map<TagKey, TagValue>): void;
|
47 | /**
|
48 | * Starts the exporter that polls Metric from Metrics library and send
|
49 | * batched data to backend.
|
50 | */
|
51 | start(): void;
|
52 | /** Stops the exporter. */
|
53 | stop(): void;
|
54 | }
|
55 | export declare type ExporterConfig = configTypes.BufferConfig;
|