Skip to content

Commit

Permalink
Remove unnecessary internal package for noop instances (open-telemetr…
Browse files Browse the repository at this point in the history
…y#2867)

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
  • Loading branch information
bogdandrutu and MrAlias authored Apr 28, 2022
1 parent a50cf6a commit a14ecc7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 40 deletions.
13 changes: 10 additions & 3 deletions bridge/opentracing/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ import (
"go.opentelemetry.io/otel/bridge/opentracing/migration"
"go.opentelemetry.io/otel/codes"
iBaggage "go.opentelemetry.io/otel/internal/baggage"
"go.opentelemetry.io/otel/internal/trace/noop"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/trace"
)

var (
noopTracer = trace.NewNoopTracerProvider().Tracer("")
noopSpan = func() trace.Span {
_, s := noopTracer.Start(context.Background(), "")
return s
}()
)

type bridgeSpanContext struct {
bag baggage.Baggage
otelSpanContext trace.SpanContext
Expand Down Expand Up @@ -321,7 +328,7 @@ var _ ot.TracerContextWithSpanExtension = &BridgeTracer{}
func NewBridgeTracer() *BridgeTracer {
return &BridgeTracer{
setTracer: bridgeSetTracer{
otelTracer: noop.Tracer,
otelTracer: noopTracer,
},
warningHandler: func(msg string) {},
propagator: nil,
Expand Down Expand Up @@ -641,7 +648,7 @@ func (t *BridgeTracer) Inject(sm ot.SpanContext, format interface{}, carrier int
}
header := http.Header(hhcarrier)
fs := fakeSpan{
Span: noop.Span,
Span: noopSpan,
sc: bridgeSC.otelSpanContext,
}
ctx := trace.ContextWithSpan(context.Background(), fs)
Expand Down
35 changes: 0 additions & 35 deletions internal/trace/noop/noop.go

This file was deleted.

3 changes: 1 addition & 2 deletions trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

"github.com/stretchr/testify/assert"

"go.opentelemetry.io/otel/internal/trace/noop"
"go.opentelemetry.io/otel/trace"
)

Expand All @@ -28,7 +27,7 @@ type testTracerProvider struct{}
var _ trace.TracerProvider = &testTracerProvider{}

func (*testTracerProvider) Tracer(_ string, _ ...trace.TracerOption) trace.Tracer {
return noop.Tracer
return trace.NewNoopTracerProvider().Tracer("")
}

func TestMultipleGlobalTracerProvider(t *testing.T) {
Expand Down

0 comments on commit a14ecc7

Please sign in to comment.