diff --git a/example/trace/otlpgrpc/example.go b/example/trace/otlpgrpc/example.go index ff25211c2..3f1abc812 100644 --- a/example/trace/otlpgrpc/example.go +++ b/example/trace/otlpgrpc/example.go @@ -27,19 +27,14 @@ import ( semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/oauth" + "google.golang.org/grpc/credentials/google" ) func initTracer() (func(), error) { ctx := context.Background() - creds, err := oauth.NewApplicationDefault(ctx) - if err != nil { - panic(err) - } - - exporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithDialOption(grpc.WithPerRPCCredentials(creds))) + creds := google.NewDefaultCredentials() + exporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithTLSCredentials(creds.TransportCredentials())) if err != nil { panic(err) } diff --git a/example/trace/otlpgrpc/go.mod b/example/trace/otlpgrpc/go.mod index 96f9118ce..6520431a3 100644 --- a/example/trace/otlpgrpc/go.mod +++ b/example/trace/otlpgrpc/go.mod @@ -23,6 +23,7 @@ require ( go.opentelemetry.io/proto/otlp v1.1.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.15.0 // indirect + golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/example/trace/otlpgrpc/go.sum b/example/trace/otlpgrpc/go.sum index ea5cc2b13..26676e068 100644 --- a/example/trace/otlpgrpc/go.sum +++ b/example/trace/otlpgrpc/go.sum @@ -53,6 +53,8 @@ golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=