Tracing Your Code
In the previous chapters, we talked about instrumentation libraries and learned how to use auto-collected telemetry to monitor and debug distributed systems. Auto-instrumentations, when available, provide necessary and reasonable coverage for network calls, but you may want to trace additional logical operations, I/Os, sockets, or other calls that don’t have shared instrumentation available.
This chapter provides an in-depth guide to manual tracing using the System.Diagnostics
primitives or the OpenTelemetry API and explains the mechanism behind auto-instrumentation. We will cover the Activity
properties and how to populate them and show you how to record events. We’ll then learn how to use links to represent complex relationships between spans. Finally, we’ll cover the testing aspects of instrumentation.
You’ll learn how to do the following:
- Create activities using the .NET API or with the OpenTelemetry API shim
- Use ambient...