Class OpenTsdbGaugeWriter

  • All Implemented Interfaces:
    GaugeWriter

    public class OpenTsdbGaugeWriter
    extends Object
    implements GaugeWriter
    A 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.
    Since:
    1.3.0
    • Constructor Detail

      • OpenTsdbGaugeWriter

        public OpenTsdbGaugeWriter()
        Creates a new OpenTsdbGaugeWriter with the default connect (10 seconds) and read (30 seconds) timeouts.
      • OpenTsdbGaugeWriter

        public OpenTsdbGaugeWriter​(int connectTimeout,
                                   int readTimeout)
        Creates a new OpenTsdbGaugeWriter with the given millisecond connectTimeout and readTimeout.
        Parameters:
        connectTimeout - the connect timeout in milliseconds
        readTimeout - 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)
      • setMediaType

        public void setMediaType​(org.springframework.http.MediaType mediaType)
      • set

        public void set​(Metric<?> value)
        Description copied from interface: GaugeWriter
        Set the value of a metric.
        Specified by:
        set in interface GaugeWriter
        Parameters:
        value - the value
      • flush

        public void flush()
        Flush the buffer without waiting for it to fill any further.