Craig Tiller
dbb5164ac7
Closes #37820 PiperOrigin-RevId: 682352913 |
2 months ago | |
---|---|---|
.. | ||
.gitignore | Gcp Observability: Add example (#32710) | 2 years ago |
BUILD | Gcp Observability: Add example (#32710) | 2 years ago |
README.md | [GCP Observability] Add missing link (#34026) | 1 year ago |
client_config.json | Gcp Observability: Add example (#32710) | 2 years ago |
greeter_client.cc | [clang-format] Remove custom clang-format rules for include ordering (#37820) | 2 months ago |
greeter_server.cc | [clang-format] Remove custom clang-format rules for include ordering (#37820) | 2 months ago |
server_config.json | Gcp Observability: Add example (#32710) | 2 years ago |
README.md
gRPC C++ GCP Observability Hello World Example
This example consists of a hello world client and a hello world server instrumented with GCP Observability for logs, metrics and tracing. Note that familiarity with the basic hello world example is assumed.
Please refer to GCP's Microservices Observability user guide for setup instructions.
Run the example with configuration
To use Observability, you should first setup and configure authorization as mentioned in the Microservices Observability user guide.
You need to set the GRPC_GCP_OBSERVABILITY_CONFIG_FILE
environment variable to
point to the gRPC GCP Observability configuration file (preferred) or
alternatively set GRPC_GCP_OBSERVABILITY_CONFIG
environment variable to gRPC
GCP Observability configuration value. This is needed by both client and server.
Sample configurations are provided with the example.
To start the observability-enabled example server on its default port of 50051,
run the following from the grpc
directory:
$ export
GRPC_GCP_OBSERVABILITY_CONFIG_FILE="$(pwd)/examples/cpp/gcp_observability/helloworld/server_config.json"
$ tools/bazel run examples/cpp/gcp_observability/helloworld:greeter_server
In a different terminal window, run the observability-enabled example client:
$ export
GRPC_GCP_OBSERVABILITY_CONFIG_FILE="$(pwd)/examples/cpp/gcp_observability/helloworld/client_config.json"
$ tools/bazel run examples/cpp/gcp_observability/helloworld:greeter_client