diff --git a/examples/memstore-plugin/main.go b/examples/memstore-plugin/main.go index 12b519693a4..36a9b31bb07 100644 --- a/examples/memstore-plugin/main.go +++ b/examples/memstore-plugin/main.go @@ -15,16 +15,18 @@ package main import ( + "context" "flag" + "fmt" "strings" - "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" "github.com/hashicorp/go-plugin" - "github.com/opentracing/opentracing-go" "github.com/spf13/viper" - jaegerClientConfig "github.com/uber/jaeger-client-go/config" + "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + "go.opentelemetry.io/otel" googleGRPC "google.golang.org/grpc" + "github.com/jaegertracing/jaeger/pkg/jtracer" "github.com/jaegertracing/jaeger/plugin/storage/grpc" grpcMemory "github.com/jaegertracing/jaeger/plugin/storage/grpc/memory" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" @@ -55,21 +57,12 @@ func main() { opts := memory.Options{} opts.InitFromViper(v) - traceCfg := &jaegerClientConfig.Configuration{ - ServiceName: serviceName, - Sampler: &jaegerClientConfig.SamplerConfig{ - Type: "const", - Param: 1.0, - }, - RPCMetrics: true, - } - - tracer, closer, err := traceCfg.NewTracer() + tracer, err := jtracer.New(serviceName) if err != nil { - panic("Failed to initialize tracer") + panic(fmt.Errorf("failed to initialize tracer: %w", err)) } - defer closer.Close() - opentracing.SetGlobalTracer(tracer) + defer tracer.Close(context.Background()) + otel.SetTracerProvider(tracer.OTEL) memStorePlugin := grpcMemory.NewStoragePlugin(memory.NewStore(), memory.NewStore()) service := &shared.PluginServices{ @@ -81,8 +74,8 @@ func main() { } grpc.ServeWithGRPCServer(service, func(options []googleGRPC.ServerOption) *googleGRPC.Server { return plugin.DefaultGRPCServer([]googleGRPC.ServerOption{ - googleGRPC.UnaryInterceptor(otgrpc.OpenTracingServerInterceptor(tracer)), - googleGRPC.StreamInterceptor(otgrpc.OpenTracingStreamServerInterceptor(tracer)), + googleGRPC.UnaryInterceptor(otelgrpc.UnaryServerInterceptor(otelgrpc.WithTracerProvider(tracer.OTEL))), + googleGRPC.StreamInterceptor(otelgrpc.StreamServerInterceptor(otelgrpc.WithTracerProvider(tracer.OTEL))), }) }) }