@@ -13,24 +13,27 @@ import (
1313 "github.com/hypertrace/goagent/instrumentation/hypertrace"
1414 "github.com/hypertrace/goagent/instrumentation/hypertrace/google.golang.org/hypergrpc"
1515 "google.golang.org/grpc"
16+ "google.golang.org/grpc/credentials/insecure"
1617)
1718
1819const (
19- address = "localhost:50051 "
20+ address = "localhost:50151 "
2021 defaultName = "world"
2122)
2223
2324func main () {
2425 cfg := config .Load ()
2526 cfg .ServiceName = config .String ("grpc-client" )
27+ cfg .Reporting .Endpoint = config .String ("localhost:5442" )
28+ cfg .Reporting .TraceReporterType = config .TraceReporterType_OTLP
2629
2730 flusher := hypertrace .Init (cfg )
2831 defer flusher ()
2932
3033 // Set up a connection to the server.
3134 conn , err := grpc .Dial (
3235 address ,
33- grpc .WithInsecure ( ),
36+ grpc .WithTransportCredentials ( insecure . NewCredentials () ),
3437 grpc .WithBlock (),
3538 grpc .WithUnaryInterceptor (hypergrpc .UnaryClientInterceptor ()),
3639 )
@@ -45,12 +48,15 @@ func main() {
4548 if len (os .Args ) > 1 {
4649 name = os .Args [1 ]
4750 }
51+
4852 ctx , cancel := context .WithTimeout (context .Background (), time .Second )
4953 defer cancel ()
5054 r , err := client .SayHello (ctx , & pb.HelloRequest {Name : name })
5155 if err != nil {
52- log .Fatalf ("could not greet: %v" , err )
56+ log .Printf ("could not greet: %v" , err )
57+ } else {
58+ log .Printf ("Greeting: %v" , r .GetMessage ())
5359 }
54-
55- log . Printf ( "Greeting: %v" , r . GetMessage () )
60+ // some time to flush the spans
61+ time . Sleep ( 2000 * time . Millisecond )
5662}
0 commit comments