Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename GetTracerProvider to TracerProvider in sdk package #1231

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http

## [Unreleased]

### Changed

- 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

- Sporadic shutdown deadlock. ([#1220](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1220))
Expand Down
2 changes: 1 addition & 1 deletion internal/test/e2e/autosdk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func main() {
// give time for auto-instrumentation to start up
time.Sleep(5 * time.Second)

provider := sdk.GetTracerProvider()
provider := sdk.TracerProvider()
tracer := provider.Tracer(
pkgName,
trace.WithInstrumentationVersion(pkgVer),
Expand Down
4 changes: 2 additions & 2 deletions sdk/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package sdk

import "context"

func ExampleGetTracerProvider() {
func ExampleTracerProvider() {
// Get a Tracer from an auto-instrumented TracerProvider so all spans
// created will be passed to the auto-instrumentation telemetry pipeline.
tracer := GetTracerProvider().Tracer("my.pkg/name")
tracer := TracerProvider().Tracer("my.pkg/name")

// The tracer is used normally to create spans to encapsulate work.
_, span := tracer.Start(context.Background(), "do.work")
Expand Down
6 changes: 3 additions & 3 deletions sdk/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import (
"go.opentelemetry.io/auto/sdk/telemetry"
)

// GetTracerProvider returns an auto-instrumentable [trace.TracerProvider].
// TracerProvider returns an auto-instrumentable [trace.TracerProvider].
//
// If an [go.opentelemetry.io/auto.Instrumentation] is configured to instrument
// the process using the returned TracerProvider, all of the telemetry it
// produces will be processed and handled by that Instrumentation. By default,
// if no Instrumentation instruments the TracerProvider it will not generate
// any trace telemetry.
func GetTracerProvider() trace.TracerProvider { return tracerProviderInstance }
func TracerProvider() trace.TracerProvider { return tracerProviderInstance }

var tracerProviderInstance = tracerProvider{}

Expand Down Expand Up @@ -383,4 +383,4 @@ func (s *span) SetName(name string) {
s.span.Name = name
}

func (*span) TracerProvider() trace.TracerProvider { return GetTracerProvider() }
func (*span) TracerProvider() trace.TracerProvider { return TracerProvider() }
2 changes: 1 addition & 1 deletion sdk/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestSpanCreation(t *testing.T) {

ts := time.Now()

tracer := GetTracerProvider().Tracer(
tracer := TracerProvider().Tracer(
tracerName,
trace.WithInstrumentationVersion(tracerVer),
trace.WithSchemaURL(semconv.SchemaURL),
Expand Down
Loading