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
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 Details
-
InfluxDbUdpSender
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
Creates a new client which sends data to given address using UDP- Parameters:
address- the address of the InfluxDb server
-
-
Method Details
-
connect
Description 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
Description copied from interface:InfluxDbSenderDisconnects from the server.- Specified by:
disconnectin interfaceInfluxDbSender- Throws:
IOException- if there is an error disconnecting
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
send
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
Description copied from interface:InfluxDbSenderFlushes buffer, if applicable- Specified by:
flushin interfaceInfluxDbSender- Throws:
IOException- if there was an error during flushing metrics to the server
-