Class MultiGauge
java.lang.Object
io.micrometer.core.instrument.MultiGauge
A virtual meter that manages a dynamic set of gauges with a common name and common
tags.
A MultiGauge is not itself a Meter; it creates and removes individual
Gauge meters as rows are registered. Each row contributes unique tags and a
value function. Re-registering rows reconciles the gauges currently managed by this
instance with the supplied rows.
- Since:
- 1.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFluent builder for multi-gauges.static class -
Method Summary
Modifier and TypeMethodDescriptionstatic MultiGauge.Buildervoidregister(Iterable<? extends MultiGauge.Row<?>> rows) Register rows for this multi-gauge without replacing rows that have already been registered with the same tags.voidregister(Iterable<? extends MultiGauge.Row<?>> rows, boolean overwrite) Register rows for this multi-gauge.
-
Method Details
-
builder
- Parameters:
name- The gauge's name.- Returns:
- A new gauge builder.
-
register
Register rows for this multi-gauge without replacing rows that have already been registered with the same tags. Rows that are no longer present are removed.- Parameters:
rows- rows to register
-
register
Register rows for this multi-gauge.Each row is registered as a gauge using this multi-gauge's common name and tags, combined with the row's unique tags, after applying any configured
MeterFilters.- Previously registered rows that are no longer present in
rowsare removed from the registry. - When
overwriteistrue, existing gauges are updated to track the new row values. If multiple rows inrowsresolve to the same meter ID (either directly or after filter transformations), the last row in iteration order takes precedence. - When
overwriteisfalse, previously registered rows are left unchanged. If multiple rows inrowsresolve to the same meter ID, the first row in iteration order takes precedence.
Note: If a
MeterFilterremoves or modifies tags such that multiple rows share the same mapped tags, those rows will contend for the same single gauge.- Parameters:
rows- rows to registeroverwrite- whether to update previously registered rows and overwrite duplicate rows within the batch
- Previously registered rows that are no longer present in
-