Class MetricBuilder


  • public class MetricBuilder
    extends Object
    Builder used to create the JSON to push metrics to KairosDB.
    • Method Detail

      • getInstance

        public static MetricBuilder getInstance()
        Returns a new metric builder.
        Returns:
        metric builder
      • addMetric

        public Metric addMetric​(String metricName)
        Adds a metric to the builder.
        Parameters:
        metricName - metric name
        Returns:
        the new metric
      • addMetric

        public Metric addMetric​(String metricName,
                                String registeredType)
        Adds a metric to the builder with a customer type.
        Parameters:
        metricName - metric name
        registeredType - type used to deserialize the json on the server
        Returns:
        the new metric
      • getMetrics

        public List<Metric> getMetrics()
        Returns a list of metrics added to the builder.
        Returns:
        list of metrics
      • setCompression

        public void setCompression​(boolean compressionEnabled)
        Sets the compression flag for http post.
        Parameters:
        compressionEnabled - compresss post data
      • isCompressionEnabled

        public boolean isCompressionEnabled()
        Returns the compression flag
        Returns:
        return whether compression is being used
      • build

        public String build()
        Returns the JSON string built by the builder. This is the JSON that can be used by the client add metrics.
        Returns:
        JSON