Class OpenTsdbGaugeWriter
- java.lang.Object
- org.springframework.boot.actuate.metrics.opentsdb.OpenTsdbGaugeWriter
- All Implemented Interfaces:
GaugeWriter
public class OpenTsdbGaugeWriter extends Object implements GaugeWriter
AGaugeWriter
for the Open TSDB database (version 2.0), writing metrics to the HTTP endpoint provided by the server. Data are buffered according to thebufferSize
property, and only flushed automatically when the buffer size is reached. Users should either manuallyflush()
after writing a batch of data if that makes sense, or consider adding aScheduled
task to flush periodically.- Since:
- 1.3.0
Constructor Summary
Constructors Constructor Description OpenTsdbGaugeWriter()
Creates a newOpenTsdbGaugeWriter
with the default connect (10 seconds) and read (30 seconds) timeouts.OpenTsdbGaugeWriter(int connectTimeout, int readTimeout)
Creates a newOpenTsdbGaugeWriter
with the given millisecondconnectTimeout
andreadTimeout
.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
flush()
Flush the buffer without waiting for it to fill any further.org.springframework.web.client.RestOperations
getRestTemplate()
void
set(Metric<?> value)
Set the value of a metric.void
setBufferSize(int bufferSize)
void
setMediaType(org.springframework.http.MediaType mediaType)
void
setNamingStrategy(OpenTsdbNamingStrategy namingStrategy)
void
setRestTemplate(org.springframework.web.client.RestOperations restTemplate)
void
setUrl(String url)
Constructor Detail
OpenTsdbGaugeWriter
public OpenTsdbGaugeWriter()
Creates a newOpenTsdbGaugeWriter
with the default connect (10 seconds) and read (30 seconds) timeouts.
OpenTsdbGaugeWriter
public OpenTsdbGaugeWriter(int connectTimeout, int readTimeout)
Creates a newOpenTsdbGaugeWriter
with the given millisecondconnectTimeout
andreadTimeout
.- Parameters:
connectTimeout
- the connect timeout in millisecondsreadTimeout
- the read timeout in milliseconds
Method Detail
getRestTemplate
public org.springframework.web.client.RestOperations getRestTemplate()
setRestTemplate
public void setRestTemplate(org.springframework.web.client.RestOperations restTemplate)
setBufferSize
public void setBufferSize(int bufferSize)
setMediaType
public void setMediaType(org.springframework.http.MediaType mediaType)
setNamingStrategy
public void setNamingStrategy(OpenTsdbNamingStrategy namingStrategy)
set
public void set(Metric<?> value)
Description copied from interface:GaugeWriter
Set the value of a metric.- Specified by:
set
in interfaceGaugeWriter
- Parameters:
value
- the value
flush
public void flush()
Flush the buffer without waiting for it to fill any further.