Class Histogram

java.lang.Object
com.codename1.backend.metrics.Instrument
com.codename1.backend.metrics.Histogram

public final class Histogram extends Instrument

A distribution of values -- durations, sizes -- kept as counts per bucket. Exported as a cumulative explicit-bucket histogram.

The buckets are fixed when the histogram is created; the default boundaries are OpenTelemetry's, which suit milliseconds.

A histogram created with label keys keeps a series per combination of label values -- the server's request histogram has route, method and status. The series are found by a map lookup on the first label, which is a constant such as a route template, so nothing new is hashed; and they are capped, so a label with unbounded values cannot grow the histogram without limit.

  • Method Details

    • defaultBounds

      public static double[] defaultBounds()
      A copy of OpenTelemetry's default explicit bucket boundaries.
    • getLabelKeys

      public String[] getLabelKeys()
      The label keys this histogram was created with.
    • record

      public void record(double value)
      Records one value in the series without labels.
    • record

      public void record(double value, Object first, Object second, Object third)
      Records one value in the series for these label values, given in the order of the keys the histogram was created with.
    • points

      public List points()
      Description copied from class: Instrument
      The current points, each a map with attributes (a map, possibly empty) and either value or, for a histogram, count, sum, min, max, bounds and buckets.
      Specified by:
      points in class Instrument