Package com.appoptics.api.ext
Class Metrics
- java.lang.Object
-
- com.appoptics.api.ext.Metrics
-
public class Metrics extends java.lang.Object
API for recording custom metrics. Recorded metrics will be aggregated and submitted periodically
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HOST_TAG_KEY
-
Constructor Summary
Constructors Constructor Description Metrics()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
incrementMetric(java.lang.String name, int count, boolean addHostTag, java.util.Map<java.lang.String,java.lang.String> tags)
Records a Count metrics that increments by the count parameter Count metrics will be aggregated by the key- combination of metric name and tags, with a count (sum of count from each call with same key).static void
incrementMetric(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> tags)
Records a Count Metrics that increments by 1 Count metrics will be aggregated by the key- combination of metric name and tags, with a count (sum of count from each call with same key, default as 1).static void
summaryMetric(java.lang.String name, double value, int count, boolean addHostTag, java.util.Map<java.lang.String,java.lang.String> tags)
Records a Summary Metric which consists of a single value and a count.static void
summaryMetric(java.lang.String name, double value, java.util.Map<java.lang.String,java.lang.String> tags)
Records a Summary Metric which consists of a single value.
-
-
-
Field Detail
-
HOST_TAG_KEY
public static final java.lang.String HOST_TAG_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
summaryMetric
public static void summaryMetric(java.lang.String name, double value, java.util.Map<java.lang.String,java.lang.String> tags)
Records a Summary Metric which consists of a single value. Summary metrics will be aggregated by the key- combination of metric name and tags, with a sum (sum of value from each call with same key), and a count (sum of count from each call with same key, with by default is 1 per call).- Parameters:
name
- a custom name for this Summary Metricvalue
- a double value for this Summary Metrictags
- a Map of custom tags for this Summary Metric
-
summaryMetric
public static void summaryMetric(java.lang.String name, double value, int count, boolean addHostTag, java.util.Map<java.lang.String,java.lang.String> tags)
Records a Summary Metric which consists of a single value and a count. Summary metrics will be aggregated by the key- combination of metric name and tags, with a sum (sum of value from each call with same key), and a count (sum of count from each call with same key). This is a more efficient method to record metrics with same key. For example, if a Summary Metric is to be recorded for an operation performed repeatedly, then a total duration can be first accumulated with a count and passed to this method once instead of calling this repeatedly for each operation.- Parameters:
name
- a custom name for this Summary Metricvalue
- a double value for this Summary Metric, take note that this should be an accumulative value if count is greater than 1count
- a count of measured operations that produce the accumulative valueaddHostTag
- whether tag the Summary Metric with host informationtags
- a Map of custom tags for this Summary Metric
-
incrementMetric
public static void incrementMetric(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> tags)
Records a Count Metrics that increments by 1 Count metrics will be aggregated by the key- combination of metric name and tags, with a count (sum of count from each call with same key, default as 1).- Parameters:
name
- a custom name for this Count Metrictags
- a Map of custom tags for Count Metric
-
incrementMetric
public static void incrementMetric(java.lang.String name, int count, boolean addHostTag, java.util.Map<java.lang.String,java.lang.String> tags)
Records a Count metrics that increments by the count parameter Count metrics will be aggregated by the key- combination of metric name and tags, with a count (sum of count from each call with same key). This is a more efficient method to record metrics with same key. For example, if a Count Metric is to be recorded for an operation performed repeatedly, then an accumulated count can be passed to this method once instead of calling this repeatedly for each operation.- Parameters:
name
- a custom name for this Count Metriccount
- a accumulative count of operationsaddHostTag
- whether tag the Count Metric with host informationtags
- a Map of custom tags for Count Metric
-
-