public class OpenTsdbGaugeWriter extends Object implements GaugeWriter
GaugeWriter
for the Open TSDB database (version 2.0), writing metrics to the
HTTP endpoint provided by the server. Data are buffered according to the
bufferSize
property, and only flushed automatically when
the buffer size is reached. Users should either manually flush()
after writing
a batch of data if that makes sense, or consider adding a Scheduled
task to flush periodically.Constructor and Description |
---|
OpenTsdbGaugeWriter()
Creates a new
OpenTsdbGaugeWriter with the default connect (10 seconds) and
read (30 seconds) timeouts. |
OpenTsdbGaugeWriter(int connectTimeout,
int readTimeout)
Creates a new
OpenTsdbGaugeWriter with the given millisecond
connectTimeout and readTimeout . |
Modifier and Type | Method and 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) |
public OpenTsdbGaugeWriter()
OpenTsdbGaugeWriter
with the default connect (10 seconds) and
read (30 seconds) timeouts.public OpenTsdbGaugeWriter(int connectTimeout, int readTimeout)
OpenTsdbGaugeWriter
with the given millisecond
connectTimeout
and readTimeout
.connectTimeout
- the connect timeout in millisecondsreadTimeout
- the read timeout in millisecondspublic org.springframework.web.client.RestOperations getRestTemplate()
public void setRestTemplate(org.springframework.web.client.RestOperations restTemplate)
public void setUrl(String url)
public void setBufferSize(int bufferSize)
public void setMediaType(org.springframework.http.MediaType mediaType)
public void setNamingStrategy(OpenTsdbNamingStrategy namingStrategy)
public void set(Metric<?> value)
GaugeWriter
set
in interface GaugeWriter
value
- the valuepublic void flush()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.