Class MultiGauge

java.lang.Object
io.micrometer.core.instrument.MultiGauge

@Incubating(since="1.1.0") public class MultiGauge extends Object
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
  • Method Details

    • builder

      public static MultiGauge.Builder builder(String name)
      Parameters:
      name - The gauge's name.
      Returns:
      A new gauge builder.
    • register

      public void register(Iterable<? extends MultiGauge.Row<?>> rows)
      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

      public void register(Iterable<? extends MultiGauge.Row<?>> rows, boolean overwrite)
      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. When overwrite is true, rows that were previously registered with the same tags are replaced with the latest values. When overwrite is false, previously registered rows with the same tags are left unchanged. Rows that are no longer present are removed.

      Parameters:
      rows - rows to register
      overwrite - whether to replace rows that have already been registered with the same tags