Skip to content
Leader docs0.4

Micrometer instrumentation

Latest stable Based on Leader release 0.4.0

Library module

Adds Micrometer metrics around single/group/suspend electors, Core lifecycle listeners, Spring AOP recording, and history sinks without changing election truth.

Use it when operations need acquisition, skip, failure, duration, or history metrics across backends. Keep it out if no registry consumes the data.

Artifact: io.github.bluetape4k.leader:bluetape4k-leader-micrometer

dependencies {
implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>"))
implementation("io.github.bluetape4k.leader:bluetape4k-leader-micrometer")
}

Instrumented wrappers delegate ownership to the underlying elector. Metrics describe attempts and outcomes; they never grant permission to execute.

val instrumented = InstrumentedLeaderElector(
delegate = elector,
registry = meterRegistry
)
instrumented.runIfLeader("daily-report") { generateReport() }

Wrap direct electors, attach MicrometerLeaderElectionListener, use the AOP recorder for Spring, or decorate safe history recorders.

Register one wrapper per logical elector, use bounded tags, and keep lock names out of tags when they are tenant- or request-derived.

Works with every Core-compatible backend. prometheus-dashboard demonstrates export and dashboard/alert wiring.

Choose registry, common tags, meter filters, histogram/percentile policy, and cardinality limits in the application. The module does not configure a monitoring backend.

A metrics registry failure must not become ownership truth. Duplicate wrapping double-counts. Unbounded lock-name tags can exhaust memory even when election works.

Alert on backend failure and extension failure separately from normal skip. Track duration and attempt volume, then correlate with backend latency.

Use a simple registry to assert names/tags/outcomes, failure paths, suspend cancellation, no-op behavior, and history decoration without duplicate counts.

Run prometheus-dashboard after learning Core outcomes. Then use the chosen backend page to interpret which failures are operationally actionable.

Metrics are observational and may be dropped. They do not provide durable audit, tracing, alerts, dashboards, or low-cardinality policy automatically.

These diagrams are loaded directly from README assets published with the 0.4.0 release and pinned to its immutable commit. They describe this manual’s released structure and runtime flows, not later Snapshot changes. Select a preview to open the SVG at the same release commit.

leader-micrometer instrumentation architecture diagram

Section titled “leader-micrometer instrumentation architecture diagram”

leader-micrometer instrumentation architecture diagram

Release README: leader-micrometer/README.md

Instrumented electors · Listener · Stable guide