Class StatsdSink.Builder

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

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

    • interval

      public StatsdSink.Builder interval(Duration interval)
      How often to send (default 5 seconds).
      Parameters:
      interval - the flush interval, positive
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if it is not positive
    • dogStatsd

      public StatsdSink.Builder dogStatsd(boolean dogStatsd)
      Whether to send DogStatsD tags (|#name:value,...) with the tag-extracted names (default false: plain statsd, flat names).
      Parameters:
      dogStatsd - whether to send tags
      Returns:
      this builder
    • maxPacketSize

      public StatsdSink.Builder maxPacketSize(int bytes)
      The largest datagram to send (default 1432 bytes, which fits an Ethernet frame).
      Parameters:
      bytes - the most bytes per datagram, from 64 to 65507
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if it is out of range
    • build

      public StatsdSink build() throws IOException
      Opens the socket. Call StatsdSink.start() to flush every interval.
      Returns:
      the sink
      Throws:
      IOException - if the UDP socket cannot be opened