Skip to content

Instantly share code, notes, and snippets.

@TonPC64
Created February 24, 2022 14:46
Show Gist options
  • Save TonPC64/83eb7a97b85f8ec9ed60fa7d27c0fe2d to your computer and use it in GitHub Desktop.
Save TonPC64/83eb7a97b85f8ec9ed60fa7d27c0fe2d to your computer and use it in GitHub Desktop.
func (s *server) SayHello(ctx context.Context, in *api.HelloRequest) (*api.HelloResponse, error) {
tracer := otel.GetTracerProvider().Tracer("webserver-grpc")
_, span := tracer.Start(ctx, "SayHello-span")
defer span.End()
fmt.Println(ctx)
log.Printf("Received: %v\n", in.GetGreeting())
time.Sleep(50 * time.Millisecond)
return &api.HelloResponse{Reply: "Hello " + in.Greeting}, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment