Skip to content

Instantly share code, notes, and snippets.

@TonPC64
Created February 24, 2022 14:48
Show Gist options
  • Save TonPC64/60254ad37360992e506f40f12b8cc338 to your computer and use it in GitHub Desktop.
Save TonPC64/60254ad37360992e506f40f12b8cc338 to your computer and use it in GitHub Desktop.
var grpcClient api.HelloServiceClient
func main() {
var conn *grpc.ClientConn
conn, err := grpc.Dial("host.docker.internal:6565", grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()),
grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor()),
)
if err != nil {
log.Fatalf("did not connect: %s", err)
}
defer func() { _ = conn.Close() }()
grpcClient = api.NewHelloServiceClient(conn)
e := echo.New()
e.Use(otelecho.Middleware("webserver-echo"))
e.GET("/", handler)
e.Logger.Fatal(e.Start(":" + os.Getenv("PORT")))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment