Package io.dropwizard.metrics5.influxdb
Class InfluxDbUdpSender
- java.lang.Object
-
- io.dropwizard.metrics5.influxdb.InfluxDbUdpSender
-
- All Implemented Interfaces:
InfluxDbSender,Closeable,AutoCloseable
public class InfluxDbUdpSender extends Object implements InfluxDbSender
-
-
Constructor Summary
Constructors Constructor Description InfluxDbUdpSender(String hostname, int port)Creates a new client which sends data to given address using UDPInfluxDbUdpSender(InetSocketAddress address)Creates a new client which sends data to given address using UDP
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidconnect()Connects to the server.voiddisconnect()Disconnects from the server.voidflush()Flushes buffer, if applicablebooleanisConnected()Returns true if ready to send datavoidsend(StringBuilder str)Sends the given measurement to the server.
-
-
-
Constructor Detail
-
InfluxDbUdpSender
public InfluxDbUdpSender(String hostname, int port)
Creates a new client which sends data to given address using UDP- Parameters:
hostname- The hostname of the InfluxDb serverport- The port of the InfluxDb server
-
InfluxDbUdpSender
public InfluxDbUdpSender(InetSocketAddress address)
Creates a new client which sends data to given address using UDP- Parameters:
address- the address of the InfluxDb server
-
-
Method Detail
-
connect
public void connect() throws IllegalStateException, IOExceptionDescription copied from interface:InfluxDbSenderConnects to the server.- Specified by:
connectin interfaceInfluxDbSender- Throws:
IllegalStateException- if the client is already connectedIOException- if there is an error connecting
-
isConnected
public boolean isConnected()
Description copied from interface:InfluxDbSenderReturns true if ready to send data- Specified by:
isConnectedin interfaceInfluxDbSender
-
disconnect
public void disconnect() throws IOExceptionDescription copied from interface:InfluxDbSenderDisconnects from the server.- Specified by:
disconnectin interfaceInfluxDbSender- Throws:
IOException- if there is an error disconnecting
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
send
public void send(StringBuilder str) throws IOException
Description copied from interface:InfluxDbSenderSends the given measurement to the server.NOTE: The caller may modify the
measurementbuffer after this call. The implementation of this method MUST NOT keep any reference to the buffer after this call.- Specified by:
sendin interfaceInfluxDbSender- Parameters:
str- a single measurement line, according to the InfluxDb line protocol including a trailing newline.- Throws:
IOException- if there was an error sending the metric
-
flush
public void flush() throws IOExceptionDescription copied from interface:InfluxDbSenderFlushes buffer, if applicable- Specified by:
flushin interfaceInfluxDbSender- Throws:
IOException- if there was an error during flushing metrics to the server
-
-