1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-25 22:41:46 +02:00

Unify TracerProvider span processor lookups (#3942)

* Pre-allocate spanProcessorStates slice

* Make sync.Once a non-pointer

It doesn't need to be a pointer, can be part of the struct to avoid allocating a separate object for it

* getSpanProcessors() helper

* Add tests for UnregisterSpanProcessor()
This commit is contained in:
Mikhail Mazurskiy
2023-04-02 01:57:35 +11:00
committed by GitHub
parent 271df1dc01
commit 22fd10447d
5 changed files with 72 additions and 16 deletions

View File

@@ -62,11 +62,11 @@ type SpanProcessor interface {
type spanProcessorState struct {
sp SpanProcessor
state *sync.Once
state sync.Once
}
func newSpanProcessorState(sp SpanProcessor) *spanProcessorState {
return &spanProcessorState{sp: sp, state: &sync.Once{}}
return &spanProcessorState{sp: sp}
}
type spanProcessorStates []*spanProcessorState