7

Adding Custom Metrics

In the previous chapter, we looked into manual distributed tracing instrumentation, which should help us debug individual operations or analyze service usage with ad hoc queries. Here, we’ll talk about metrics. First, we’ll learn when to use them, understand cardinality requirements, and then see how traces and metrics complement each other. We’ll explore the metrics API’s evolution in .NET and then spend most of this chapter talking about OpenTelemetry metrics. We’ll cover instruments such as counters, gauges, and histograms, and learn about each of them in depth.

We will cover the following topics in the chapter:

  • The benefits, limitations, and evolution of metrics in .NET
  • How and when to use different counters
  • How ...

Get Modern Distributed Tracing in .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.