Summary
In this chapter, we got hands-on experience in instrumenting network calls using gRPC as an example. Before starting instrumentation, we learned about the available instrumentation libraries and what OpenTelemetry semantic conventions recommend recording for gRPC.
First, we instrumented unary calls with client and server spans and propagated context through gRPC metadata. Then, we experimented with gRPC streaming, which needs a different approach to tracing. The generic instrumentation of streaming calls suggests creating an event per individual request and response message in the stream and provides a basic level of observability. Depending on our scenarios and observability needs, we can add another layer of instrumentation to trace individual messages. These custom spans work on top of the generic gRPC instrumentation.
Finally, we used tracing to get insights into high latency and transient error scenarios, which also helped us understand gRPC internals.
You’...