Class MetricsRegistry.Builder

java.lang.Object
com.jsgalactic.axiom.metrics.MetricsRegistry.Builder
Enclosing class:
MetricsRegistry

public static final class MetricsRegistry.Builder extends Object
Settings of a MetricsRegistry. Not thread-safe; build once at startup.
  • Method Details

    • maxSeries

      public MetricsRegistry.Builder maxSeries(int maxSeries)
      Sets the series limit.
      Parameters:
      maxSeries - most distinct name-and-tag combinations to keep, at least one
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the limit is below one
    • timerBuckets

      public MetricsRegistry.Builder timerBuckets(List<Duration> bounds)
      Sets the histogram bounds of every timer that has none of its own.
      Parameters:
      bounds - positive, strictly ascending upper bounds, at most 64
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the bounds are empty, unordered or too many
    • timerBuckets

      public MetricsRegistry.Builder timerBuckets(String name, List<Duration> bounds)
      Sets the histogram bounds of one timer, whatever its tags. Applies to series created afterwards, so configure before the application starts.
      Parameters:
      name - timer name
      bounds - positive, strictly ascending upper bounds, at most 64
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the name is invalid or the bounds are empty, unordered or too many
    • help

      public MetricsRegistry.Builder help(String name, String text)
      Sets the text of the # HELP line of a metric.
      Parameters:
      name - metric name
      text - one line of plain text, at most 512 characters
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the name is invalid or the text is empty, too long or contains a line break
    • build

      public MetricsRegistry build()
      Creates the registry.
      Returns:
      an empty registry