Created
February 24, 2022 14:48
-
-
Save TonPC64/60254ad37360992e506f40f12b8cc338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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