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 |
DD_AGENT_HOST_ENV_VAR |
static String |
DD_DOGSTATSD_PORT_ENV_VAR |
static String |
DD_ENTITY_ID_ENV_VAR |
Constructor and Description |
---|
NonBlockingStatsDClient(String prefix)
Create a new StatsD client communicating with a StatsD instance.
|
NonBlockingStatsDClient(String prefix,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
Callable<SocketAddress> addressLookup)
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)
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,
int maxPacketSizeBytes)
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,
int maxPacketSizeBytes,
String entityID)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
int timeout,
int bufferSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
String... constantTags)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
int maxPacketSizeBytes)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
int queueSize,
String[] constantTags,
StatsDClientErrorHandler errorHandler,
String entityID)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
String... constantTags)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
String[] constantTags,
int maxPacketSizeBytes)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDClient(String prefix,
String hostname,
int port,
String[] constantTags,
StatsDClientErrorHandler errorHandler)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
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 StatsDSender |
createSender(Callable<SocketAddress> addressLookup,
int queueSize,
StatsDClientErrorHandler handler,
DatagramChannel clientChannel,
int maxPacketSizeBytes) |
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... tags)
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 value,
String... tags)
Records a value for the specified set.
|
void |
serviceCheck(ServiceCheck sc)
Convenience method equivalent to
recordServiceCheckRun(ServiceCheck sc) . |
static Callable<SocketAddress> |
staticAddressResolution(String hostname,
int port)
Lookup the address for the given host name and cache the result.
|
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[]) . |
static Callable<SocketAddress> |
volatileAddressResolution(String hostname,
int port)
Create dynamic lookup for the given host name and port.
|
public static final String DD_ENTITY_ID_ENV_VAR
public static final String DD_DOGSTATSD_PORT_ENV_VAR
public static final String DD_AGENT_HOST_ENV_VAR
public NonBlockingStatsDClient(String prefix) throws StatsDClientException
prefix
- the prefix to apply to keys sent via this clientStatsDClientException
- if the client could not be startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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 startedpublic 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.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) 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.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.StatsDClientException
- if the client could not be startedprotected StatsDSender createSender(Callable<SocketAddress> addressLookup, int queueSize, StatsDClientErrorHandler handler, DatagramChannel clientChannel, int maxPacketSizeBytes)
public void stop()
stop
in interface StatsDClient
public void close()
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
public void increment(String aspect, double sampleRate, String... tags)
StatsDClient.incrementCounter(String, double, String[])
.increment
in interface StatsDClient
public 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
public void decrement(String aspect, double sampleRate, String... tags)
StatsDClient.decrementCounter(String, double, String[])
.decrement
in interface StatsDClient
public 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 sentpublic void gauge(String aspect, double value, String... tags)
recordGaugeValue(String, double, String[])
.gauge
in interface StatsDClient
public void gauge(String aspect, double value, double sampleRate, String... tags)
StatsDClient.recordGaugeValue(String, double, double, String[])
.gauge
in interface StatsDClient
public 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 sentpublic void gauge(String aspect, long value, String... tags)
recordGaugeValue(String, long, String[])
.gauge
in interface StatsDClient
public void gauge(String aspect, long value, double sampleRate, String... tags)
StatsDClient.recordGaugeValue(String, long, double, String[])
.gauge
in interface StatsDClient
public 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
public void time(String aspect, long value, double sampleRate, String... tags)
StatsDClient.recordExecutionTime(String, long, double, String[])
.time
in interface StatsDClient
public 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 histogram(String aspect, double value, String... tags)
recordHistogramValue(String, double, String[])
.histogram
in interface StatsDClient
public void histogram(String aspect, double value, double sampleRate, String... tags)
StatsDClient.recordHistogramValue(String, double, double, String[])
.histogram
in interface StatsDClient
public 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, long value, String... tags)
recordHistogramValue(String, long, String[])
.histogram
in interface StatsDClient
public void histogram(String aspect, long value, double sampleRate, String... tags)
StatsDClient.recordHistogramValue(String, long, double, String[])
.histogram
in interface StatsDClient
public 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 distribution(String aspect, double value, String... tags)
recordDistributionValue(String, double, String[])
.distribution
in interface StatsDClient
public void distribution(String aspect, double value, double sampleRate, String... tags)
StatsDClient.recordDistributionValue(String, double, double, String[])
.distribution
in interface StatsDClient
public 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, long value, String... tags)
recordDistributionValue(String, long, String[])
.distribution
in interface StatsDClient
public void distribution(String aspect, long value, double sampleRate, String... tags)
StatsDClient.recordDistributionValue(String, long, double, String[])
.distribution
in interface StatsDClient
public void recordEvent(Event event, 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.
recordEvent
in interface StatsDClient
event
- The event to recordtags
- 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
public void recordSetValue(String aspect, String value, 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.
recordSetValue
in interface StatsDClient
aspect
- the name of the setvalue
- the value to tracktags
- array of tags to be added to the datapublic static Callable<SocketAddress> volatileAddressResolution(String hostname, int port)
hostname
- the host name of the targeted StatsD server. If the environment variable
"DD_AGENT_HOST" is set, this parameter is overwritten by the environment
variable value.port
- the port of the targeted StatsD server. If the environment variable
"DD_DOGSTATSD_PORT" is set, this parameter is overwritten by the environment
variable value.public static Callable<SocketAddress> staticAddressResolution(String hostname, int port) throws Exception
hostname
- the host name of the targeted StatsD serverport
- the port of the targeted StatsD serverException
- if the lookup fails, i.e. UnknownHostException
Copyright © 2020. All rights reserved.