Skip to content

Commit

Permalink
Embed noop into sdk instead of embedded (#1230)
Browse files Browse the repository at this point in the history
* Embed noop into sdk instead of embedded

Default to NoOp behavior when the `sdk` pkg does not implement a method
of the Go OTel API instead of causing a compilation error.

Resolve #1228

* Add a changelog entry
  • Loading branch information
MrAlias authored Oct 30, 2024
1 parent 07826ab commit 77e8de9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http

### Changed

- The SDK provided in `go.opentelemtry.io/auto/sdk` now defaults to NoOp behavior for unimplemented methods of the OpenTelemetry API.
This is changed from causing a compilation error for unimplemented methods. ([#1230](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1230))
- The `GetTracerProvider` fucntion in `go.opentelemtry.io/auto/sdk` is renamed to `TracerProvider`. ([#1231](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1231))

### Fixed
Expand Down
8 changes: 4 additions & 4 deletions sdk/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"go.opentelemetry.io/otel/codes"
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/embedded"
"go.opentelemetry.io/otel/trace/noop"

"go.opentelemetry.io/auto/sdk/telemetry"
)
Expand All @@ -31,7 +31,7 @@ func TracerProvider() trace.TracerProvider { return tracerProviderInstance }

var tracerProviderInstance = tracerProvider{}

type tracerProvider struct{ embedded.TracerProvider }
type tracerProvider struct{ noop.TracerProvider }

var _ trace.TracerProvider = tracerProvider{}

Expand All @@ -45,7 +45,7 @@ func (p tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tr
}

type tracer struct {
embedded.Tracer
noop.Tracer

name, schemaURL, version string
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func spanKind(kind trace.SpanKind) telemetry.SpanKind {
}

type span struct {
embedded.Span
noop.Span

sampled bool
spanContext trace.SpanContext
Expand Down

0 comments on commit 77e8de9

Please sign in to comment.