()
| 42 | ) |
| 43 | |
| 44 | func main() { |
| 45 | // Turn on global telemetry for the whole binary. If a configuration is |
| 46 | // specified, any created gRPC Client Conn's or Servers will emit telemetry |
| 47 | // data according the configuration. |
| 48 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) |
| 49 | defer cancel() |
| 50 | err := observability.Start(ctx) |
| 51 | if err != nil { |
| 52 | log.Fatalf("observability.Start() failed: %v", err) |
| 53 | } |
| 54 | defer observability.End() |
| 55 | |
| 56 | flag.Parse() |
| 57 | // Set up a connection to the server. |
| 58 | conn, err := grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials())) |
| 59 | if err != nil { |
| 60 | log.Fatalf("did not connect: %v", err) |
| 61 | } |
| 62 | defer conn.Close() |
| 63 | c := pb.NewGreeterClient(conn) |
| 64 | |
| 65 | // Contact the server and print out its response. |
| 66 | r, err := c.SayHello(ctx, &pb.HelloRequest{Name: *name}) |
| 67 | if err != nil { |
| 68 | log.Fatalf("could not greet: %v", err) |
| 69 | } |
| 70 | log.Printf("Greeting: %s", r.GetMessage()) |
| 71 | } |
nothing calls this directly
no test coverage detected