Class StatsRegistry.Builder

java.lang.Object
org.microproxy.stats.StatsRegistry.Builder
Enclosing class:
StatsRegistry

public static final class StatsRegistry.Builder extends Object
Settings for a StatsRegistry.
  • Method Details

    • prefix

      public StatsRegistry.Builder prefix(String prefix)
      The prefix of exported names (default envoy): Prometheus names start with it and _, statsd names with it and a dot. A trailing _ or dot is dropped; an empty prefix exports names as they are.
      Parameters:
      prefix - the prefix, such as microproxy
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if it has characters other than letters, digits and _
    • tagExtractor

      public StatsRegistry.Builder tagExtractor(TagExtractor extractor)
      What takes the tags out of flat names (default TagExtractor.envoyDefaults()).
      Parameters:
      extractor - the extractor
      Returns:
      this builder
    • maxClusters

      public StatsRegistry.Builder maxClusters(int max)
      How many clusters (chained proxies, and servers with perHostClusters) may have stats of their own (default 100), besides direct, cache, replay and other, which always may.
      Parameters:
      max - the most clusters, at least 1
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if it is less than 1
    • clusterOverflow

      public StatsRegistry.Builder clusterOverflow(StatsRegistry.Overflow overflow)
      What happens to clusters beyond maxClusters (default StatsRegistry.Overflow.OTHER).
      Parameters:
      overflow - where their stats go
      Returns:
      this builder
    • perHostClusters

      public StatsRegistry.Builder perHostClusters(boolean perHost)
      Whether each server a direct connection goes to is a cluster of its own, named host_port (default false: they all are direct). A forward proxy's servers are any number: maxClusters bounds them.
      Parameters:
      perHost - whether servers are clusters of their own
      Returns:
      this builder
    • maxScriptStats

      public StatsRegistry.Builder maxScriptStats(int max)
      How many stats scripts may make (default 100); past that, a script's new stats do nothing.
      Parameters:
      max - the most script stats
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if it is negative
    • histogramBounds

      public StatsRegistry.Builder histogramBounds(double... bounds)
      The bucket bounds of histograms registered without bounds of their own (default Envoy's, Histogram.defaultBounds()).
      Parameters:
      bounds - the upper bounds, ascending and finite
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if they are not ascending and finite
    • build

      public StatsRegistry build()
      Returns a new registry with these settings.
      Returns:
      a new registry with these settings