This repository was archived by the owner on Oct 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
opencensus-web-core/src/trace/model Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 1515 */
1616
1717import { Stats } from '../../stats/types' ;
18- import { TracerBase } from '../model/types' ;
18+ import { Span , TracerBase } from '../model/types' ;
1919
2020/** Interface Plugin to apply patch. */
2121export 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+
4453export interface PluginConfig {
4554 // tslint:disable-next-line:no-any
4655 [ key : string ] : any ;
56+ applyCustomAttributesOnSpan ?: CustomAttributeFunction ;
4757}
4858
4959export interface NamedPluginConfig {
Original file line number Diff line number Diff line change @@ -260,8 +260,9 @@ export interface SpanContext {
260260
261261/** Defines an end span event listener */
262262export 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 */
You can’t perform that action at this time.
0 commit comments