Class MicrometerUtils

java.lang.Object
com.gigaspaces.metrics.micrometer.MicrometerUtils

public class MicrometerUtils extends Object
Utility methods for working with Micrometer meters.

This class provides common operations needed when extracting values from Micrometer's various meter types, particularly for legacy reporter compatibility and snapshot generation.

Since:
17.1.4
  • Method Details

    • getMeterValue

      public static Object getMeterValue(io.micrometer.core.instrument.Meter meter)
      Extracts the numeric value from a Micrometer meter.

      This method handles all standard Micrometer meter types and provides consistent value extraction logic used by both the legacy reporter bridge and snapshot generation.

      Supported meter types:

      • Counter - Returns count as long
      • Gauge - Returns value as long (with NaN/Infinite checks)
      • Timer - Returns count
      • DistributionSummary - Returns count
      • LongTaskTimer - Returns active tasks
      • FunctionCounter - Returns count as long
      • FunctionTimer - Returns count
      • TimeGauge - Returns value as long (with NaN/Infinite checks)

      Invalid value handling:
      Returns null for:

      • Gauge values that are NaN or Infinite
      • TimeGauge values that are NaN or Infinite
      • Unsupported meter types
      Parameters:
      meter - The Micrometer meter to extract value from
      Returns:
      The numeric value from the meter, or null if the meter type is unsupported or the value is invalid (NaN/Infinite for gauges)
      See Also:
      • Counter
      • Gauge
      • Timer