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

Commit

Permalink
refactor: reveiw TODO for clearCurrentTrace when using continuation-l…
Browse files Browse the repository at this point in the history
…ocal-storage
  • Loading branch information
silva-fabio authored and eduardoemery committed Jun 20, 2018
1 parent 81b6be8 commit ca13536
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/opencensus-core/src/internal/cls-ah.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AsyncHooksNamespace implements CLSNamespace {
}

get active(): Context {
throw new Error('Not implemented');
return current;
}

createContext(): Context {
Expand Down
6 changes: 4 additions & 2 deletions packages/opencensus-core/src/trace/model/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class Tracer implements types.Tracer {
constructor() {
this.activeLocal = false;
this.contextManager = cls.createNamespace();
this.clearCurrentTrace();
}

/** Gets the current root span. */
Expand All @@ -62,7 +63,9 @@ export class Tracer implements types.Tracer {

/** Sets the current root span. */
set currentRootSpan(root: types.RootSpan) {
this.contextManager.set('rootspan', root);
if (this.contextManager.active) {
this.contextManager.set('rootspan', root);
}
}

/** A propagation instance */
Expand Down Expand Up @@ -197,7 +200,6 @@ export class Tracer implements types.Tracer {
}
}

// TODO: reveiw clearCurrentTrace when using continuation-local-storage
/** Clears the current root span. */
clearCurrentTrace() {
this.currentRootSpan = null;
Expand Down

0 comments on commit ca13536

Please sign in to comment.