Skip to main content

Cloud Runner

Recommendation
Updated
Moved
USE
2021-10-12

What is it

Cloud Runner is a Go SDK for building services that are integrated out of the box with Google Cloud for logging, tracing, metrics and profiling.

When to use it

Use it when implementing a Go service that will run in Google Cloud.

Use the cloudrunner.Run function as the main entrypoint to your application, and use the cloudrunner.NewGRPCServer and cloudrunner.ListenGRPC helpers to get logging, tracing and metrics for your gRPC server.

package main

import (
"context"
"log"

"go.einride.tech/cloudrunner"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
)

func main() {
if err := cloudrunner.Run(func(ctx context.Context) error {
cloudrunner.Logger(ctx).Info("hello world")
grpcServer := cloudrunner.NewGRPCServer(ctx)
healthServer := health.NewServer()
grpc_health_v1.RegisterHealthServer(grpcServer, healthServer)
return cloudrunner.ListenGRPC(ctx, grpcServer)
}); err != nil {
log.Fatal(err)
}
}

See the README and GoDocs for more documentation.

How to learn it