All spans of a trace share sampling state#377
All spans of a trace share sampling state#377yurishkuro merged 33 commits intojaegertracing:masterfrom yurishkuro:shared-sampling-state
Conversation
Signed-off-by: Joe Farro <[email protected]>
Signed-off-by: Joe Farro <[email protected]>
Signed-off-by: Joe Farro <[email protected]>
Signed-off-by: Joe Farro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #377 +/- ##
==========================================
- Coverage 99.01% 98.54% -0.47%
==========================================
Files 44 48 +4
Lines 1721 1853 +132
Branches 337 352 +15
==========================================
+ Hits 1704 1826 +122
- Misses 17 27 +10
Continue to review full report at Codecov.
|
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
| "test": "make test", | ||
| "test-dist": "mocha dist/test/ dist/test/baggage/ dist/test/throttler/ dist/test/samplers/ dist/test/metrics/", | ||
| "test-all": "npm run test-core && npm run test-samplers && npm run test-crossdock && npm run test-baggage && npm run test-throttler && npm run test-prom-metrics", | ||
| "test-all": "npm run test-core && npm run test-samplers && npm run test-baggage && npm run test-throttler && npm run test-prom-metrics && npm run test-crossdock", |
There was a problem hiding this comment.
moved crossdock test in the last position
|
|
||
| if (options.logger) { | ||
| options.logger.info(`Initializing Jaeger Tracer with ${reporter.name()} and ${sampler.name()}`); | ||
| options.logger.info(`Initializing Jaeger Tracer with ${reporter} and ${sampler}`); |
There was a problem hiding this comment.
don't need to rely on name() function, toString should work.
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
vprithvi
left a comment
There was a problem hiding this comment.
Need to go through again
| "args": ["--timeout", "999999", "--compilers", "js:babel-core/register", "--colors", "${file}"], | ||
| "console": "integratedTerminal", | ||
| "internalConsoleOptions": "neverOpen", | ||
| // "runtimeVersion": "10", |
There was a problem hiding this comment.
I think it's fine, actually. It's not a real JSON file. If you open VSCode settings as JSON, it has other comments, like
// Place your settings in this file to overwrite the default settings
| /** | ||
| * Sampler methods return SamplingDecision struct. | ||
| */ | ||
| declare type SamplingDecision = { |
There was a problem hiding this comment.
Perhaps we should call this SamplingResult because it contains information in addition to the decision (0/1) ?
There was a problem hiding this comment.
I think "decision" is a more accurate term. It does not mean that it's a primitive yes/no value (cf. Supreme Court decision - lots of additional details), yet it's a decision that is not yet implemented, whereas "result" would be the consequence of implementing that decision.
| } | ||
|
|
||
| onSetTag(span: Span, key: string, value: any): SamplingDecision { | ||
| return { sample: false, retryable: true, tags: null }; |
There was a problem hiding this comment.
I think a comment with some reasoning would be useful when we look at this later
There was a problem hiding this comment.
I have them in the class comment.
|
|
||
| let _instanceId = 0; | ||
|
|
||
| export default class BaseSamplerV2 implements Sampler { |
There was a problem hiding this comment.
What does this do (Is it vestigial) ?
I see an import on https://github.com/jaegertracing/jaeger-client-node/pull/377/files#diff-3ac550bfade28896bbd1273d1a26b74dR16
There was a problem hiding this comment.
at this point it's not used, until we resolve the babel issue with inheritance. I could remove it, it will still be in the PR history.
There was a problem hiding this comment.
I think we should remove it if we are not using it
| _final: boolean = false; | ||
|
|
||
| // Span ID of the local root span, i.e. the first span in this process for this trace. | ||
| _localRootSpanIdStr: ?string; |
There was a problem hiding this comment.
Should we rename this to firstInProcessSpanIdStr? (go client has a var called firstInProcess...)
There was a problem hiding this comment.
I think 'local root' is a good name, and I've seen it used in other places (zipkin, OC).
| * | ||
| * This field exists to help distinguish between when a span can have a properly | ||
| * correlated operation name -> sampling rate mapping, and when it cannot. | ||
| * Adaptive sampling uses the operation name of a span to correlate it with |
There was a problem hiding this comment.
Should the part about adaptive sampling live elsewhere?
There was a problem hiding this comment.
it will, remember this is a change that aims to keep status quo.
| * then adaptive sampling cannot associate the operation name with the proper sampling rate. | ||
| * In order to correct this we allow a span to be written to, so that we can re-sample | ||
| * it in the case that an operation name is set after span creation. Situations | ||
| * where a span context's sampling decision is finalized include: |
There was a problem hiding this comment.
Are all of these situations still accurate?
| const _childId = idIsStr ? null : childId; | ||
| const _childIdStr = idIsStr ? childId : null; | ||
| return new SpanContext( | ||
| this._traceId, // traceId |
There was a problem hiding this comment.
What is the purpose of these comments?
There was a problem hiding this comment.
I find it hard to read without them, especially then values don't match the argument meaning, as in this._spanId, // parentId
There was a problem hiding this comment.
Perhaps we should improve this constructor (in a different diff?)
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
|
|
||
| ctx.traceId = randomId; | ||
| ctx.spanId = randomId; | ||
| ctx.parentId = null; |
There was a problem hiding this comment.
We have a test in the adaptor that explicitly checks that parentId is null (as opposed to undefined) for a newly created span - do you think this behavior is expected and relied upon elsewhere else?
There was a problem hiding this comment.
we should restore it, probably assign null explicitly in the constructor
Replaces #372
Part of solution for #379