* Refactor TraceState
* Update tracecontext propagator to use new TraceState
* Add TraceStateFromKeyValues to oteltest
* Use oteltest to test TraceState
* Replace IsEmpty with Len for TraceState
* Replace ParseTraceState with ParseTraceStateString
* Clean up naming
* Add immutability test for TraceState
* Add changes to changelog
* Fixes
* Document argument type change in changelog
* Address feedback
Remove circularity of TestTraceStateLen.
* Store Span instead of local/remote SpanContext in Context
Now that the SpanContext has a remote identifier, storing a Span's
SpanContext two separate ways in a Context (one for local another for
remote) is unnecessary and adds complication throughout the project when
determining heredity of a Span. This moves to storing the Span directly
in the Context uniformly (for both local and remote) as current Span. In
the process, it updates the getter/setter functionality the `trace`
package provides and replaces the distributed heredity logic throughout
the project with just using the current Span as the parent if it exists.
* Update trace/context.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Assert propagators context remote state
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Add remote property to SpanContext
* Set SpanContext.remote when extracting context in TraceContext propagator
* Ensure remote flag is set when inserting remote SpanContext into context
* Ensure tests are expecting remote flag in SpanContext where appropriate
* Update CHANGELOG.md
* Apply PR feedback
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Make SpanContext Immutable
* Adds NewSpanContext() constructor and SpanContextConfig{} struct for
constructing a new SpanContext when all fields are known
* Adds With<field>() methods to SpanContext for deriving a SpanContext
with a single field changed.
* Updates all uses of SpanContext to use the new API
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update CHANGELOG.md
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Add tests for new SpanContext constructor and derivation
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Address PR feedback
* Fix new uses of SpanContext from main
* TraceContext propagator now handles `tracestate`.
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Prevent invalid tracestate from invalidating traceparent.
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Fail tests early if unable to construct expected TraceContext
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Add TraceState to API
* Add tests for TraceState
* Update related tests
- stdout exporter test
- SDK test
* Update OTLP span transform
* Update CHANGELOG
* Change TraceState to struct instead of pointer
- Adjust tests for trace API
- Adjust adjacent parts of codebase (test utils, SDK etc.)
* Add methods to assert equality
- for type SpanContext, if SpanID, TraceID, TraceFlag and TraceState are
equal
- for type TraceState, if entries of both respective trace states are
equal
Signed-off-by: Matej Gera <matejgera@gmail.com>
* Copy values for new TraceState, adjust tests
* Use IsEqualWith in remaining tests instead of assertion func
* Further feedback, minor improvements
- Move IsEqualWith method to be only in test package
- Minor improvements, typos etc.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>