Micrometer instrumentation
Latest stable Based on Leader release 0.4.0
Library module
Problem
Section titled “Problem”Adds Micrometer metrics around single/group/suspend electors, Core lifecycle listeners, Spring AOP recording, and history sinks without changing election truth.
When to use it
Section titled “When to use it”Use it when operations need acquisition, skip, failure, duration, or history metrics across backends. Keep it out if no registry consumes the data.
Coordinates
Section titled “Coordinates”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")}Core concepts
Section titled “Core concepts”Instrumented wrappers delegate ownership to the underlying elector. Metrics describe attempts and outcomes; they never grant permission to execute.
Quick start
Section titled “Quick start”val instrumented = InstrumentedLeaderElector( delegate = elector, registry = meterRegistry)instrumented.runIfLeader("daily-report") { generateReport() }API by task
Section titled “API by task”Wrap direct electors, attach MicrometerLeaderElectionListener, use the AOP recorder for Spring, or decorate safe history recorders.
Recommended patterns
Section titled “Recommended patterns”Register one wrapper per logical elector, use bounded tags, and keep lock names out of tags when they are tenant- or request-derived.
Integrations
Section titled “Integrations”Works with every Core-compatible backend. prometheus-dashboard demonstrates export and dashboard/alert wiring.
Configuration
Section titled “Configuration”Choose registry, common tags, meter filters, histogram/percentile policy, and cardinality limits in the application. The module does not configure a monitoring backend.
Failure modes
Section titled “Failure modes”A metrics registry failure must not become ownership truth. Duplicate wrapping double-counts. Unbounded lock-name tags can exhaust memory even when election works.
Operations
Section titled “Operations”Alert on backend failure and extension failure separately from normal skip. Track duration and attempt volume, then correlate with backend latency.
Testing
Section titled “Testing”Use a simple registry to assert names/tags/outcomes, failure paths, suspend cancellation, no-op behavior, and history decoration without duplicate counts.
Workshops and learning path
Section titled “Workshops and learning path”Run prometheus-dashboard after learning Core outcomes. Then use the chosen backend page to interpret which failures are operationally actionable.
Limitations
Section titled “Limitations”Metrics are observational and may be dropped. They do not provide durable audit, tracing, alerts, dashboards, or low-cardinality policy automatically.
Release diagrams
Section titled “Release diagrams”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”Release README: leader-micrometer/README.md
