Skip to content

Latest commit

 

History

History

chapter8

Chapter 8 - More essential features

This is based on the work done in chapter7 folder.

This folder shows other essential features (validating, tracing, rate limiting, ...) that can be added with protoc-gen-validate and go-grpc-middleware. The main code for the implementations can be found in the following files:

Running the code

Server

go run

$ buf generate proto # or with protoc (see chapter4/README.md)
$ go run ./server 0.0.0.0:50051 0.0.0.0:50052

bazel run

$ bazel run //server:server 0.0.0.0:50051 0.0.0.0:50052

Client

go run

# if not done before `buf generate proto` or with protoc (see chapter4/README.md)
$ go run ./client 0.0.0.0:50051

bazel run

$ bazel run //client:client 0.0.0.0:50051

Prometheus

Once the client made some requests to the server, Prometheus exposes metrics on the /metrics route of the HTTP server. If you ran the following command:

$ go run ./server 0.0.0.0:50051 0.0.0.0:50052

the second address is the HTTP server address. This means that you can access the metrics like so:

$ curl http://localhost:50052/metrics