Module Histogram.Buckets

include module type of Prometheus_instrumentation_collector_histogram_buckets.Buckets

An 'a t represents a partition of the values in 'a into at least two intervals. Any value of type 'a (except for NaNs if 'a = float) belongs to exactly one bucket.

The only use for this type is making histograms, and the buckets get turned into metrics with special le labels, corresponding to counts of events with values less than or equal to the given one. In particular:

  • floats and ints get converted directly into le values
  • time spans are converted into a (decimal) number of seconds for the le label
  • A bucket is automatically added with an upper bound of +Inf

Note that the compare and equal functions completely ignore the passed in comparison or equality function for 'a and always use the standard comparison or equality function of whatever type 'a actually represents (e.g. Int.compare).

include Ppx_compare_lib.Comparable.S1 with type 'a t := 'a t
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
include Ppx_compare_lib.Comparable.S1__local with type 'a t := 'a t
include Ppx_compare_lib.Equal.S1 with type 'a t := 'a t
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
include Ppx_compare_lib.Equal.S1__local with type 'a t := 'a t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t

Describes the allowable types for bucket boundaries

Buckets that serve as a reasonable default for users that don't want to customize the boundaries.

Helper functions for creating uniformly spaced buckets.

Helper functions for creating buckets with exponentially increasing size.

val boundaries_excluding_infinity : 'a t -> 'a Core.Array.t

Boundaries for the buckets. When using these boundaries, one should implicitly add another bucket at +Inf.

val type_ : 'a t -> 'a Type.t
val bucket_ranges : 'a t -> ('a * 'a) list