Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 3f40493

Browse files
Pull in @opencensus/core types using copytypes npm script (#27)
1 parent 7271b94 commit 3f40493

14 files changed

Lines changed: 1650 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Copyright 2019, 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+
17+
// tslint:disable:no-any
18+
export type LogFunction = (message: any, ...args: any[]) => void;
19+
20+
/** Defines an logger interface. */
21+
export interface Logger {
22+
/** Logger verbosity level. If omitted, `debug` level is assumed. */
23+
level?: string;
24+
25+
error: LogFunction;
26+
warn: LogFunction;
27+
info: LogFunction;
28+
debug: LogFunction;
29+
}
30+
31+
/** Defines an logger options interface. */
32+
export interface LoggerOptions {
33+
level?: string;
34+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Copyright 2019, 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+
17+
import {Measurement, View} from '../stats/types';
18+
import {TagKey, TagValue} from '../tags/types';
19+
import * as configTypes from '../trace/config/types';
20+
import * as modelTypes from '../trace/model/types';
21+
22+
/** Defines a trace exporter interface. */
23+
export interface Exporter extends modelTypes.SpanEventListener {
24+
/**
25+
* Sends a list of root spans to the service.
26+
* @param rootSpans A list of root spans to publish.
27+
*/
28+
publish(rootSpans: modelTypes.RootSpan[]): Promise<number|string|void>;
29+
}
30+
31+
/**
32+
* An interface that describes the possible events that will be emitted from a
33+
* Stats instance. Stats exporters should implement this interface.
34+
*/
35+
export interface StatsEventListener {
36+
/**
37+
* Is called whenever a new view is registered
38+
* @deprecated since version 0.0.9 - use {@link start} instead
39+
* @param view The registered view
40+
*/
41+
onRegisterView(view: View): void;
42+
/**
43+
* Is called whenever a new measurement is recorded.
44+
* @deprecated since version 0.0.9 - use {@link start} instead
45+
* @param views The views related to the measurement
46+
* @param measurement The recorded measurement
47+
*/
48+
onRecord(
49+
views: View[], measurement: Measurement,
50+
tags: Map<TagKey, TagValue>): void;
51+
52+
/**
53+
* Starts the exporter that polls Metric from Metrics library and send
54+
* batched data to backend.
55+
*/
56+
start(): void;
57+
}
58+
59+
export type ExporterConfig = configTypes.BufferConfig;

packages/opencensus-web-types/src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,13 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
export * from './common/types';
18+
export * from './exporters/types';
19+
export * from './node/types';
20+
export * from './trace/config/types';
21+
export * from './trace/instrumentation/types';
22+
export * from './trace/model/types';
23+
export * from './trace/propagation/types';
24+
export * from './trace/sampler/types';
25+
export * from './trace/types';

0 commit comments

Comments
 (0)