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

Commit 67ccdad

Browse files
crdgonzalezcadraffensperger
authored andcommitted
Sync @opencensus/web-types to v0.0.13 (#84)
1 parent 0c6ad7f commit 67ccdad

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

packages/opencensus-web-core/src/trace/model/tracer-base.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,9 @@ export class TracerBase implements webTypes.TracerBase {
133133
}
134134
return span;
135135
}
136+
137+
/** Sets the current root span. */
138+
setCurrentRootSpan(root: webTypes.Span) {
139+
// no-op, this is only required in case of tracer with cls.
140+
}
136141
}

packages/opencensus-web-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"build": "npm run compile",
99
"clean": "rimraf build/*",
10-
"copytypes": "node scripts/copy-types.js '4a6c3f1ea487ba759e3a90dca69e733bbda8887a' && npm run fix",
10+
"copytypes": "node scripts/copy-types.js 'v0.0.13' && npm run fix",
1111
"check": "gts check",
1212
"compile": "tsc -p .",
1313
"fix": "gts fix",

packages/opencensus-web-types/src/trace/instrumentation/types.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { Stats } from '../../stats/types';
18-
import { TracerBase } from '../model/types';
18+
import { Span, TracerBase } from '../model/types';
1919

2020
/** Interface Plugin to apply patch. */
2121
export interface Plugin {
@@ -41,9 +41,19 @@ export interface Plugin {
4141
disable(): void;
4242
}
4343

44+
/**
45+
* Function that can be provided to plugin in order to add custom
46+
* attributes to spans
47+
*/
48+
export interface CustomAttributeFunction {
49+
// tslint:disable-next-line:no-any
50+
(span: Span, ...rest: any[]): void;
51+
}
52+
4453
export interface PluginConfig {
4554
// tslint:disable-next-line:no-any
4655
[key: string]: any;
56+
applyCustomAttributesOnSpan?: CustomAttributeFunction;
4757
}
4858

4959
export interface NamedPluginConfig {

packages/opencensus-web-types/src/trace/model/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,9 @@ export interface SpanContext {
260260

261261
/** Defines an end span event listener */
262262
export interface SpanEventListener {
263-
/** Happens when a span is ended */
263+
/** Happens when a span is started */
264264
onStartSpan(span: Span): void;
265+
/** Happens when a span is ended */
265266
onEndSpan(span: Span): void;
266267
}
267268

@@ -528,6 +529,9 @@ export interface TracerBase extends SpanEventListener {
528529
* @returns The new Span instance started
529530
*/
530531
startChildSpan(options?: SpanOptions): Span;
532+
533+
/** Sets the current root span. */
534+
setCurrentRootSpan(root: Span): void;
531535
}
532536

533537
/** Interface for Tracer */

0 commit comments

Comments
 (0)