Part 26 · Best practices

Actuator, observations, metrics and traces

Prerequisites: 01-ecosystem

Which signal answers which question?

HTTP operation: named observation; Metrics: bounded dimensions; Trace spans: request causality; Actuator endpoints: health + operational access; Runtime recording: CPU / locks / allocation. Connections: HTTP operation to Metrics (aggregate); HTTP operation to Trace spans (correlate)
Metrics aggregate, traces connect work, runtime recordings explain JVM behavior. Endpoint exposure is a separate security decision. [S49] [S50] [S15]

Goal & mental model verified

Actuator exposes operational endpoints under explicit exposure/security settings. Micrometer Observation can support metrics and tracing. Low-cardinality dimensions suit metric aggregation; high-cardinality identifiers can explode metric series.

[S49] [S50]

Worked example · design exercise synthesis

Observe quote latency by route template and outcome. Correlate a slow request through a trace; inspect database wait and JVM events instead of placing every policy ID in a metric label.

[S49] [S50] [S15]

Engineering decision synthesis

Design signals around an operational question: errors, latency, saturation and dependency behavior. Expose only required management capabilities and restrict sensitive endpoints.

[S49] [S50] [S15]

Pitfall & diagnosis synthesis

Health is not one universal status. Putting shared external outages into liveness can trigger needless restarts; readiness dependencies should reflect whether this instance can serve useful traffic.

[S49] [S50] [S15]

Improve & validate synthesis

Simulate slow insurer calls and database outages. Confirm traces propagate and alerts identify the constrained boundary; measure signal cardinality and retention costs.

[S49] [S50] [S15]
Keep this: A dashboard earns its place by answering a failure question.
Check yourself: Should policyId be a metric label?

Usually no. Its high cardinality can create excessive time series; use logs/traces appropriately.

Sources & further reading

  1. [S15] Flight Recorder guide

    Oracle / OpenJDK · documentation · accessed 2026-10-09 · Java SE 25

    Supports: JFR events and recordings for runtime diagnosis

    Read the linked section to validate the mechanism and its version-specific constraints.

  2. [S49] Boot observability

    Spring project maintainers · documentation · accessed 2026-10-09 · Documentation retrieved 2026-10-09

    Supports: Micrometer Observation; Metrics/tracing; Cardinality

    Read the linked section to validate the mechanism and its version-specific constraints.

  3. [S50] Actuator endpoints

    Spring project maintainers · documentation · accessed 2026-10-09 · Documentation retrieved 2026-10-09

    Supports: Endpoint exposure and security; Liveness/readiness

    Read the linked section to validate the mechanism and its version-specific constraints.