Class StatsdClient
java.lang.Object
org.jenkinsci.plugins.githubautostatus.StatsdClient
- All Implemented Interfaces:
StatsdWrapper
Wraps regular UDP based StatsD client with concurrent hostname refreshing logic.
- Author:
- Tom Hadlaw (thomas.hadlaw@hootsuite.com)
-
Constructor Summary
ConstructorsConstructorDescriptionStatsdClient(String prefix, String hostname, int port) Constructs a new StatsD client. -
Method Summary
Modifier and TypeMethodDescriptionstatic StatsdClientgetInstance(String prefix, String hostname, int port) voidRuns a StatsD increment in a safe way.final voidAttempts to create a new StatsD client instance, if successful then the active client is safely swapped out.
Marked "final" so it is not considered an "overridable method used in constructor".voidRuns a StatsD timer state in a safe way.
-
Constructor Details
-
StatsdClient
public StatsdClient(String prefix, String hostname, int port) throws com.timgroup.statsd.StatsDClientException Constructs a new StatsD client.- Parameters:
prefix- StatsD prefixhostname- StatsD collector hostname (default localhost)port- StatsD collector listener port (default 8125)- Throws:
com.timgroup.statsd.StatsDClientException
-
-
Method Details
-
newClient
public final void newClient() throws com.timgroup.statsd.StatsDClientExceptionAttempts to create a new StatsD client instance, if successful then the active client is safely swapped out.
Marked "final" so it is not considered an "overridable method used in constructor".- Throws:
com.timgroup.statsd.StatsDClientException- if unable to refresh client
-
getInstance
-
increment
Runs a StatsD increment in a safe way.- Specified by:
incrementin interfaceStatsdWrapper- Parameters:
key- the bucket keyamount- amount to increment
-
time
Runs a StatsD timer state in a safe way.- Specified by:
timein interfaceStatsdWrapper- Parameters:
key- the bucket keyduration- the duration
-