grpc/examples/cpp/otel
Yash Tibrewal 3ebccf55cd [otel] Add gRPC OpenTelemetry example (#35793)
Closes #35793

PiperOrigin-RevId: 604371764
2024-02-05 11:05:44 -08:00
..
BUILD [otel] Add gRPC OpenTelemetry example (#35793) 2024-02-05 11:05:44 -08:00
README.md [otel] Add gRPC OpenTelemetry example (#35793) 2024-02-05 11:05:44 -08:00
greeter_callback_client.cc [otel] Add gRPC OpenTelemetry example (#35793) 2024-02-05 11:05:44 -08:00
greeter_callback_server.cc [otel] Add gRPC OpenTelemetry example (#35793) 2024-02-05 11:05:44 -08:00

README.md

gRPC C++ OpenTelemetry Example

The opentelemetry example builds on the Hello World Example and changes the gRPC client and server to show a sample way of configuring the gRPC OpenTelemetry plugin with a prometheus exporter.

For more information on the gRPC OpenTelemetry plugin, please refer to - * A66: OpenTelemetry Metrics

  • https://opentelemetry.io/

Running the example

To run the server -

$ tools/bazel run examples/cpp/otel:greeter_callback_server

To run the client -

$ tools/bazel run examples/cpp/otel:greeter_callback_client

The client continuously sends an RPC to the server every second.

To make sure that the server and client metrics are being exported properly, in a separate terminal, run the following -

$ curl localhost:9464/metrics
$ curl localhost:9465/metrics

NOTE: If the prometheus endpoint configured is overridden, please update the target in the above curl command.

You can find a complete set of instructions for building gRPC and running the Hello World app in the C++ Quick Start.