Name Date Size #Lines LOC

..--

ostream/H25-Apr-2025-418295

BUILDH A D25-Apr-20251.8 KiB6458

CMakeLists.txtH A D25-Apr-20252.8 KiB8876

MakefileH A D25-Apr-20254.9 KiB12587

README.mdH A D25-Apr-20251.5 KiB5538

greeter_callback_client.ccH A D25-Apr-20252.6 KiB7539

greeter_callback_server.ccH A D25-Apr-20252.6 KiB7542

util.ccH A D25-Apr-20256.2 KiB182119

util.hH A D25-Apr-20251.1 KiB349

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