-
Notifications
You must be signed in to change notification settings - Fork 131
All spans of a trace share sampling state #377
All spans of a trace share sampling state #377
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]>
@@ -68,7 +68,7 @@ | |||
"precommit": "lint-staged", | |||
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved crossdock test in the last position
@@ -224,7 +224,7 @@ export default class Configuration { | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]>
6b080a9
to
2e1cfd5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: invalid JSON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should call this SamplingResult
because it contains information in addition to the decision (0/1) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a comment with some reasoning would be useful when we look at this later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have them in the class comment.
|
||
let _instanceId = 0; | ||
|
||
export default class BaseSamplerV2 implements Sampler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename this to firstInProcessSpanIdStr
? (go client has a var called firstInProcess...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the part about adaptive sampling live elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all of these situations still accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as of this diff, yes
const _childId = idIsStr ? null : childId; | ||
const _childIdStr = idIsStr ? childId : null; | ||
return new SpanContext( | ||
this._traceId, // traceId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of these comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should restore it, probably assign null explicitly in the constructor
Replaces #372
Part of solution for #379