Skip to main content

Crate ferrohealth_server

Crate ferrohealth_server 

Source
Expand description

The HTTP server plumbing of the FerroHEALTH products.

stack::app wraps a product’s router in the one stack every server runs, under its base path, and stack::Stack also mounts routes beside the base path and the product’s fallback inside it:

  • request_id: the server mints its own id for every request and logs it; a client’s X-Request-Id is echoed and never logged.
  • panic: a handler panic becomes a 500 with a body the product supplies, and the panic message reaches neither the body nor the log.
  • the request timeout (408) and the body limit (413);
  • overload: past max_concurrent_requests (256 by default, always on) a request waits up to admission_wait (100 ms) in a queue of max_waiting_requests (256), then is answered 503 with Retry-After; the health routes are never refused or queued;
  • client_address: the address a request came from, read behind the trusted proxies;
  • gzip and Brotli response compression, on by default, and the decoding of a gzip or Brotli request body under the same body limit, off by default (request_decompression);
  • api_headers: the security headers of an API response, outermost, so the stack’s own refusals carry them too;
  • the request log of ferrohealth-telemetry;
  • health: /health, /health/liveness, /health/readiness and, when the product supplies it, /health/info.

problem writes RFC 9457 problem details, for a product’s own error bodies outside FHIR and, when the product opts in, for the stack’s refusals and panics.

caller_rate is the per-caller rate limit a product mounts inside its authentication.

serve::serve runs the app until SIGTERM or SIGINT, then withdraws readiness, waits the drain delay and finishes the requests in flight within a bound, over TLS when [server.tls] is set (tls); serve::run_all serves several listeners under one signal. tls_client reads the TLS material of a product’s outbound calls, telemetry (feature otlp) builds a product’s telemetry with its OTLP collector dialed over that TLS, and revocation (feature revocation) checks every certificate an outbound peer presents by CRL, then OCSP, before any data is sent. healthcheck is the container probe, cli::Common and cli::ConfigArgs the subcommands and arguments every binary shares, run::Run the run path around them (the parse, the runtime and the error chain), build_info the build facts and the boot banner, and console (feature console) the browser security headers of an operator console, with same_origin the check of its state-changing requests.

No specification governs the stack: our own design, with the status codes and Retry-After of RFC 9110.

Modules§

api_headers
The security headers of an API response, which the stack sets outermost.
build_info
What a build is, and the boot banner that says so.
caller_rate
The requests one caller may send.
cli
The subcommands and the arguments every FerroHEALTH binary shares.
client_address
The address a request came from.
health
The health routes every product serves.
healthcheck
The healthcheck subcommand: asks the server running beside it whether it is ready, for a container image with no shell and no HTTP client.
overload
The bound on the requests served at once, with a short wait in front of it.
panic
A handler panic becomes a 500 with the product’s body, never a dropped connection, and its message reaches neither the body nor the log.
problem
Problem details for every error body a product writes outside a FHIR route, as RFC 9457 defines them (https://www.rfc-editor.org/rfc/rfc9457).
refusal
The body of every refusal the stack writes itself, in the product’s shape.
request_id
The request id: the server’s own for every request, and the client’s echoed and never logged.
run
The run path every FerroHEALTH binary shares: the command line parsed, the runtime started, the product’s job run on it, and a failure written with its whole cause chain.
section
The [server] section of a product’s configuration.
serve
Serving until the process is asked to stop, then the bounded drain.
stack
The one stack every server runs around its routes.
tls
The listener’s TLS, and the TLS the healthcheck speaks to it.
tls_client
The TLS material of a product’s outbound TLS calls, HTTPS and others.

Macros§

tls_keys
The TlsKeys of the table $table, such as "metrics.tls".