grpc-java/examples/example-gcp-csm-observability
Eric Anderson f30964ab82
Bump versions of dependencies (#12252)
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.
2025-08-06 11:01:45 -07:00
..
src/main [CSM] Use xds-enabled server and xds credentials in examples (#11706) 2024-11-25 21:07:52 -08:00
README.md examples: Add GCP CSM Observability example (#11267) 2024-06-13 13:12:01 -07:00
build.gradle Bump versions of dependencies (#12252) 2025-08-06 11:01:45 -07:00
csm-client.Dockerfile examples: Add GCP CSM Observability example (#11267) 2024-06-13 13:12:01 -07:00
csm-server.Dockerfile examples: Add GCP CSM Observability example (#11267) 2024-06-13 13:12:01 -07:00
settings.gradle examples: Add GCP CSM Observability example (#11267) 2024-06-13 13:12:01 -07:00

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.