Skip to content

Commit

Permalink
remove shutdown in the api provider interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Hui Kang committed Oct 21, 2020
1 parent 1e29106 commit ba3d6d7
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 34 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- OTLP Metric exporter supports Histogram aggregation. (#1209)
- The `Code` struct from the `go.opentelemetry.io/otel/codes` package now supports JSON marshaling and unmarshaling as well as implements the `Stringer` interface. (#1214)
- A Baggage API to implement the OpenTelemetry specification. (#1217)
- Add Shutdown method to apitrace.TracerProvider (#1206)
- Add Shutdown method to sdk/trace/provider, shutdown processors in the order they were registered. (#1206)

### Changed

Expand Down
3 changes: 0 additions & 3 deletions bridge/opentracing/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ func (p *WrapperTracerProvider) Tracer(_ string, _ ...otel.TracerOption) otel.Tr
return p.wTracer
}

// Shutdown implements TracerProvider
func (p *WrapperTracerProvider) Shutdown() {}

// NewWrappedTracerProvider creates a new trace provider that creates a single
// instance of WrapperTracer that wraps OpenTelemetry tracer.
func NewWrappedTracerProvider(bridge *BridgeTracer, tracer otel.Tracer) *WrapperTracerProvider {
Expand Down
7 changes: 1 addition & 6 deletions global/internal/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,7 @@ func (p *tracerProvider) Tracer(name string, opts ...otel.TracerOption) otel.Tra
return t
}

// Shutdown implements TracerProvider.
func (p *tracerProvider) Shutdown() {
p.delegate.Shutdown()
}

// tracer is a placeholder for a trace.Tracer.
// tracer is a placeholder for a otel.Tracer.
//
// All Tracer functionality is forwarded to a delegate once configured.
// Otherwise, all functionality is forwarded to a NoopTracer.
Expand Down
1 change: 0 additions & 1 deletion global/internal/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func TestTraceWithSDK(t *testing.T) {

ctx := context.Background()
gtp := global.TracerProvider()
defer gtp.Shutdown()
tracer1 := gtp.Tracer("pre")
// This is started before an SDK was registered and should be dropped.
_, span1 := tracer1.Start(ctx, "span1")
Expand Down
18 changes: 3 additions & 15 deletions global/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,24 @@ import (
"go.opentelemetry.io/otel/internal/trace/noop"
)

type testTracerProvider struct {
running bool
}
type testTracerProvider struct{}

var _ otel.TracerProvider = &testTracerProvider{}

func (*testTracerProvider) Tracer(_ string, _ ...otel.TracerOption) otel.Tracer {
return noop.Tracer
}

func (tp *testTracerProvider) Shutdown() {
tp.running = false
}

func TestMultipleGlobalTracerProvider(t *testing.T) {
p1 := testTracerProvider{}
p2 := otel.NewNoopTracerProvider()

global.SetTracerProvider(p2)
global.SetTracerProvider(&p1)
global.SetTracerProvider(p2)

got := global.TracerProvider()
p1.running = true

want := &p1
want := p2
if got != want {
t.Fatalf("TracerProvider: got %p, want %p\n", got, want)
}
got.Shutdown()
if p1.running {
t.Fatalf("Trace should be shutdown")
}
}
2 changes: 0 additions & 2 deletions oteltest/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,3 @@ func (p *TracerProvider) Tracer(instName string, opts ...otel.TracerOption) otel
}
return t
}

func (p *TracerProvider) Shutdown() {}
3 changes: 0 additions & 3 deletions trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,4 @@ type TracerProvider interface {
// instrumentationName is empty, then a implementation defined default
// name will be used instead.
Tracer(instrumentationName string, opts ...TracerOption) Tracer

// Shutdown closes the provider's resources such as the span processors.
Shutdown()
}
3 changes: 0 additions & 3 deletions trace_noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ func (p noopTracerProvider) Tracer(string, ...TracerOption) Tracer {
return noopTracer{}
}

// Shutdown returns noop implementation of Tracer.
func (p noopTracerProvider) Shutdown() {}

// noopTracer is an implementation of Tracer that preforms no operations.
type noopTracer struct{}

Expand Down

0 comments on commit ba3d6d7

Please sign in to comment.