ASP.NET Core MVC Interview Question #199

How would you make an MVC application observable in production?

Senior Practical MVC Scenarios & Production Architecture Senior Advanced

Quick Interview Answer

Combine structured logs, metrics, traces, health checks, request correlation, and dependency telemetry so failures and latency can be followed across the application. Capture useful dimensions such as endpoint, status code, duration, database dependency, and external service.

Detailed Explanation

Combine structured logs, metrics, traces, health checks, request correlation, and dependency telemetry so failures and latency can be followed across the application. Capture useful dimensions such as endpoint, status code, duration, database dependency, and external service.

Observability must avoid leaking secrets and sensitive personal data. Alerts should be based on actionable signals such as elevated error rates, latency, resource saturation, or failed critical dependencies.

Code Example

builder.Services.AddHealthChecks()
    .AddDbContextCheck<AppDbContext>();

app.MapHealthChecks("/health");