1# gRPC C++ GCP Observability Hello World Example 2 3This example consists of a hello world client and a hello world server 4instrumented with GCP Observability for logs, metrics and tracing. Note that 5familiarity with the [basic hello world][] example is assumed. 6 7Please refer to GCP's [Microservices Observability user guide][] for setup 8instructions. 9 10[basic hello world]: https://grpc.io/docs/languages/cpp/quickstart 11[Microservices Observability user guide]: https://cloud.google.com/stackdriver/docs/solutions/grpc 12 13### Run the example with configuration 14 15To use Observability, you should first setup and configure authorization as 16mentioned in the Microservices Observability user guide. 17 18You need to set the `GRPC_GCP_OBSERVABILITY_CONFIG_FILE` environment variable to 19point to the gRPC GCP Observability configuration file (preferred) or 20alternatively set `GRPC_GCP_OBSERVABILITY_CONFIG` environment variable to gRPC 21GCP Observability configuration value. This is needed by both client and server. 22 23Sample configurations are provided with the example. 24 25To start the observability-enabled example server on its default port of 50051, 26run the following from the `grpc` directory: 27 28``` 29$ export 30 GRPC_GCP_OBSERVABILITY_CONFIG_FILE="$(pwd)/examples/cpp/gcp_observability/helloworld/server_config.json" 31$ tools/bazel run examples/cpp/gcp_observability/helloworld:greeter_server 32``` 33 34In a different terminal window, run the observability-enabled example client: 35 36``` 37$ export 38 GRPC_GCP_OBSERVABILITY_CONFIG_FILE="$(pwd)/examples/cpp/gcp_observability/helloworld/client_config.json" 39$ tools/bazel run examples/cpp/gcp_observability/helloworld:greeter_client 40``` 41