feat: add rootSpan.createChildSpan and change none CLS semantics#731
feat: add rootSpan.createChildSpan and change none CLS semantics#731kjin merged 5 commits intogoogleapis:masterfrom
Conversation
2fdd4cc to
9d00124
Compare
Codecov Report
@@ Coverage Diff @@
## master #731 +/- ##
==========================================
- Coverage 90.92% 90.88% -0.05%
==========================================
Files 30 30
Lines 1564 1568 +4
Branches 302 304 +2
==========================================
+ Hits 1422 1425 +3
Misses 59 59
- Partials 83 84 +1
Continue to review full report at Codecov.
|
c3add20 to
c3bd690
Compare
|
/cc @tjmehta |
|
Wow you are fast @kjin! I am out of town and will check this out tomorrow |
| cwd: installDir | ||
| }); | ||
| await spawnP('npm', ['install', 'typescript', '@types/node', tgz[0]], { | ||
| await spawnP('npm', ['install', 'typescript', '@types/node@9', tgz[0]], { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| enable(): void { | ||
| if (!this.enabled) { | ||
| // if this.CLSClass = DefaultCLS, the user specifically asked not to use |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| import {Constants, SpanDataType} from './constants'; | ||
| import {SpanData as SpanData} from './plugin-types'; | ||
| import * as types from './plugin-types'; | ||
| import {SpanData, SpanOptions} from './plugin-types'; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| createChildSpan(options: SpanOptions): SpanData { | ||
| options = options || {name: ''}; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| enable(): void { | ||
| if (!this.enabled) { | ||
| // if this.CLSClass = NoneCLS, the user specifically asked not to use |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| import {Constants, SpanDataType} from './constants'; | ||
| import {SpanData as SpanData} from './plugin-types'; | ||
| import * as types from './plugin-types'; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Fixes #719
This PR does two things:
config.clsMechanismoption was added where, when set to'none', a barebones CLS mechanism would be used where when a root span was started, it became the only possible active root span context until it was ended. This PR changes this so that root span context will never be written whenclsMechanismis set to'none'. Instead, the root span context always has a default value ofUNTRACED. This affects the behavior of the custom tracing API in the following ways:traceApi.runInRootSpanwill always return a root span (unless disallowed by the trace policy), even if run within a function passed to another call torunInRootSpan.traceApi.createChildSpanwill always return anUNTRACEDchild span. This is because root spans can no longer be automatically determined from the root context.rootSpan.createChildSpanwhich takes the same options astraceApi.createChildSpan. WhenclsMechanismis set to'none', the latter will not work, but the former will; whenclsMechanismis set to/defaults to'auto', they should behave the same way.