chapter8/

directory
v0.0.0-...-96b9560 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: MIT

README

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

Directories

Path Synopsis
proto

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL