Class StatsdMetricWriter

    • Constructor Detail

      • StatsdMetricWriter

        public StatsdMetricWriter​(String host,
                                  int port)
        Create a new writer instance with the given parameters.
        Parameters:
        host - the hostname for the statsd server
        port - the port for the statsd server
      • StatsdMetricWriter

        public StatsdMetricWriter​(String prefix,
                                  String host,
                                  int port)
        Create a new writer with the given parameters.
        Parameters:
        prefix - the prefix to apply to all metric names (can be null)
        host - the hostname for the statsd server
        port - the port for the statsd server
      • StatsdMetricWriter

        public StatsdMetricWriter​(com.timgroup.statsd.StatsDClient client)
        Create a new writer with the given client.
        Parameters:
        client - StatsD client to write metrics with
    • Method Detail

      • increment

        public void increment​(Delta<?> delta)
        Description copied from interface: CounterWriter
        Increment the value of a metric (or decrement if the delta is negative). The name of the delta is the name of the metric to increment.
        Specified by:
        increment in interface CounterWriter
        Parameters:
        delta - the amount to increment by
      • set

        public void set​(Metric<?> value)
        Description copied from interface: GaugeWriter
        Set the value of a metric.
        Specified by:
        set in interface GaugeWriter
        Parameters:
        value - the value
      • reset

        public void reset​(String name)
        Description copied from interface: CounterWriter
        Reset the value of a metric, usually to zero value. Implementations can discard the old values if desired, but may choose not to. This operation is optional (some implementations may not be able to fulfill the contract, in which case they should simply do nothing).
        Specified by:
        reset in interface CounterWriter
        Parameters:
        name - the name to reset