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 { Logger } from '../../common/types';
|
17 | import { Exporter } from '../../exporters/types';
|
18 | import { Stats } from '../../stats/types';
|
19 | import { PluginNames } from '../instrumentation/types';
|
20 | import { Attributes } from '../model/types';
|
21 | import { Propagation } from '../propagation/types';
|
22 | /** Interface configuration for a buffer. */
|
23 | export interface BufferConfig {
|
24 | /** Maximum size of a buffer. */
|
25 | bufferSize?: number;
|
26 | /** Max time for a buffer can wait before being sent */
|
27 | bufferTimeout?: number;
|
28 | /** A logger object */
|
29 | logger?: Logger;
|
30 | }
|
31 | /** Defines tracer configuration parameters */
|
32 | export interface TracerConfig {
|
33 | /** A set of default attributes each in the format [KEY]:[VALUE] */
|
34 | defaultAttributes?: Attributes;
|
35 | /** Determines the sampling rate. Ranges from 0.0 to 1.0 */
|
36 | samplingRate?: number;
|
37 | /** A logger object */
|
38 | logger?: Logger;
|
39 | /** A propagation instance */
|
40 | propagation?: Propagation;
|
41 | /** Trace Parameters */
|
42 | traceParams?: TraceParams;
|
43 | }
|
44 | /** Available configuration options. */
|
45 | export interface TracingConfig {
|
46 | /** level of logger - 0:disable, 1: error, 2: warn, 3: info, 4: debug */
|
47 | logLevel?: number;
|
48 | /**
|
49 | * The maximum number of characters reported on a label value.
|
50 | */
|
51 | maximumLabelValueSize?: number;
|
52 | /**
|
53 | * A list of trace instrumentations plugins to load.
|
54 | * Each key is the name of the module to trace, and its
|
55 | * value is the name of the package which has the plugin
|
56 | * implementation.
|
57 | * Ex.:
|
58 | * plugins: {
|
59 | * 'http': '@opencensus/opencensus-instrumentation-http',
|
60 | * 'mongodb-core': '@opencensus/opencensus-instrumentation-mongodb-core',
|
61 | * ...
|
62 | * }
|
63 | * Any user-provided value will be added to the default list.
|
64 | * It will override any default plugin for the same key.
|
65 | */
|
66 | plugins?: PluginNames;
|
67 | /** An exporter object */
|
68 | exporter?: Exporter;
|
69 | /** An instance of a logger */
|
70 | logger?: Logger;
|
71 | /** An instance of a stats */
|
72 | stats?: Stats;
|
73 | }
|
74 | /** Global configuration of trace service */
|
75 | export interface TraceParams {
|
76 | /**
|
77 | * numberOfAnnontationEventsPerSpan is number of annotation events per
|
78 | * span
|
79 | */
|
80 | numberOfAnnontationEventsPerSpan?: number;
|
81 | /** numberOfMessageEventsPerSpan is number of message events per span */
|
82 | numberOfMessageEventsPerSpan?: number;
|
83 | /** numberOfAttributesPerSpan is number of attributes per span */
|
84 | numberOfAttributesPerSpan?: number;
|
85 | /** numberOfLinksPerSpan is number of links per span */
|
86 | numberOfLinksPerSpan?: number;
|
87 | }
|
88 | export declare type Config = TracingConfig & TracerConfig & BufferConfig;
|