public final class NonBlockingStatsDEventClient extends BlockingStatsDEventClient
Upon instantiation, this client will establish a socket connection to a StatsD instance running on the specified host and port. Events are then sent over this connection as they are received by the client.
Six key methods are provided for the submission of events for the application under scrutiny:
BlockingStatsDEventClient.event(String, String) - inherited from base class BlockingStatsDEventClientBlockingStatsDEventClient.event(String, String, AlertType) - inherited from base class BlockingStatsDEventClientBlockingStatsDEventClient.event(String, String, long) - inherited from base class BlockingStatsDEventClientBlockingStatsDEventClient.event(String, String, Priority) - inherited from base class BlockingStatsDEventClientBlockingStatsDEventClient.event(String, String, String...) - inherited from base class BlockingStatsDEventClientevent(String, String, long, String, Priority, String, AlertType, String...) - overriding from base class BlockingStatsDEventClient and converting it to non-blockingAs part of a clean system shutdown, the stop() method should be invoked
on any StatsD clients.
clientSocket, constantTags, handler, hostname| Constructor and Description |
|---|
NonBlockingStatsDEventClient(String hostname,
int port)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDEventClient(String hostname,
int port,
String[] constantTags)
Create a new StatsD client communicating with a StatsD instance on the
specified host and port.
|
NonBlockingStatsDEventClient(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 |
event(String title,
String message,
long dateHappened,
String aggregationKey,
Priority priority,
String sourceTypeName,
AlertType alterType,
String... tags)
Reports an event to the datadog agent (non-blocking)
|
void |
stop()
Cleanly shut down this StatsD client.
|
blockingSend, event, event, event, event, event, prepareMessage, tagStringpublic NonBlockingStatsDEventClient(String hostname, int port) throws StatsDClientException
hostname - the host name of the targeted StatsD serverport - the port of the targeted StatsD serverStatsDClientException - if the client could not be startedpublic NonBlockingStatsDEventClient(String hostname, int port, String[] constantTags) throws StatsDClientException
hostname - the host name of the targeted StatsD serverport - the port of the targeted StatsD serverconstantTags - tags to be added to all content sent (each of them should be in the format key:value)StatsDClientException - if the client could not be startedpublic NonBlockingStatsDEventClient(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 serverport - the port of the targeted StatsD serverconstantTags - tags to be added to all content sent (each of them should be in the format key:value)errorHandler - handler to use when an exception occurs during usageStatsDClientException - if the client could not be startedpublic void stop()
stop in class BlockingStatsDEventClientpublic void event(String title, String message, long dateHappened, String aggregationKey, Priority priority, String sourceTypeName, AlertType alterType, String... tags)
event in class BlockingStatsDEventClienttitle - message - dateHappened - aggregationKey - priority - sourceTypeName - alterType - tags - -> Each item in this array should in the format key:valueCopyright © 2016. All rights reserved.