@@ -37,8 +37,8 @@ import (
3737)
3838
3939var (
40- addr = flag .String ("addr " , ":50051" , "the server address to connect to" )
41- promAddr = flag .String ("promAddr " , ":9464" , "the Prometheus exporter endpoint" )
40+ addr = flag .String ("server_addr " , ":50051" , "the server address to connect to" )
41+ promAddr = flag .String ("prom_addr " , ":9464" , "the Prometheus exporter endpoint" )
4242)
4343
4444type echoServer struct {
@@ -55,26 +55,22 @@ func main() {
5555 if err != nil {
5656 log .Fatalf ("Failed to start prometheus exporter: %v" , err )
5757 }
58- provider := metric .NewMeterProvider (
59- metric .WithReader (exporter ),
60- )
58+ provider := metric .NewMeterProvider (metric .WithReader (exporter ))
6159 go http .ListenAndServe (* promAddr , promhttp .Handler ())
6260
6361 cleanup := csm .EnableObservability (context .Background (), opentelemetry.Options {MetricsOptions : opentelemetry.MetricsOptions {MeterProvider : provider }})
6462 defer cleanup ()
6563
6664 lis , err := net .Listen ("tcp" , * addr )
6765 if err != nil {
68- log .Fatalf ("failed to listen: %v" , err )
66+ log .Fatalf ("Failed to listen: %v" , err )
6967 }
7068 s := grpc .NewServer ()
71- pb .RegisterEchoServer (s , & echoServer {
72- addr : * addr ,
73- })
69+ pb .RegisterEchoServer (s , & echoServer {addr : * addr })
7470
75- log .Printf ("serving on %s\n " , * addr )
71+ log .Printf ("Serving on %s\n " , * addr )
7672
7773 if err := s .Serve (lis ); err != nil {
78- log .Fatalf ("failed to serve: %v" , err )
74+ log .Fatalf ("Failed to serve: %v" , err )
7975 }
8076}
0 commit comments