public class NonBlockingStatsDClient extends Object implements StatsDClient
Upon instantiation, this client will establish a socket connection to a StatsD instance running on the specified host and port. Metrics are then sent over this connection as they are received by the client.
Three key methods are provided for the submission of data-points for the application under scrutiny:
incrementCounter(java.lang.String, java.lang.String...)
- adds one to the value of the specified named counterrecordGaugeValue(java.lang.String, double, java.lang.String...)
- records the latest fixed value for the specified named gaugerecordExecutionTime(java.lang.String, long, java.lang.String...)
- records an execution time in milliseconds for the specified named operationrecordHistogramValue(java.lang.String, double, java.lang.String...)
- records a value, to be tracked with average, maximum, and percentilesrecordEvent(com.timgroup.statsd.Event, java.lang.String...)
- records an eventrecordSetValue(java.lang.String, java.lang.String, java.lang.String...)
- records a value in a setAs part of a clean system shutdown, the stop()
method should be invoked
on any StatsD clients.
Modifier and Type | Field and Description |
---|---|
static String |
CLIENT_TAG |
static String |
CLIENT_TRANSPORT_TAG |
static String |
CLIENT_VERSION_TAG |
static boolean |
DEFAULT_BLOCKING |
static int |
DEFAULT_DOGSTATSD_PORT |
static boolean |
DEFAULT_ENABLE_AGGREGATION |
static boolean |
DEFAULT_ENABLE_TELEMETRY |
static int |
DEFAULT_POOL_SIZE |
static int |
DEFAULT_PROCESSOR_WORKERS |
static int |
DEFAULT_QUEUE_SIZE |
static int |
DEFAULT_SENDER_WORKERS |
static int |
DEFAULT_UDP_MAX_PACKET_SIZE_BYTES |
static int |
DEFAULT_UDS_MAX_PACKET_SIZE_BYTES |
static int |
SOCKET_BUFFER_BYTES |
static int |
SOCKET_TIMEOUT_MS |
protected StatsDProcessor |
statsDProcessor |
protected StatsDSender |
statsDSender |
protected Telemetry |
telemetry |
protected StatsDProcessor |
telemetryStatsDProcessor |
protected StatsDSender |
telemetryStatsDSender |
Constructor and Description |
---|
NonBlockingStatsDClient(String prefix)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
Callable<SocketAddress> addressLookup)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
Callable<SocketAddress> addressLookup,
Callable<SocketAddress> telemetryAddressLookup,
int timeout,
int bufferSize,
int maxPacketSizeBytes,
String entityID,
int poolSize,
int processorWorkers,
int senderWorkers,
boolean blocking,
boolean enableTelemetry,
int telemetryFlushInterval,
int aggregationFlushInterval,
int aggregationShards)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
Callable<SocketAddress> addressLookup,
int timeout,
int bufferSize)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
Callable<SocketAddress> addressLookup,
int timeout,
int bufferSize,
int maxPacketSizeBytes)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
Callable<SocketAddress> addressLookup,
int timeout,
int bufferSize,
int maxPacketSizeBytes,
String entityID,
int poolSize,
int processorWorkers,
int senderWorkers,
boolean blocking,
boolean enableTelemetry,
int telemetryFlushInterval)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
int timeout,
int bufferSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
String... constantTags)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
int maxPacketSizeBytes)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
String entityID)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
String... constantTags)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
String[] constantTags,
int maxPacketSizeBytes)
Deprecated.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
String[] constantTags,
StatsDClientErrorHandler errorHandler)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Stop the statsd client.
|
void |
count(String aspect,
double delta,
double sampleRate,
String... tags)
Adjusts the specified counter by a given delta.
|
void |
count(String aspect,
double delta,
String... tags)
Adjusts the specified counter by a given delta.
|
void |
count(String aspect,
long delta,
double sampleRate,
String... tags)
Adjusts the specified counter by a given delta.
|
void |
count(String aspect,
long delta,
String... tags)
Adjusts the specified counter by a given delta.
|
protected StatsDProcessor |
createProcessor(int queueSize,
StatsDClientErrorHandler handler,
int maxPacketSizeBytes,
int bufferPoolSize,
int workers,
boolean blocking,
int aggregationFlushInterval,
int aggregationShards) |
protected StatsDProcessor |
createProcessor(StatsDProcessor processor) |
protected StatsDSender |
createSender(Callable<SocketAddress> addressLookup,
StatsDClientErrorHandler handler,
DatagramChannel clientChannel,
BufferPool pool,
BlockingQueue<ByteBuffer> buffers,
int senderWorkers) |
void |
decrement(String aspect,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.decrementCounter(String, double, String[]) . |
void |
decrement(String aspect,
String... tags)
Convenience method equivalent to
decrementCounter(String, String[]) . |
void |
decrementCounter(String aspect,
double sampleRate,
String... tags)
Decrements the specified counter by one.
|
void |
decrementCounter(String aspect,
String... tags)
Decrements the specified counter by one.
|
void |
distribution(String aspect,
double value,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.recordDistributionValue(String, double, double, String[]) . |
void |
distribution(String aspect,
double value,
String... tags)
Convenience method equivalent to
recordDistributionValue(String, double, String[]) . |
void |
distribution(String aspect,
long value,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.recordDistributionValue(String, long, double, String[]) . |
void |
distribution(String aspect,
long value,
String... tags)
Convenience method equivalent to
recordDistributionValue(String, long, String[]) . |
void |
gauge(String aspect,
double value,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.recordGaugeValue(String, double, double, String[]) . |
void |
gauge(String aspect,
double value,
String... tags)
Convenience method equivalent to
recordGaugeValue(String, double, String[]) . |
void |
gauge(String aspect,
long value,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.recordGaugeValue(String, long, double, String[]) . |
void |
gauge(String aspect,
long value,
String... tags)
Convenience method equivalent to
recordGaugeValue(String, long, String[]) . |
void |
histogram(String aspect,
double value,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.recordHistogramValue(String, double, double, String[]) . |
void |
histogram(String aspect,
double value,
String... tags)
Convenience method equivalent to
recordHistogramValue(String, double, String[]) . |
void |
histogram(String aspect,
long value,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.recordHistogramValue(String, long, double, String[]) . |
void |
histogram(String aspect,
long value,
String... tags)
Convenience method equivalent to
recordHistogramValue(String, long, String[]) . |
void |
increment(String aspect,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.incrementCounter(String, double, String[]) . |
void |
increment(String aspect,
String... tags)
Convenience method equivalent to
incrementCounter(String, String[]) . |
void |
incrementCounter(String aspect,
double sampleRate,
String... tags)
Increments the specified counter by one.
|
void |
incrementCounter(String aspect,
String... tags)
Increments the specified counter by one.
|
void |
recordDistributionValue(String aspect,
double value,
double sampleRate,
String... tags)
Records a value for the specified named distribution.
|
void |
recordDistributionValue(String aspect,
double value,
String... tags)
Records a value for the specified named distribution.
|
void |
recordDistributionValue(String aspect,
long value,
double sampleRate,
String... tags)
Records a value for the specified named distribution.
|
void |
recordDistributionValue(String aspect,
long value,
String... tags)
Records a value for the specified named distribution.
|
void |
recordEvent(Event event,
String... eventTags)
Records an event.
|
void |
recordExecutionTime(String aspect,
long timeInMs,
double sampleRate,
String... tags)
Records an execution time in milliseconds for the specified named operation.
|
void |
recordExecutionTime(String aspect,
long timeInMs,
String... tags)
Records an execution time in milliseconds for the specified named operation.
|
void |
recordGaugeValue(String aspect,
double value,
double sampleRate,
String... tags)
Records the latest fixed value for the specified named gauge.
|
void |
recordGaugeValue(String aspect,
double value,
String... tags)
Records the latest fixed value for the specified named gauge.
|
void |
recordGaugeValue(String aspect,
long value,
double sampleRate,
String... tags)
Records the latest fixed value for the specified named gauge.
|
void |
recordGaugeValue(String aspect,
long value,
String... tags)
Records the latest fixed value for the specified named gauge.
|
void |
recordHistogramValue(String aspect,
double value,
double sampleRate,
String... tags)
Records a value for the specified named histogram.
|
void |
recordHistogramValue(String aspect,
double value,
String... tags)
Records a value for the specified named histogram.
|
void |
recordHistogramValue(String aspect,
long value,
double sampleRate,
String... tags)
Records a value for the specified named histogram.
|
void |
recordHistogramValue(String aspect,
long value,
String... tags)
Records a value for the specified named histogram.
|
void |
recordServiceCheckRun(ServiceCheck sc)
Records a run status for the specified named service check.
|
void |
recordSetValue(String aspect,
String val,
String... tags)
Records a value for the specified set.
|
void |
serviceCheck(ServiceCheck sc)
Convenience method equivalent to
recordServiceCheckRun(ServiceCheck sc) . |
void |
stop()
Cleanly shut down this StatsD client.
|
void |
time(String aspect,
long value,
double sampleRate,
String... tags)
Convenience method equivalent to
StatsDClient.recordExecutionTime(String, long, double, String[]) . |
void |
time(String aspect,
long value,
String... tags)
Convenience method equivalent to
recordExecutionTime(String, long, String[]) . |
public static final int DEFAULT_UDP_MAX_PACKET_SIZE_BYTES
public static final int DEFAULT_UDS_MAX_PACKET_SIZE_BYTES
public static final int DEFAULT_QUEUE_SIZE
public static final int DEFAULT_POOL_SIZE
public static final int DEFAULT_PROCESSOR_WORKERS
public static final int DEFAULT_SENDER_WORKERS
public static final int DEFAULT_DOGSTATSD_PORT
public static final int SOCKET_TIMEOUT_MS
public static final int SOCKET_BUFFER_BYTES
public static final boolean DEFAULT_BLOCKING
public static final boolean DEFAULT_ENABLE_TELEMETRY
public static final boolean DEFAULT_ENABLE_AGGREGATION
public static final String CLIENT_TAG
public static final String CLIENT_VERSION_TAG
public static final String CLIENT_TRANSPORT_TAG
protected final StatsDProcessor statsDProcessor
protected StatsDProcessor telemetryStatsDProcessor
protected final StatsDSender statsDSender
protected StatsDSender telemetryStatsDSender
protected final Telemetry telemetry
public NonBlockingStatsDClient(String prefix, int queueSize, String[] constantTags, StatsDClientErrorHandler errorHandler, Callable<SocketAddress> addressLookup, Callable<SocketAddress> telemetryAddressLookup, int timeout, int bufferSize, int maxPacketSizeBytes, String entityID, int poolSize, int processorWorkers, int senderWorkers, boolean blocking, boolean enableTelemetry, int telemetryFlushInterval, int aggregationFlushInterval, int aggregationShards) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clientconstantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopaddressLookup
- yields the IP address and socket of the StatsD servertelemetryAddressLookup
- yields the IP address and socket of the StatsD telemetry server destinationqueueSize
- the maximum amount of unprocessed messages in the Queue.timeout
- the timeout in milliseconds for blocking operations. Applies to unix sockets only.bufferSize
- the socket buffer size in bytes. Applies to unix sockets only.maxPacketSizeBytes
- the maximum number of bytes for a message that can be sententityID
- the entity id value used with an internal tag for tracking client entity.
If "entityID=null" the client default the value with the environment variable "DD_ENTITY_ID".
If the environment variable is not defined, the internal tag is not added.poolSize
- The size for the network buffer pool.processorWorkers
- The number of processor worker threads assembling buffers for submission.senderWorkers
- The number of sender worker threads submitting buffers to the socket.blocking
- Blocking or non-blocking implementation for statsd message queue.enableTelemetry
- Boolean to enable client telemetry.telemetryFlushInterval
- Telemetry flush interval integer, in milliseconds.aggregationFlushInterval
- Aggregation flush interval integer, in milliseconds. 0 disables aggregation.aggregationShards
- Aggregation flush interval integer, in milliseconds. 0 disables aggregation.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clientStatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, int queueSize) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.queueSize
- the maximum amount of unprocessed messages in the BlockingQueue.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, String... constantTags) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.constantTags
- tags to be added to all content sentStatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, String[] constantTags, int maxPacketSizeBytes) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.constantTags
- tags to be added to all content sentmaxPacketSizeBytes
- the maximum number of bytes for a message that can be sentStatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, int queueSize, String... constantTags) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.constantTags
- tags to be added to all content sentqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, String[] constantTags, StatsDClientErrorHandler errorHandler) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.constantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopStatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, int queueSize, String[] constantTags, StatsDClientErrorHandler errorHandler) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.constantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, int queueSize, String[] constantTags, StatsDClientErrorHandler errorHandler, String entityID) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.constantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.entityID
- the entity id value used with an internal tag for tracking client entity.
If "entityID=null" the client default the value with the environment variable "DD_ENTITY_ID".
If the environment variable is not defined, the internal tag is not added.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, int queueSize, String[] constantTags, StatsDClientErrorHandler errorHandler, int maxPacketSizeBytes) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.constantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.maxPacketSizeBytes
- the maximum number of bytes for a message that can be sentStatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, String hostname, int port, int queueSize, int timeout, int bufferSize, String[] constantTags, StatsDClientErrorHandler errorHandler) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clienthostname
- the host name of the targeted StatsD server. If 'null' the environment variable
"DD_AGENT_HOST" is used to get the host name.port
- the port of the targeted StatsD server. If the parameter 'hostname' is 'null' and
this parameter is equal to '0', the environment variable
"DD_DOGSTATSD_PORT" is used to get the port, else the default value '8125' is used.constantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.timeout
- the timeout in milliseconds for blocking operations. Applies to unix sockets only.bufferSize
- the socket buffer size in bytes. Applies to unix sockets only.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, int queueSize, String[] constantTags, StatsDClientErrorHandler errorHandler, Callable<SocketAddress> addressLookup) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clientconstantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopaddressLookup
- yields the IP address and socket of the StatsD serverqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, int queueSize, String[] constantTags, StatsDClientErrorHandler errorHandler, Callable<SocketAddress> addressLookup, int timeout, int bufferSize) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clientconstantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopaddressLookup
- yields the IP address and socket of the StatsD serverqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.timeout
- the timeout in milliseconds for blocking operations. Applies to unix sockets only.bufferSize
- the socket buffer size in bytes. Applies to unix sockets only.StatsDClientException
- if the client could not be started@Deprecated public NonBlockingStatsDClient(String prefix, int queueSize, String[] constantTags, StatsDClientErrorHandler errorHandler, Callable<SocketAddress> addressLookup, int timeout, int bufferSize, int maxPacketSizeBytes) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clientconstantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopaddressLookup
- yields the IP address and socket of the StatsD serverqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.
the maximum amount of unprocessed messages in the Queue.timeout
- the timeout in milliseconds for blocking operations. Applies to unix sockets only.bufferSize
- the socket buffer size in bytes. Applies to unix sockets only.maxPacketSizeBytes
- the maximum number of bytes for a message that can be sentStatsDClientException
- if the client could not be startedpublic NonBlockingStatsDClient(String prefix, int queueSize, String[] constantTags, StatsDClientErrorHandler errorHandler, Callable<SocketAddress> addressLookup, int timeout, int bufferSize, int maxPacketSizeBytes, String entityID, int poolSize, int processorWorkers, int senderWorkers, boolean blocking, boolean enableTelemetry, int telemetryFlushInterval) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clientconstantTags
- tags to be added to all content senterrorHandler
- handler to use when an exception occurs during usage, may be null to indicate noopaddressLookup
- yields the IP address and socket of the StatsD serverqueueSize
- the maximum amount of unprocessed messages in the BlockingQueue.
the maximum amount of unprocessed messages in the Queue.timeout
- the timeout in milliseconds for blocking operations. Applies to unix sockets only.bufferSize
- the socket buffer size in bytes. Applies to unix sockets only.maxPacketSizeBytes
- the maximum number of bytes for a message that can be sententityID
- the entity id value used with an internal tag for tracking client entity.
If "entityID=null" the client default the value with the environment variable "DD_ENTITY_ID".
If the environment variable is not defined, the internal tag is not added.poolSize
- The size for the network buffer pool.processorWorkers
- The number of processor worker threads assembling buffers for submission.senderWorkers
- The number of sender worker threads submitting buffers to the socket.blocking
- Blocking or non-blocking implementation for statsd message queue.enableTelemetry
- Should telemetry be enabled for the client.telemetryFlushInterval
- Telemetry flush interval in seconds when the feature is enabled.StatsDClientException
- if the client could not be startedprotected StatsDProcessor createProcessor(int queueSize, StatsDClientErrorHandler handler, int maxPacketSizeBytes, int bufferPoolSize, int workers, boolean blocking, int aggregationFlushInterval, int aggregationShards) throws Exception
Exception
protected StatsDProcessor createProcessor(StatsDProcessor processor) throws Exception
Exception
protected StatsDSender createSender(Callable<SocketAddress> addressLookup, StatsDClientErrorHandler handler, DatagramChannel clientChannel, BufferPool pool, BlockingQueue<ByteBuffer> buffers, int senderWorkers) throws Exception
Exception
public void stop()
stop
in interface StatsDClient
public void close()
StatsDClient
close
in interface StatsDClient
close
in interface Closeable
close
in interface AutoCloseable
StatsDClient.stop()
public void count(String aspect, long delta, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
count
in interface StatsDClient
aspect
- the name of the counter to adjustdelta
- the amount to adjust the counter bytags
- array of tags to be added to the datapublic void count(String aspect, long delta, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
count
in interface StatsDClient
aspect
- the name of the counter to adjustdelta
- the amount to adjust the counter bysampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void count(String aspect, double delta, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
count
in interface StatsDClient
aspect
- the name of the counter to adjustdelta
- the amount to adjust the counter bytags
- array of tags to be added to the datapublic void count(String aspect, double delta, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
count
in interface StatsDClient
aspect
- the name of the counter to adjustdelta
- the amount to adjust the counter bysampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void incrementCounter(String aspect, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
incrementCounter
in interface StatsDClient
aspect
- the name of the counter to incrementtags
- array of tags to be added to the datapublic void incrementCounter(String aspect, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
incrementCounter
in interface StatsDClient
aspect
- the name of the counter to incrementsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void increment(String aspect, String... tags)
incrementCounter(String, String[])
.increment
in interface StatsDClient
aspect
- the name of the counter to incrementtags
- array of tags to be added to the datapublic void increment(String aspect, double sampleRate, String... tags)
StatsDClient.incrementCounter(String, double, String[])
.increment
in interface StatsDClient
aspect
- the name of the counter to incrementsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void decrementCounter(String aspect, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
decrementCounter
in interface StatsDClient
aspect
- the name of the counter to decrementtags
- array of tags to be added to the datapublic void decrementCounter(String aspect, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
decrementCounter
in interface StatsDClient
aspect
- the name of the counter to decrementsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void decrement(String aspect, String... tags)
decrementCounter(String, String[])
.decrement
in interface StatsDClient
aspect
- the name of the counter to decrementtags
- array of tags to be added to the datapublic void decrement(String aspect, double sampleRate, String... tags)
StatsDClient.decrementCounter(String, double, String[])
.decrement
in interface StatsDClient
aspect
- the name of the counter to decrementsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void recordGaugeValue(String aspect, double value, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
recordGaugeValue
in interface StatsDClient
aspect
- the name of the gaugevalue
- the new reading of the gaugetags
- array of tags to be added to the datapublic void recordGaugeValue(String aspect, double value, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
recordGaugeValue
in interface StatsDClient
aspect
- the name of the gaugevalue
- the new reading of the gaugesampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void recordGaugeValue(String aspect, long value, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
recordGaugeValue
in interface StatsDClient
aspect
- the name of the gaugevalue
- the new reading of the gaugetags
- array of tags to be added to the datapublic void recordGaugeValue(String aspect, long value, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
recordGaugeValue
in interface StatsDClient
aspect
- the name of the gaugevalue
- the new reading of the gaugesampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void gauge(String aspect, double value, String... tags)
recordGaugeValue(String, double, String[])
.gauge
in interface StatsDClient
aspect
- the name of the gaugevalue
- the new reading of the gaugetags
- array of tags to be added to the datapublic void gauge(String aspect, double value, double sampleRate, String... tags)
StatsDClient.recordGaugeValue(String, double, double, String[])
.gauge
in interface StatsDClient
aspect
- the name of the gaugevalue
- the new reading of the gaugesampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void gauge(String aspect, long value, String... tags)
recordGaugeValue(String, long, String[])
.gauge
in interface StatsDClient
aspect
- the name of the gaugevalue
- the new reading of the gaugetags
- array of tags to be added to the datapublic void gauge(String aspect, long value, double sampleRate, String... tags)
StatsDClient.recordGaugeValue(String, long, double, String[])
.gauge
in interface StatsDClient
aspect
- the name of the gaugevalue
- the new reading of the gaugesampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void recordExecutionTime(String aspect, long timeInMs, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
recordExecutionTime
in interface StatsDClient
aspect
- the name of the timed operationtimeInMs
- the time in millisecondstags
- array of tags to be added to the datapublic void recordExecutionTime(String aspect, long timeInMs, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
recordExecutionTime
in interface StatsDClient
aspect
- the name of the timed operationtimeInMs
- the time in millisecondssampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void time(String aspect, long value, String... tags)
recordExecutionTime(String, long, String[])
.time
in interface StatsDClient
aspect
- the name of the timed operationvalue
- the time in millisecondstags
- array of tags to be added to the datapublic void time(String aspect, long value, double sampleRate, String... tags)
StatsDClient.recordExecutionTime(String, long, double, String[])
.time
in interface StatsDClient
aspect
- the name of the timed operationvalue
- the time in millisecondssampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void recordHistogramValue(String aspect, double value, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
recordHistogramValue
in interface StatsDClient
aspect
- the name of the histogramvalue
- the value to be incorporated in the histogramtags
- array of tags to be added to the datapublic void recordHistogramValue(String aspect, double value, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
recordHistogramValue
in interface StatsDClient
aspect
- the name of the histogramvalue
- the value to be incorporated in the histogramsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void recordHistogramValue(String aspect, long value, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
recordHistogramValue
in interface StatsDClient
aspect
- the name of the histogramvalue
- the value to be incorporated in the histogramtags
- array of tags to be added to the datapublic void recordHistogramValue(String aspect, long value, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
recordHistogramValue
in interface StatsDClient
aspect
- the name of the histogramvalue
- the value to be incorporated in the histogramsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void histogram(String aspect, double value, String... tags)
recordHistogramValue(String, double, String[])
.histogram
in interface StatsDClient
aspect
- the name of the histogramvalue
- the value to be incorporated in the histogramtags
- array of tags to be added to the datapublic void histogram(String aspect, double value, double sampleRate, String... tags)
StatsDClient.recordHistogramValue(String, double, double, String[])
.histogram
in interface StatsDClient
aspect
- the name of the histogramvalue
- the value to be incorporated in the histogramsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void histogram(String aspect, long value, String... tags)
recordHistogramValue(String, long, String[])
.histogram
in interface StatsDClient
aspect
- the name of the histogramvalue
- the value to be incorporated in the histogramtags
- array of tags to be added to the datapublic void histogram(String aspect, long value, double sampleRate, String... tags)
StatsDClient.recordHistogramValue(String, long, double, String[])
.histogram
in interface StatsDClient
aspect
- the name of the histogramvalue
- the value to be incorporated in the histogramsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void recordDistributionValue(String aspect, double value, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
This is a beta feature and must be enabled specifically for your organization.
recordDistributionValue
in interface StatsDClient
aspect
- the name of the distributionvalue
- the value to be incorporated in the distributiontags
- array of tags to be added to the datapublic void recordDistributionValue(String aspect, double value, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
This is a beta feature and must be enabled specifically for your organization.
recordDistributionValue
in interface StatsDClient
aspect
- the name of the distributionvalue
- the value to be incorporated in the distributionsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void recordDistributionValue(String aspect, long value, String... tags)
This method is non-blocking and is guaranteed not to throw an exception.
This is a beta feature and must be enabled specifically for your organization.
recordDistributionValue
in interface StatsDClient
aspect
- the name of the distributionvalue
- the value to be incorporated in the distributiontags
- array of tags to be added to the datapublic void recordDistributionValue(String aspect, long value, double sampleRate, String... tags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
This is a beta feature and must be enabled specifically for your organization.
recordDistributionValue
in interface StatsDClient
aspect
- the name of the distributionvalue
- the value to be incorporated in the distributionsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void distribution(String aspect, double value, String... tags)
recordDistributionValue(String, double, String[])
.distribution
in interface StatsDClient
aspect
- the name of the distributionvalue
- the value to be incorporated in the distributiontags
- array of tags to be added to the datapublic void distribution(String aspect, double value, double sampleRate, String... tags)
StatsDClient.recordDistributionValue(String, double, double, String[])
.distribution
in interface StatsDClient
aspect
- the name of the distributionvalue
- the value to be incorporated in the distributionsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void distribution(String aspect, long value, String... tags)
recordDistributionValue(String, long, String[])
.distribution
in interface StatsDClient
aspect
- the name of the distributionvalue
- the value to be incorporated in the distributiontags
- array of tags to be added to the datapublic void distribution(String aspect, long value, double sampleRate, String... tags)
StatsDClient.recordDistributionValue(String, long, double, String[])
.distribution
in interface StatsDClient
aspect
- the name of the distributionvalue
- the value to be incorporated in the distributionsampleRate
- percentage of time metric to be senttags
- array of tags to be added to the datapublic void recordEvent(Event event, String... eventTags)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
recordEvent
in interface StatsDClient
event
- The event to recordeventTags
- array of tags to be added to the datapublic void recordServiceCheckRun(ServiceCheck sc)
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
recordServiceCheckRun
in interface StatsDClient
sc
- the service check objectpublic void serviceCheck(ServiceCheck sc)
recordServiceCheckRun(ServiceCheck sc)
.serviceCheck
in interface StatsDClient
sc
- the service check objectpublic void recordSetValue(String aspect, String val, String... tags)
Sets are used to count the number of unique elements in a group. If you want to track the number of unique visitor to your site, sets are a great way to do that.
This method is a DataDog extension, and may not work with other servers.
This method is non-blocking and is guaranteed not to throw an exception.
recordSetValue
in interface StatsDClient
aspect
- the name of the setval
- the value to tracktags
- array of tags to be added to the dataCopyright © 2020. All rights reserved.