Covers the four production signals (metrics, traces, logs, dumps): what each records, its cost, which incident question it answers, how they link through trace ids, and the order a responder uses them in.
The four signals answer different questions. Metrics are cheap aggregated numbers over time (error rate, p95 latency, ThreadPool queue length): they tell you whether something is wrong and how much, and they drive alerts. Distributed traces follow one request across services as spans: they tell you where the time or the error is. Logs are structured events with context: they tell you what happened and why (the exception, the order id, the dependency's response). Memory dumps (dotnet-dump, dotnet-gcdump) freeze a process's heap and thread stacks: they tell you what it is doing or holding right now, for hangs, leaks and crashes.
During an incident my order is: 1. metrics and the dashboard (scope and start time), 2. traces (where), 3. logs for those trace ids (why), and 4. a dump only when the process itself is the suspect. The trade-off: richer signals cost more to store and carry more personal data.
"I think of them as four zoom levels. Metrics are the widest: numbers aggregated over time, like requests per second, the 5xx ratio, p95 latency, CPU, GC heap size or ThreadPool queue length. They are cheap to keep for months, so they're what alerts and dashboards are built on. A metric tells me that the error rate went from 0.1% to 6% at 10:02, but not which request or why.
Traces zoom in to a single request. In .NET every incoming request gets an
Activitywith a W3C trace id, and OpenTelemetry records each hop as a span: the controller, the SQL call, the Redis call, the downstream HTTP call. So a trace tells me where: this request took 9 seconds and 8.7 of them were waiting on the payments API. Logs are the detail: a structuredILoggerevent with properties like the order id and the exception, stamped with the same trace id, so from a slow span I can jump straight to what the code said at the time. Dumps are different again: a snapshot of the whole process, its heap and every thread's stack, taken withdotnet-dumpordotnet-gcdump. I take one when the process itself is the problem: it hangs, memory keeps climbing, or it crashes.So when an alert fires, I go in that order: the metric that fired and the service dashboard to scope the impact, then a few failing or slow traces to find where, then the logs for those trace ids to find why, and only a dump if it's a hang, a leak or a crash. The mistake I see is people starting by grepping logs: it's the most expensive signal to search and you can't see the shape of the problem. Metrics first, then narrow down."
| Signal | What it records | Typical .NET source | Answers | Cost |
|---|---|---|---|---|
| Metrics | Numbers aggregated over time, with a few tags | System.Diagnostics.Metrics (Meter), runtime and ASP.NET Core meters, dotnet-counters |
Is it broken? How much? Since when? | Lowest; fixed per series |
| Traces | A tree of timed spans per request | ActivitySource, OpenTelemetry instrumentation for ASP.NET Core, HttpClient, SqlClient |
Where is the time or error? Which dependency? | Medium; usually sampled |
| Logs | Discrete structured events | ILogger with message templates |
What happened and why? Which values? | High per GB; searchable |
| Dumps | Whole-process memory and thread stacks | dotnet-dump, dotnet-gcdump, createdump, dotnet-monitor |
What is the process holding or stuck on? | Large files; taken on demand |
| Question during the incident | Reach for |
|---|---|
| Are users affected, and how many? | Metrics (error ratio, request rate by status) |
| When did it start, and did it match a deploy? | Metrics with deploy annotations |
| Which dependency is slow? | Traces (span durations), dependency metrics |
| What exception, for which input? | Logs filtered by trace id |
| Why are requests hanging at low CPU? | Runtime metrics (ThreadPool queue), then a heap dump: clrthreads, clrstack -all, syncblk |
| What is holding 3 GB of memory? | GC metrics, then a gcdump or heap dump: dumpheap -stat, gcroot <address> |
The trace id is the join key. ASP.NET Core creates an Activity per request; ILogger scopes include its TraceId and SpanId when OpenTelemetry logging is on; Application Insights stores it as operation_Id. Exemplars can attach a trace id to a metric point, so you can jump from a latency spike straight to a slow trace.
| Signal | At thousands of requests per second | Consequence for the responder |
|---|---|---|
| Metrics | Cost grows with series (tag combinations), not requests | Keep tags low-cardinality; metrics stay complete and trustworthy |
| Traces | Head sampling (e.g. 5%) or tail sampling in the OpenTelemetry Collector | The exact failing request may be missing; tail sampling keeps errors and slow requests |
| Logs | GB per hour; ingestion and retention are billed | Warning and above by default; Debug turned on dynamically; Application Insights may sample logs too |
| Dumps | One per instance, on demand | Pick one representative instance; never dump all at once |
So for counting ("how many failed?") trust metrics, not sampled traces or logs.
When the checkout error ratio jumped from 0.2% to 5% at 10:02, the dashboard showed it only on POST /orders; three failed traces all ended in a 30-second timeout on the pricing API span, and the logs for those trace ids showed TaskCanceledException from the typed HttpClient. We switched the pricing call to its cached fallback within 10 minutes. Nobody needed a dump, because the process itself was healthy.
Checks the candidate knows what each production signal is for and can use them in a sensible order during an incident.
Green flags
Red flags
Each signal makes a different trade between volume and detail:
detail per event ───────────────►
metrics │ one number per series per interval (cheap, always on, alerts)
traces │ one tree per request, sampled (where)
logs │ many events per request (why)
dumps │ the entire process at one instant (what is it holding / stuck on)
volume you can afford to keep ◄──────────
Metrics are pre-aggregated at the source, so a million requests become a handful of counters and histogram buckets. That's why they're the only signal you can keep cheaply for months and alert on reliably. The cost is that aggregation throws away the individual request.
System.Diagnostics.Metrics provides Meter, Counter<T>, Histogram<T> and ObservableGauge<T>. .NET publishes built-in meters such as System.Runtime (GC, ThreadPool, exceptions), Microsoft.AspNetCore.Hosting (http.server.request.duration) and System.Net.Http. You can read them live with no code change:
dotnet-counters monitor -p <pid> --counters System.Runtime,Microsoft.AspNetCore.Hosting
Tags (dimensions) multiply series: a route tag with 50 values is fine; a userId tag is a cardinality explosion.
System.Diagnostics.Activity is .NET's span. ASP.NET Core starts one per request and continues the caller's traceparent header (W3C Trace Context). HttpClient propagates it outwards. OpenTelemetry's instrumentation libraries turn activities into spans and export them over OTLP to Application Insights, Jaeger, Tempo and so on. Because a busy service creates millions of spans, traces are usually sampled (head sampling at a percentage, or tail sampling in the OpenTelemetry Collector to keep all errors and slow requests).
ILogger with message templates ("Order {OrderId} failed") produces structured events whose properties are queryable. The cost is volume: logs are billed by GB ingested in Log Analytics, so levels, sampling and filtering matter. Logs are also where personal data leaks most often.
A dump is a copy of process memory. A full or heap dump contains every object, so you can run SOS commands (clrthreads, clrstack -all, dumpheap -stat, gcroot) with dotnet-dump analyze. A gcdump contains only the managed object graph (types, sizes, references), so it's smaller and holds no field values. Capturing pauses the process, and the file is roughly the size of the working set, so dumps are a targeted tool, not a stream.
alert (metric) ─► dashboard: scope, start time, deploy marker
│
▼
sample failing/slow traces ─► which span? which dependency?
│
▼
logs where TraceId = X ─► exception, inputs, retry attempts
│
process itself suspect? (hang, leak, crash)
▼
dump ─► threads, heap, roots
dotnet-counters monitor while you load it with bombardier or k6.TraceId appears on the span and the log line.Thread.Sleep in a hot path, take dotnet-dump collect, and find the sleeping threads with clrstack -all.requests and traces on operation_Id.One endpoint that emits all three runtime signals with OpenTelemetry (.NET 10), so they share a trace id.
// Program.cs — needs OpenTelemetry.Extensions.Hosting and the ASP.NET Core / HttpClient instrumentation packages.
using System.Diagnostics;
using System.Diagnostics.Metrics;
using OpenTelemetry.Logs;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenTelemetry()
.WithMetrics(m => m.AddAspNetCoreInstrumentation().AddRuntimeInstrumentation().AddMeter(Checkout.MeterName).AddOtlpExporter())
.WithTracing(t => t.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation().AddSource(Checkout.SourceName).AddOtlpExporter());
builder.Logging.AddOpenTelemetry(o => { o.IncludeScopes = true; o.AddOtlpExporter(); }); // logs carry TraceId/SpanId
builder.Services.AddSingleton<Checkout>();
var app = builder.Build();
app.MapPost("/orders", (OrderRequest req, Checkout checkout, CancellationToken ct) => checkout.PlaceAsync(req, ct));
app.Run();
public sealed record OrderRequest(string Sku, int Quantity);
public sealed class Checkout(ILogger<Checkout> logger, IMeterFactory meterFactory)
{
public const string MeterName = "Shop.Checkout";
public const string SourceName = "Shop.Checkout";
private static readonly ActivitySource Source = new(SourceName);
private readonly Counter<long> _orders = meterFactory.Create(MeterName).CreateCounter<long>("shop.orders.placed");
public async Task<IResult> PlaceAsync(OrderRequest req, CancellationToken ct)
{
using var activity = Source.StartActivity("PlaceOrder"); // trace: WHERE
activity?.SetTag("shop.sku", req.Sku);
await Task.Delay(20, ct); // stand-in for real work
_orders.Add(1, new KeyValuePair<string, object?>("outcome", "success")); // metric: HOW MUCH (low-cardinality tag only)
logger.LogInformation("Placed order for {Sku} x{Quantity}", req.Sku, req.Quantity); // log: WHAT
return Results.Accepted();
}
}
# The fourth signal, taken only when the process is the suspect
dotnet-counters monitor -p 1 --counters System.Runtime # metrics live
dotnet-dump collect -p 1 --type Heap -o /tmp/api.dmp # dump: WHAT IS IT HOLDING
dotnet-dump analyze /tmp/api.dmp # then: clrstack -all, dumpheap -stat
// Application Insights: from a failed request to its logs via the trace id
requests
| where timestamp > ago(30m) and success == false and name == "POST /orders"
| take 5
| join kind=inner (traces) on operation_Id
| project timestamp, operation_Id, resultCode, message, severityLevel
TraceId and SpanId.Even at junior level, the useful idea is that the signals are complementary, not interchangeable: metrics for detection, traces for location, logs for explanation, dumps for the process's internal state. Teams that pour everything into logs pay the most and still struggle to answer "how many users?" quickly.
| Signal | Best for | Cost driver | Don't use it for |
|---|---|---|---|
| Metrics | Alerts, trends, SLOs | Number of series (tag cardinality) | Per-request detail |
| Traces | Cross-service latency, dependency failures | Span volume, sampling rate | Counting exact totals when sampled |
| Logs | Error details, audit of decisions | GB ingested and retained | Alerting, high-volume counting |
| Dumps | Hangs, leaks, crashes | File size, process pause | Routine monitoring |
When I can't attach a debugger, I take a dump: a snapshot of the process's memory, threads and stacks that I analyse offline. For a hang or a leak, dotnet-dump collect -p <pid> does it in seconds. For crashes, I enable automatic crash dumps with the DOTNET_DbgEnableMiniDump environment variables. On App Service I use Diagnose and solve problems, and in Kubernetes dotnet-monitor. Then I analyse with dotnet-dump analyze: clrstack -all and syncblk for hangs, dumpheap -stat and gcroot for leaks, pe for exceptions. Or I open the dump in Visual Studio and use the Threads and Parallel Stacks windows. Dumps contain customer data, so they're handled as sensitive.
Alert on symptoms users feel, such as the request error-rate or latency SLI, failed synthetic journeys or orders per minute dropping, because causes like CPU at 80% often hurt nobody and miss failures with no resource signal at all. The best symptom alert is SLO burn rate: how fast you are spending the error budget. With a 99.9% SLO, a 14.4× burn over 1 hour (confirmed over 5 minutes) spends 2% of a 30-day budget and pages; 6× over 6 hours pages; slower burns raise a ticket.
Every alert needs who gets paged (the owning team's rotation), the threshold and window, a severity that decides page versus ticket, a dashboard link and a runbook with the first mitigation steps. Cause metrics stay on dashboards for diagnosis. The trade-off: fewer pages means a slightly later warning for slow-building problems, which tickets cover.
An incident moves through detect → triage → mitigate → resolve → review. Detection should come from alerts on customer-facing symptoms (error rate, latency, SLO burn), not from customers ringing support. Triage decides how bad it is (severity), who leads it (the incident commander) and who else is needed. Mitigation stops the customer pain as fast as possible — roll back, turn a feature flag off, fail over — guided by a working hypothesis about what changed, without waiting for a proven root cause. Resolution is when the SLIs are back inside their SLOs and stay there. Review is the blameless postmortem that produces owned, dated fixes. Communication to stakeholders runs through every stage.
The timestamps between the stages give you time to detect, time to mitigate and time to resolve. The main trade-off is speed versus understanding: you restore service first and investigate second.
Last updated 23 Nov 2026.