Class MeterFactory

java.lang.Object
org.jpos.metrics.MeterFactory

public class MeterFactory extends Object
Factory helpers that create or look up Micrometer meters defined by MeterInfo, ensuring duplicate registrations resolve to the same instance.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor; no instance state to initialise.
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.micrometer.core.instrument.Counter
    counter(io.micrometer.core.instrument.MeterRegistry registry, MeterInfo meterInfo, io.micrometer.core.instrument.Tags tags)
    Returns the Counter associated with meterInfo and tags, creating it when absent.
    static io.micrometer.core.instrument.Gauge
    gauge(io.micrometer.core.instrument.MeterRegistry registry, MeterInfo meterInfo, io.micrometer.core.instrument.Tags tags, String unit, Supplier<Number> n)
    Returns the Gauge associated with meterInfo and tags, creating one bound to n when absent.
    static void
    remove(io.micrometer.core.instrument.MeterRegistry registry, io.micrometer.core.instrument.Meter... meters)
    Removes the supplied meters from the registry, skipping null entries.
    static io.micrometer.core.instrument.Timer
    timer(io.micrometer.core.instrument.MeterRegistry registry, MeterInfo meterInfo, io.micrometer.core.instrument.Tags tags)
    Returns the Timer associated with meterInfo and tags, creating it (with histogram and 50/95 percentiles) when absent.
    static io.micrometer.core.instrument.Counter
    updateCounter(io.micrometer.core.instrument.MeterRegistry registry, String meterName, io.micrometer.core.instrument.Tags tags, String description)
    Registers (or updates) a freely-named Counter, bypassing the MeterInfo catalog.
    static io.micrometer.core.instrument.Counter
    updateCounter(io.micrometer.core.instrument.MeterRegistry registry, MeterInfo meterInfo, io.micrometer.core.instrument.Tags tags)
    Registers (or updates) the Counter identified by meterInfo.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MeterFactory

      public MeterFactory()
      Default constructor; no instance state to initialise.
  • Method Details

    • timer

      public static io.micrometer.core.instrument.Timer timer(io.micrometer.core.instrument.MeterRegistry registry, MeterInfo meterInfo, io.micrometer.core.instrument.Tags tags)
      Returns the Timer associated with meterInfo and tags, creating it (with histogram and 50/95 percentiles) when absent.
      Parameters:
      registry - the Micrometer registry
      meterInfo - meter id/description/default-tag descriptor
      tags - extra tags to combine with MeterInfo.add(Tags)
      Returns:
      the (possibly existing) Timer
    • counter

      public static io.micrometer.core.instrument.Counter counter(io.micrometer.core.instrument.MeterRegistry registry, MeterInfo meterInfo, io.micrometer.core.instrument.Tags tags)
      Returns the Counter associated with meterInfo and tags, creating it when absent.
      Parameters:
      registry - the Micrometer registry
      meterInfo - meter id/description/default-tag descriptor
      tags - extra tags to combine with MeterInfo.add(Tags)
      Returns:
      the (possibly existing) Counter
    • updateCounter

      public static io.micrometer.core.instrument.Counter updateCounter(io.micrometer.core.instrument.MeterRegistry registry, String meterName, io.micrometer.core.instrument.Tags tags, String description)
      Registers (or updates) a freely-named Counter, bypassing the MeterInfo catalog.
      Parameters:
      registry - the Micrometer registry
      meterName - meter id
      tags - meter tags
      description - meter description
      Returns:
      the registered Counter
    • updateCounter

      public static io.micrometer.core.instrument.Counter updateCounter(io.micrometer.core.instrument.MeterRegistry registry, MeterInfo meterInfo, io.micrometer.core.instrument.Tags tags)
      Registers (or updates) the Counter identified by meterInfo.
      Parameters:
      registry - the Micrometer registry
      meterInfo - meter id/description/default-tag descriptor
      tags - extra tags to combine with MeterInfo.add(Tags)
      Returns:
      the registered Counter
    • gauge

      public static io.micrometer.core.instrument.Gauge gauge(io.micrometer.core.instrument.MeterRegistry registry, MeterInfo meterInfo, io.micrometer.core.instrument.Tags tags, String unit, Supplier<Number> n)
      Returns the Gauge associated with meterInfo and tags, creating one bound to n when absent.
      Parameters:
      registry - the Micrometer registry
      meterInfo - meter id/description/default-tag descriptor
      tags - extra tags to combine with MeterInfo.add(Tags)
      unit - base unit, or null for none
      n - supplier called to read the current gauge value
      Returns:
      the (possibly existing) Gauge
    • remove

      public static void remove(io.micrometer.core.instrument.MeterRegistry registry, io.micrometer.core.instrument.Meter... meters)
      Removes the supplied meters from the registry, skipping null entries.
      Parameters:
      registry - the Micrometer registry
      meters - meters to remove