public class StatsdClient extends Object implements StatsdWrapper
Constructor and Description |
---|
StatsdClient(String prefix,
String hostname,
int port)
Constructs a new StatsD client.
|
Modifier and Type | Method and Description |
---|---|
static StatsdClient |
getInstance(String prefix,
String hostname,
int port) |
void |
increment(String key,
int amount)
Runs a StatsD increment in a safe way.
|
void |
newClient()
Attempts to create a new StatsD client instance, if successful then
the active client is safely swapped out.
|
void |
time(String key,
long duration)
Runs a StatsD timer state in a safe way.
|
public StatsdClient(String prefix, String hostname, int port) throws com.timgroup.statsd.StatsDClientException
prefix
- StatsD prefixhostname
- StatsD collector hostname (default localhost)port
- StatsD collector listener port (default 8125)com.timgroup.statsd.StatsDClientException
public void newClient() throws com.timgroup.statsd.StatsDClientException
com.timgroup.statsd.StatsDClientException
- if unable to refresh clientpublic static StatsdClient getInstance(String prefix, String hostname, int port)
public void increment(String key, int amount)
increment
in interface StatsdWrapper
key
- the bucket keyamount
- amount to incrementpublic void time(String key, long duration)
time
in interface StatsdWrapper
key
- the bucket keyduration
- the durationCopyright © 2016–2020. All rights reserved.