Package com.izettle.metrics.influxdb
Class InfluxDbHttpSender
- java.lang.Object
-
- com.izettle.metrics.influxdb.InfluxDbHttpSender
-
- All Implemented Interfaces:
InfluxDbSender
- Direct Known Subclasses:
GroupedInfluxDbHttpSender
public class InfluxDbHttpSender extends Object
An implementation of InfluxDbSender that writes to InfluxDb via http.
-
-
Constructor Summary
Constructors Constructor Description InfluxDbHttpSender(String protocol, String hostname, int port, String database, String authString, TimeUnit timePrecision)Deprecated.InfluxDbHttpSender(String protocol, String hostname, int port, String database, String authString, TimeUnit timePrecision, int connectTimeout, int readTimeout, String measurementPrefix)Creates a new http sender given connection details.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendPoints(InfluxDbPoint point)Adds this metric point to the buffer.voidflush()Flushes buffer, if applicable.protected InfluxDbWriteObjectSerializergetSerializer()Map<String,String>getTags()protected InfluxDbWriteObjectgetWriteObject()booleanhasSeriesData()voidsetTags(Map<String,String> tags)Set tags applicable for all the points.intwriteData()Writes buffer data to InfluxDb.protected intwriteData(byte[] line)
-
-
-
Constructor Detail
-
InfluxDbHttpSender
public InfluxDbHttpSender(String protocol, String hostname, int port, String database, String authString, TimeUnit timePrecision, int connectTimeout, int readTimeout, String measurementPrefix) throws Exception
Creates a new http sender given connection details.- Parameters:
hostname- the influxDb hostnameport- the influxDb http portdatabase- the influxDb database to write toauthString- the authorization string to be used to connect to InfluxDb, of format username:passwordtimePrecision- the time precision of the metricsconnectTimeout- the connect timeoutreadTimeout- the read timeout- Throws:
Exception- exception while creating the influxDb sender(MalformedURLException)
-
-
Method Detail
-
flush
public void flush()
Description copied from interface:InfluxDbSenderFlushes buffer, if applicable.- Specified by:
flushin interfaceInfluxDbSender
-
hasSeriesData
public boolean hasSeriesData()
- Specified by:
hasSeriesDatain interfaceInfluxDbSender- Returns:
- true if there is data available to send.
-
appendPoints
public void appendPoints(InfluxDbPoint point)
Description copied from interface:InfluxDbSenderAdds this metric point to the buffer.- Specified by:
appendPointsin interfaceInfluxDbSender- Parameters:
point- metric point with tags and fields
-
writeData
public int writeData() throws ExceptionDescription copied from interface:InfluxDbSenderWrites buffer data to InfluxDb.- Specified by:
writeDatain interfaceInfluxDbSender- Returns:
- the response code for the request sent to InfluxDb.
- Throws:
Exception- exception while writing to InfluxDb api
-
setTags
public void setTags(Map<String,String> tags)
Description copied from interface:InfluxDbSenderSet tags applicable for all the points.- Specified by:
setTagsin interfaceInfluxDbSender- Parameters:
tags- map containing tags common to all metrics
-
getTags
public Map<String,String> getTags()
- Specified by:
getTagsin interfaceInfluxDbSender
-
getWriteObject
protected InfluxDbWriteObject getWriteObject()
-
getSerializer
protected InfluxDbWriteObjectSerializer getSerializer()
-
-