liveBook · Manning

Health check

As explained in Building Distributed Applications that Work

A health check is an automated assessment of whether an application or dependency is ready and functioning sufficiently for interaction.

A health check lets an orchestrator assess whether an application is ready to interact with other systems. Aspire does this by sending HTTP requests to health-check endpoints and evaluating their responses. section 6.5.2 section 6.7

A minimal self-check returns a healthy result while the application is running. If the application fails, the endpoint becomes inaccessible rather than returning a status. section 6.5.2

builder.Services.AddHealthChecks()
    .AddCheck("self", () => HealthCheckResult.Healthy(), ["live"]);

Register a self-check and tag it live so an endpoint can select it. section 6.5.2

Map endpoints for different health-check uses:

  • Use /health as the basic health-check endpoint. section 6.5.3
  • Use /alive to check for a response that includes the live tag. section 6.5.3

Run health checks in production as well as development, using the same endpoint paths. Because these endpoints are publicly accessible like other HTTP endpoints, protect them as the deployment requires. Runtime checks help monitor services but do not replace tests before production. section 6.5.4

How Building Distributed Applications that Work covers it

How deep it goes
Implements a self-check and maps basic and live-tag endpoints, while leaving production protections scenario-specific.
Examples
Uses a self-check tagged live and /health and /alive endpoints, with /alive filtering checks by tag.
What you can do after
Configure health-check registrations and HTTP endpoints for Aspire-hosted applications.
How it connects
Links Aspire orchestration with HTTP endpoints and distinguishes runtime health monitoring from pre-production testing.

Also explained in

Compare how 9 books explain health check →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Distributed Applications that Work. The section links point to the parts of the book it draws on.