-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Refactor Tracestate #1931
Refactor Tracestate #1931
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1931 +/- ##
=====================================
Coverage 79.5% 79.5%
=====================================
Files 139 141 +2
Lines 7463 7464 +1
=====================================
+ Hits 5937 5941 +4
+ Misses 1278 1275 -3
Partials 248 248
|
d5d7bee
to
18e1074
Compare
f399c4a
to
1adb124
Compare
One thing I considered when making these changes, and am still not sure if it would make this better, is to move the trace state stuff into it's own package. I would rename the The issues I was not able to resolve for this approach were:
|
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.
Overall looks good.
I don't see a good reason to move it right now, but if I were to move it I would consider either trace/tracestate
, or metadata/tracestate
. The former because it is solely a concern of traces, the latter because it could be a very convenient place to put all of the metadata's we are working with: tracestate, baggage, and attributes come to mind.
Remove circularity of TestTraceStateLen.
The main purpose of these changes is to restructure the
TraceState
type around a list ofstring
s. The methods have all been updated to accept key/value values asstring
instead ofattribute.KeyValue
.TraceStateFromKeyValues
from thetrace
API to theoteltest
package.TraceState.MarshalJSON
to return the tracestate string.trace
package.TraceState
type and associated code to its own file.ParseTraceState
function that attempts to decode a TraceState from a passed stringTraceState.Delete
method to not return an error. The only time it would return an error is when the user passed an invalid key. Now it "handles" this error by not deleting the member associated with the invalid key (something that can never be in aTraceState
) and just returns a copy of theTraceState
.TraceState.IsEmpty
method in favor of the addedTraceState.Len
method. This new method has a more diverse use and solves the same use case the original did.Part of #1539