xref: /aosp_15_r20/external/grpc-grpc-java/examples/example-gcp-observability/README.md (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1gRPC GCP Observability Example
2================
3
4The GCP Observability example consists of a Hello World client and a Hello World server instrumented for logs, metrics and tracing.
5
6__Please refer to Microservices Observability user guide for setup.__
7
8### Build the example
9
10Build the Observability client & server. From the `grpc-java/examples/example-gcp-observability`
11directory:
12```
13$ ../gradlew installDist
14```
15
16This creates the scripts `build/install/example-gcp-observability/bin/gcp-observability-client` and
17`build/install/example-gcp-observability/bin/gcp-observability-server`.
18
19### Run the example with configuration
20
21To use Observability, you should first setup and configure authorization as mentioned in the user guide.
22
23You need to set the `GRPC_GCP_OBSERVABILITY_CONFIG_FILE` environment variable to point to the gRPC GCP Observability configuration file (preferred) or if that
24is not set then `GRPC_GCP_OBSERVABILITY_CONFIG` environment variable to gRPC GCP Observability configuration value. This is needed by both
25`build/install/example-gcp-observability/bin/gcp-observability-client` and
26`build/install/example-gcp-observability/bin/gcp-observability-server`.
27
281. To start the observability-enabled example server on its default port of 50051, run:
29```
30$ export GRPC_GCP_OBSERVABILITY_CONFIG_FILE=src/main/resources/io/grpc/examples/gcpobservability/gcp_observability_server_config.json
31$ ./build/install/example-gcp-observability/bin/gcp-observability-server
32```
33
342. In a different terminal window, run the observability-enabled example client:
35```
36$ export GRPC_GCP_OBSERVABILITY_CONFIG_FILE=src/main/resources/io/grpc/examples/gcpobservability/gcp_observability_client_config.json
37$ ./build/install/example-gcp-observability/bin/gcp-observability-client
38```
39
40