Interface IpdMeter

All Known Subinterfaces:
CounterMeter, CustomMeter<T>, JmxCopyMeter, StatsMeter, ValueMeter
All Known Implementing Classes:
AbstractIpdMeter, CounterMeter.Noop, CustomMeter.Noop, CustomMeterImpl, IpdMeter.NoopMeter, JmxCopyMeter.Noop, StatsMeter.Noop, ValueMeter.Noop

public interface IpdMeter
Base interface for all IPD meters. Implementations of this interface must be thread-safe and make the meter visible in JMX when its enabled and registered.
Since:
3.0.0
  • Method Details

    • getTypeId

      String getTypeId()
      Identifies type of the meter.
      Returns:
      Type ID of the meter
    • getMeterKey

      MeterKey getMeterKey()
      Returns:
      MeterKey that identifies meter by name and tag values
    • getConfig

      MeterConfig getConfig()
      Meter configuration is constructed when meter is created for the first time and is immutable.
      Returns:
      Read-only meter configuration for this meter
    • getObjectName

      ObjectName getObjectName()
      ObjectName of the MBean. Can be used to query this metric value in JMX.
      Returns:
      ObjectName of this metric
    • isEnabled

      boolean isEnabled()
      Returns:
      false if the meter is closed close() or MeterConfig.getEnabledCheck() check returns false, true otherwise
    • isVisible

      boolean isVisible()
      Meter might be enabled, but temporarily hidden in JMX. This might happen when meter value was not set yet or method hideUntilUpdate() was called.
      Returns:
      true if the meter is visible in JMX, false otherwise
    • hideUntilUpdate

      void hideUntilUpdate()
      Hides the meter in JMX until the next value update. isVisible() will return false until the next value update.
    • lastUpdateMillis

      long lastUpdateMillis()
      Returns the timestamp of the last value update in milliseconds. See Clock.millis().
      Returns:
      timestamp of the last value update in milliseconds
    • getAttributes

      Map<String,Object> getAttributes(boolean extraAttributes)
      Returns the attributes of the meter.
      Parameters:
      extraAttributes - if true, all attributes visible in JMX will be returned, otherwise only the most important ones
      Returns:
      Map of meter attributes, will return empty map if attributes can't be retrieved
    • close

      void close()
      Permanently closes this instance of the meter. This instance will always return false for isEnabled() and isVisible().
      This method is called on meter instances that are removed from the IpdRegistry
    • isClosed

      boolean isClosed()
      Checks if the meter is closed. A closed meter can't be enabled or visible in JMX. It's a terminal state that is triggered when a meter is removed from the IpdRegistry. You can get a new instance of the meter from the IpdRegistry.
      Returns:
      true if the meter is closed, false otherwise