Interface Metric


public interface Metric
Handler for manipulating one user-defined metric.

Metrics are in essence just simple long values, with any semantics. They can be used for example for counting things (like number of certain events) or for storing standalone values (like measurements).

To obtain an instance, use Metrics.metric(java.lang.String). The instance is tied to the processor it was created for and is or is not thread-safe based on the method that was used to create it.

Since:
Jet 4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Decrements the current value by 1.
    void
    decrement(long amount)
    Decrements the current value by the specified amount.
    void
    Increments the current value by 1.
    void
    increment(long amount)
    Increments the current value by the specified amount.
    Returns the name of the associated metric.
    void
    set(long newValue)
    Sets the current value.
    Return the measurement unit for the associated metric.
  • Method Details

    • name

      @Nonnull String name()
      Returns the name of the associated metric.
    • unit

      @Nonnull Unit unit()
      Return the measurement unit for the associated metric. Meant to provide further information on the type of value measured by the user-defined metric. Doesn't affect the functionality of the metric, it still remains a simple numeric value, but is used to populate the MetricTags.UNIT tag in the metric's description.
    • increment

      void increment()
      Increments the current value by 1.
    • increment

      void increment(long amount)
      Increments the current value by the specified amount.
    • decrement

      void decrement()
      Decrements the current value by 1.
    • decrement

      void decrement(long amount)
      Decrements the current value by the specified amount.
    • set

      void set(long newValue)
      Sets the current value.