public class Wavefront extends Object implements WavefrontSender
| Constructor and Description |
|---|
Wavefront(InetSocketAddress agentAddress)
Creates a new client which connects to the given address using the default
SocketFactory. |
Wavefront(InetSocketAddress agentAddress,
SocketFactory socketFactory)
Creates a new client which connects to the given address and socket factory using the given
character set.
|
Wavefront(String agentHostName,
int port)
Creates a new client which connects to the given address using the default
SocketFactory. |
Wavefront(String agentHostName,
int port,
SocketFactory socketFactory)
Creates a new client which connects to the given address and socket factory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
connect()
Connects to the server.
|
void |
flush()
Flushes buffer, if applicable
|
int |
getFailureCount()
Returns the number of failed writes to the server.
|
boolean |
isConnected()
Returns true if ready to send data
|
void |
send(String name,
double value)
Send a measurement to Wavefront.
|
void |
send(String name,
double value,
Long timestamp)
Send a measurement to Wavefront.
|
void |
send(String name,
double value,
Long timestamp,
String source)
Send a measurement to Wavefront.
|
void |
send(String name,
double value,
Long timestamp,
String source,
Map<String,String> pointTags)
Send the given measurement to the server.
|
public Wavefront(String agentHostName, int port)
SocketFactory.agentHostName - The hostname of the Wavefront Proxy Agentport - The port of the Wavefront Proxy Agentpublic Wavefront(String agentHostName, int port, SocketFactory socketFactory)
agentHostName - The hostname of the Wavefront Proxy Agentport - The port of the Wavefront Proxy AgentsocketFactory - the socket factorypublic Wavefront(InetSocketAddress agentAddress)
SocketFactory.agentAddress - the address of the Wavefront Proxy Agentpublic Wavefront(InetSocketAddress agentAddress, SocketFactory socketFactory)
agentAddress - the address of the Wavefront Proxy AgentsocketFactory - the socket factorypublic void connect()
throws IllegalStateException,
IOException
WavefrontSenderconnect in interface WavefrontSenderIllegalStateException - if the client is already connectedIOException - if there is an error connectingpublic void send(String name, double value) throws IOException
WavefrontSendersend in interface WavefrontSendername - The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value - The value to be sent.IOException - Throws if there was an error sending the metric.UnknownHostException - Throws if there's an error determining the current host.public void send(String name, double value, @Nullable Long timestamp) throws IOException
WavefrontSendersend in interface WavefrontSendername - The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value - The value to be sent.timestamp - The timestamp in seconds since the epoch to be sent.IOException - Throws if there was an error sending the metric.UnknownHostException - Throws if there's an error determining the current host.public void send(String name, double value, @Nullable Long timestamp, String source) throws IOException
WavefrontSendersend in interface WavefrontSendername - The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value - The value to be sent.timestamp - The timestamp in seconds since the epoch to be sent.source - The source (or host) that's sending the metric.IOException - if there was an error sending the metric.public void send(String name, double value, @Nullable Long timestamp, String source, @Nullable Map<String,String> pointTags) throws IOException
WavefrontSendersend in interface WavefrontSendername - The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
escaped.value - The value to be sent.timestamp - The timestamp in seconds since the epoch to be sent. Null to use agent assigned timestamp.source - The source (or host) that's sending the metric. Null to use machine hostname.pointTags - The point tags associated with this measurement.IOException - if there was an error sending the metric.public boolean isConnected()
WavefrontSenderisConnected in interface WavefrontSenderpublic int getFailureCount()
WavefrontSendergetFailureCount in interface WavefrontSenderpublic void flush()
throws IOException
WavefrontSenderflush in interface WavefrontSenderIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2016. All rights reserved.