Package org.kairosdb.client.builder
Class MetricBuilder
- java.lang.Object
-
- org.kairosdb.client.builder.MetricBuilder
-
public class MetricBuilder extends Object
Builder used to create the JSON to push metrics to KairosDB.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MetricaddMetric(String metricName)Adds a metric to the builder.MetricaddMetric(String metricName, String registeredType)Adds a metric to the builder with a customer type.Stringbuild()Returns the JSON string built by the builder.static MetricBuildergetInstance()Returns a new metric builder.List<Metric>getMetrics()Returns a list of metrics added to the builder.booleanisCompressionEnabled()Returns the compression flagvoidsetCompression(boolean compressionEnabled)Sets the compression flag for http post.
-
-
-
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 nameregisteredType- 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
-
-