public class GraphiteUDP extends Object implements GraphiteSender
| Constructor and Description |
|---|
GraphiteUDP(InetSocketAddress address)
Creates a new client which sends data to given address using UDP
|
GraphiteUDP(String hostname,
int port)
Creates a new client which sends data to given address using UDP
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
connect()
Connects to the server.
|
void |
flush()
Flushes buffer, if applicable
|
int |
getFailures()
Returns the number of failed writes to the server.
|
boolean |
isConnected()
Returns true if ready to send data
|
protected String |
sanitize(String s) |
void |
send(String name,
String value,
long timestamp)
Sends the given measurement to the server.
|
public GraphiteUDP(String hostname, int port)
hostname - The hostname of the Carbon serverport - The port of the Carbon serverpublic GraphiteUDP(InetSocketAddress address)
address - the address of the Carbon serverpublic void connect()
throws IllegalStateException,
IOException
GraphiteSenderconnect in interface GraphiteSenderIllegalStateException - if the client is already connectedIOException - if there is an error connectingpublic boolean isConnected()
GraphiteSenderisConnected in interface GraphiteSenderpublic void send(String name, String value, long timestamp) throws IOException
GraphiteSendersend in interface GraphiteSendername - the name of the metricvalue - the value of the metrictimestamp - the timestamp of the metricIOException - if there was an error sending the metricpublic int getFailures()
GraphiteSendergetFailures in interface GraphiteSenderpublic void flush()
throws IOException
GraphiteSenderflush in interface GraphiteSenderIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2017. All Rights Reserved.