Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
ostream/ | H | 25-Apr-2025 | - | 418 | 295 | |
BUILD | H A D | 25-Apr-2025 | 1.8 KiB | 64 | 58 | |
CMakeLists.txt | H A D | 25-Apr-2025 | 2.8 KiB | 88 | 76 | |
Makefile | H A D | 25-Apr-2025 | 4.9 KiB | 125 | 87 | |
README.md | H A D | 25-Apr-2025 | 1.5 KiB | 55 | 38 | |
greeter_callback_client.cc | H A D | 25-Apr-2025 | 2.6 KiB | 75 | 39 | |
greeter_callback_server.cc | H A D | 25-Apr-2025 | 2.6 KiB | 75 | 42 | |
util.cc | H A D | 25-Apr-2025 | 6.2 KiB | 182 | 119 | |
util.h | H A D | 25-Apr-2025 | 1.1 KiB | 34 | 9 |
README.md
1# gRPC C++ OpenTelemetry Example 2 3The opentelemetry example builds on the 4[Hello World Example](https://github.com/grpc/grpc/tree/master/examples/cpp/helloworld) 5and changes the gRPC client and server to show a sample way of configuring the 6gRPC OpenTelemetry plugin with a prometheus exporter. 7 8For more information on the gRPC OpenTelemetry plugin, please refer to - * 9[A66: OpenTelemetry Metrics](https://github.com/grpc/proposal/blob/master/A66-otel-stats.md) 10* [https://opentelemetry.io/]() 11 12## Running the example 13 14To run the server - 15 16``` 17$ tools/bazel run examples/cpp/otel:greeter_callback_server 18``` 19 20To run the client - 21 22``` 23$ tools/bazel run examples/cpp/otel:greeter_callback_client 24``` 25 26The client continuously sends an RPC to the server every second. 27 28To make sure that the server and client metrics are being exported properly, in 29a separate terminal, run the following - 30 31``` 32$ curl localhost:9464/metrics 33``` 34 35``` 36$ curl localhost:9465/metrics 37``` 38 39> ***NOTE:*** If the prometheus endpoint configured is overridden, please update 40> the target in the above curl command. 41 42## CMake Instructions 43 44The following libraries need to be installed before building the example with CMake - 45* absl 46* protobuf 47* prometheus-cpp 48* opentelemetry-cpp (with the options `-DWITH_ABSEIL=ON` `-DWITH_PROMETHEUS=ON`) 49* grpc (with the option `-DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON`) 50 51You can find a complete set of instructions for building gRPC and running the 52Hello World app in the [C++ Quick Start][]. 53 54[C++ Quick Start]: https://grpc.io/docs/languages/cpp/quickstart 55