You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-29 23:07:45 +02:00
Make SpanContext Immutable (#1573)
* 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
This commit is contained in:
committed by
GitHub
parent
d75e268053
commit
e88a091a72
@@ -73,12 +73,12 @@ func (ts traceIDRatioSampler) ShouldSample(p SamplingParameters) SamplingResult
|
||||
if x < ts.traceIDUpperBound {
|
||||
return SamplingResult{
|
||||
Decision: RecordAndSample,
|
||||
Tracestate: p.ParentContext.TraceState,
|
||||
Tracestate: p.ParentContext.TraceState(),
|
||||
}
|
||||
}
|
||||
return SamplingResult{
|
||||
Decision: Drop,
|
||||
Tracestate: p.ParentContext.TraceState,
|
||||
Tracestate: p.ParentContext.TraceState(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ type alwaysOnSampler struct{}
|
||||
func (as alwaysOnSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
return SamplingResult{
|
||||
Decision: RecordAndSample,
|
||||
Tracestate: p.ParentContext.TraceState,
|
||||
Tracestate: p.ParentContext.TraceState(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ type alwaysOffSampler struct{}
|
||||
func (as alwaysOffSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
return SamplingResult{
|
||||
Decision: Drop,
|
||||
Tracestate: p.ParentContext.TraceState,
|
||||
Tracestate: p.ParentContext.TraceState(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user