mirror of https://github.com/grpc/grpc-java.git
Notably, protobuf to 3.25.8, opentelemetry to 1.52.0. Protobuf in Bazel has 25.5 in the BCR and it seems better to align the WORKSPACE with that version. But we can't actually use 25.5 in BCR because it is incompatible with Bazel 7. |
||
|---|---|---|
| .. | ||
| src/main | ||
| README.md | ||
| build.gradle | ||
| csm-client.Dockerfile | ||
| csm-server.Dockerfile | ||
| settings.gradle | ||
README.md
gRPC GCP CSM Observability Example
The GCP CSM Observability example consists of a Hello World client and a Hello World server and shows how to configure CSM Observability for gRPC client and gRPC server.
Configuration
CsmObservabilityClient takes the following command-line arguments -
- user - Name to be greeted.
- target - Server address. Default value is
xds:///helloworld:50051.- When client tries to connect to target, gRPC would use xDS to resolve this target and connect to the server backend.
- prometheusPort - Port used for exposing prometheus metrics. Default value is
9464.
CsmObservabilityServer takes the following command-line arguments -
- port - Port used for running Hello World server. Default value is
50051. - prometheusPort - Port used for exposing prometheus metrics. Default value is
9464.
Build the example
From the grpc-java/examples/directory i.e,
cd grpc-java/examples
Run the following to generate client and server images respectively.
Client:
docker build -f example-gcp-csm-observability/csm-client.Dockerfile .
Server:
docker build -f example-gcp-csm-observability/csm-server.Dockerfile .
To push to a registry, add a tag to the image either by adding a -t flag to docker build command above or run:
docker image tag ${sha from build command above} ${tag}
And then push the tagged image using docker push.