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

Sync @opencensus/web-types to v0.0.13 #84

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/opencensus-web-core/src/trace/model/tracer-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,9 @@ export class TracerBase implements webTypes.TracerBase {
}
return span;
}

/** Sets the current root span. */
setCurrentRootSpan(root: webTypes.Span) {
// no-op, this is only required in case of tracer with cls.
}
}
2 changes: 1 addition & 1 deletion packages/opencensus-web-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "npm run compile",
"clean": "rimraf build/*",
"copytypes": "node scripts/copy-types.js '4a6c3f1ea487ba759e3a90dca69e733bbda8887a' && npm run fix",
"copytypes": "node scripts/copy-types.js 'v0.0.13' && npm run fix",
"check": "gts check",
"compile": "tsc -p .",
"fix": "gts fix",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { Stats } from '../../stats/types';
import { TracerBase } from '../model/types';
import { Span, TracerBase } from '../model/types';

/** Interface Plugin to apply patch. */
export interface Plugin {
Expand All @@ -41,9 +41,19 @@ export interface Plugin {
disable(): void;
}

/**
* Function that can be provided to plugin in order to add custom
* attributes to spans
*/
export interface CustomAttributeFunction {
// tslint:disable-next-line:no-any
(span: Span, ...rest: any[]): void;
}

export interface PluginConfig {
// tslint:disable-next-line:no-any
[key: string]: any;
applyCustomAttributesOnSpan?: CustomAttributeFunction;
}

export interface NamedPluginConfig {
Expand Down
6 changes: 5 additions & 1 deletion packages/opencensus-web-types/src/trace/model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ export interface SpanContext {

/** Defines an end span event listener */
export interface SpanEventListener {
/** Happens when a span is ended */
/** Happens when a span is started */
onStartSpan(span: Span): void;
/** Happens when a span is ended */
onEndSpan(span: Span): void;
}

Expand Down Expand Up @@ -528,6 +529,9 @@ export interface TracerBase extends SpanEventListener {
* @returns The new Span instance started
*/
startChildSpan(options?: SpanOptions): Span;

/** Sets the current root span. */
setCurrentRootSpan(root: Span): void;
}

/** Interface for Tracer */
Expand Down