Class StatsdClientImpl

java.lang.Object
com.itrsgroup.collection.instr.AbstractMetricsClient
com.itrsgroup.collection.instr.statsd.StatsdClientImpl
All Implemented Interfaces:
MetricsClient, AutoCloseable

public class StatsdClientImpl extends AbstractMetricsClient
Statsd MetricsClient with the following characteristics:
  • All instrumentation methods never block or throw, ensuring that callers are not disrupted by metrics delivery.
  • All post-construction exceptions are delivered via an optionally provided callback. If no callback is specified, exceptions are silently ignored.
  • Instrumentation requests are queued and delivered by a dedicated thread. If the queue is full when a new request is submitted, the request will be dropped. An IOException will be raised via the callback the first time this occurs; future occurrences are silently ignored.

    This situation likely indicates a network problem or that the application is sending metrics faster than they can be processed. In the latter case, the queue can be increased to accommodate the load.

  • The client is configured with a maximum message size. Any message that exceeds this size will be dropped and an IllegalArgumentException will be raised via the callback.
  • Metric names and dimension keys/values are encoded using UTF-8.
  • Safe for concurrent use by multiple threads.