Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 1.67 KB

File metadata and controls

66 lines (45 loc) · 1.67 KB

Examples

Set of examples that show off the features provided by rama-grpc.

Helloworld

Client

cargo run -p rama-grpc-examples --bin helloworld-client

Server

cargo run -p rama-grpc-examples --bin helloworld-server

Health

gRPC has a health checking protocol that defines how health checks for services should be carried out. rama-grpc supports it out of the box as long as you have the protobuf feature enabled (a default feature).

This example uses the crate to set up a HealthServer that will run alongside the application service. In order to test it, you may use community tools like grpc-health-probe.

For example, run the health server example (which toggles the serve status of the hello world example server every 250ms`):

cargo run -p rama-grpc-examples --bin health-server

And then run the go probe client (ensure to install it first):

while [ true ]; do
    $HOME/go/bin/grpc-health-probe -addr='[::1]:50051' -service='helloworld.Greeter'
    sleep '0.25'
done

will show the change in health status of the service over time:

service unhealthy (responded with "NOT_SERVING")
status: SERVING
service unhealthy (responded with "NOT_SERVING")
status: SERVING
...

OTLP Exporter

Demonstrates exporting OpenTelemetry metrics over gRPC using the OTLP protocol.

Requires a running OpenTelemetry collector:

docker run -p 127.0.0.1:4317:4317 otel/opentelemetry-collector:latest

Then run:

cargo run -p rama-grpc-examples --features opentelemetry --bin otel-exporter