Interface IMetric

All Known Implementing Classes:
Metric

public interface IMetric
Represent one measurement of a metric. This is inspired by Prometheus Metric Types. TODO: Find out how to handle Histogram
  • Field Details

  • Method Details

    • getId

      String getId()
      The id of the metric, this must be unique.
      Returns:
      the unique id of the metric
    • getSuffix

      String getSuffix()
    • getTimestamp

      Instant getTimestamp()
      Returns:
      When the measurement was made.
    • getValue

      Object getValue()
      Returns:
      the value of the measurement/metric.
    • getLabels

      ILabelList getLabels()
      Returns:
      Additional parameters for the metric/measurement
    • getMetricFamily

      IMetricFamily getMetricFamily()
    • suffix

      IMetric suffix(String suffix)
      Add a suffix to be appended at the end of the metric name like so example_metric -> example_metric_suffix An example suffix is _avg so example_metric -> example_metric_avg This does not affect the IMetricFamily name.
      Parameters:
      suffix - - The suffix to be appended. Should follow the OpenMetrics specification.
      Returns:
      the IMetric with the added suffix
    • label

      IMetric label(String name, String value)
      Add a label
      Parameters:
      name - - name of the label
      value - - value of the label
      Returns:
      the IMetric instance containing the added label