Class BaseMetricSettings<T extends BaseMetricSettings>

java.lang.Object
eu.rarogsoftware.rarog.platform.api.metrics.BaseMetricSettings<T>
Type Parameters:
T - child type
Direct Known Subclasses:
HistogramSettings, MetricSettings

public abstract class BaseMetricSettings<T extends BaseMetricSettings> extends Object
Base for all metric settings containing common settings like name, description, etc. It is convenience class. It cannot be instantiated directly.
  • Constructor Details

    • BaseMetricSettings

      public BaseMetricSettings()
  • Method Details

    • name

      public T name(String name)
      Set name of metric. It doesn't have any restriction, but some implementations may not accept all characters. Best to keep name passing [A-Za-z0-9_]* regex. Some characters like period `.` may be treated as special characters depending on implementation or metrics server.
      Parameters:
      name - name of metric
      Returns:
      settings object
    • description

      public T description(String description)
      Sets description. It not set will default to name.
      Parameters:
      description - description of metric
      Returns:
      settings object
    • labels

      public T labels(String... labels)
      Ordered list of labels names, that will be required to provide to use metric. Labels are usually used to add dimensions to metric. It is especially useful when metric measures some functionality that may have different behaviours depending on input data or when you need to measure different aspect of functionality.
      Parameters:
      labels - ordered list of labels
      Returns:
      settings object
    • labels

      public T labels(Collection<String> labels)
      Parameters:
      labels - ordered list of labels
      Returns:
      settings object
    • unit

      public T unit(String unit)
      Unit of metric. Usually is used as suffix of reported metric name, but it may change depending on implementation.
      Parameters:
      unit - unit of metric (e.g.: meters, bytes)
      Returns:
      settings object
    • name

      public String name()
      Returns:
      name of metric
    • description

      public String description()
      Returns:
      description of metric
    • labels

      public String[] labels()
      Returns:
      labels (dimentions) of metric
    • unit

      public String unit()
      Returns:
      unit of metric
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object