Skip to content

Commit

Permalink
[hotROD] Replace gRPC instrumentation with OTEL (jaegertracing#4558)
Browse files Browse the repository at this point in the history
Signed-off-by: Afzal Ansari <afzal442@gmail.com>
  • Loading branch information
afzal442 committed Jul 10, 2023
1 parent 372d0b7 commit 469d137
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions examples/hotrod/services/driver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import (
"context"
"net"

otgrpc "github.com/opentracing-contrib/go-grpc"
"github.com/opentracing/opentracing-go"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.uber.org/zap"
"google.golang.org/grpc"

Expand All @@ -32,7 +31,6 @@ import (
// Server implements jaeger-demo-frontend service
type Server struct {
hostPort string
tracer opentracing.Tracer
logger log.Factory
redis *Redis
server *grpc.Server
Expand All @@ -42,14 +40,13 @@ var _ DriverServiceServer = (*Server)(nil)

// NewServer creates a new driver.Server
func NewServer(hostPort string, otelExporter string, metricsFactory metrics.Factory, logger log.Factory) *Server {
tracer := tracing.Init("driver", otelExporter, metricsFactory, logger)
tracerProvider := tracing.InitOTEL("driver", otelExporter, metricsFactory, logger)
server := grpc.NewServer(
grpc.UnaryInterceptor(otgrpc.OpenTracingServerInterceptor(tracer)),
grpc.StreamInterceptor(otgrpc.OpenTracingStreamServerInterceptor(tracer)),
grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor(otelgrpc.WithTracerProvider(tracerProvider))),
grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor(otelgrpc.WithTracerProvider(tracerProvider))),
)
return &Server{
hostPort: hostPort,
tracer: tracer,
logger: logger,
server: server,
redis: newRedis(otelExporter, metricsFactory, logger),
Expand Down

0 comments on commit 469d137

Please sign in to comment.