-
Notifications
You must be signed in to change notification settings - Fork 421
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
tracer: Refactor span context's TraceID to be a full [16]byte #1822
Conversation
I verified the failing parametric test is also failing for shared/128 branch so is unrelated to this refactor (and seems like a known bug in W3C textmap parsing?) |
context.trace = parent.trace | ||
context.origin = parent.origin | ||
context.errors = parent.errors | ||
parent.ForeachBaggageItem(func(k, v string) bool { | ||
context.setBaggageItem(k, v) | ||
return true | ||
}) | ||
} else if sharedinternal.BoolEnv("DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED", false) { |
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 happens in tracer.go StartSpan
now
Co-authored-by: Katie Hockman <katie@hockman.dev>
… handle odd length strings
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.
🥇
* WIP: more refactoring, still broken tests though * Even more bug fixes * Update ddtrace/tracer/spancontext.go * PR Comments: use strconv.ParseUint instead of hex.Decode since it can handle odd length strings Co-authored-by: Katie Hockman <katie@hockman.dev>
* WIP: more refactoring, still broken tests though * Even more bug fixes * Update ddtrace/tracer/spancontext.go * PR Comments: use strconv.ParseUint instead of hex.Decode since it can handle odd length strings Co-authored-by: Katie Hockman <katie@hockman.dev>
What does this PR do?
Refactor the spancontext
traceID
to be a[16]byte
instead of auint64
. This is a marginal memory gain over storing the upper bits as a hex string at a slight cost of possibly needing to hex-encode more frequently.Motivation
It's confusing to have the trace id split up across fields and as different types, it led to odd looking code occasionally where some bits of the ID would need to be encoded or decoded for the use-case at hand. I believe this refactor is an improvement in readability, although admittedly this code is still a bit confusing. Notably
newContext
as thespan
type can't be changed as it's exactly marshalled to the agent in its current form.Describe how to test/QA your changes
The unit tests, system tests, parametric tests should sufficiently cover this refactor I believe, but given this touches a critical component of the tracer we may want to be extra diligent during release testing to ensure there's no breakages here.
Reviewer's Checklist
Triage
milestone is set.