-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add if the trace was sampled to the ctxTags #184
Conversation
Codecov Report
@@ Coverage Diff @@
## master #184 +/- ##
==========================================
- Coverage 73.2% 73.09% -0.12%
==========================================
Files 36 36
Lines 1340 1349 +9
==========================================
+ Hits 981 986 +5
- Misses 310 314 +4
Partials 49 49
Continue to review full report at Codecov.
|
bf40426
to
438b3b1
Compare
@devnev ping |
tracing/opentracing/id_extract.go
Outdated
} | ||
|
||
if strings.Contains(key, "sampled") { | ||
t.Tags.Set(TagSampled, val) |
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.
How about enforcing that the val is either true
or false
, and ignoring it if it isn't?
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 could do that however both OpenZipkin and OpenTracing do strconv.FormatBool(sc.Sampled)
to set the value
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 I would prefer to pass thru what is in the sampled field from the OT implementation if it is not true/false it would be valuable to have this visualised.
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.
@devnev is this change blocking a merge?
tracing/opentracing/id_extract.go
Outdated
case "true", "false": | ||
t.Tags.Set(TagSampled, val) | ||
default: | ||
t.Tags.Set(TagSampled, "") |
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.
Why set to empty value instead of leaving unset?
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.
😂 this was what you suggested during our conversation ... have updated 👍
Currently we add traceId and spanId to the ctxTags ... which eventually end up on each log line if you are using the ctxTags for logging ... this ends up in a very annoying situation where we have a log line with a span / trace id but when you go hunting for the trace you can never find it.
A fix to this is to add the
trace.sampled
to the context as well so that we can then identify that the trace will not be in our tracing system.Previously for a sampled trace would have had :
Which will now be:
Previously for a trace that was not samped would have had :
Which will now be: