With v2 Custom Plugins it's possible to make use of multiple metric types. Each type is explained briefly below.
Gauge metrics are the most commonly used metric type. They're best used to capture a raw value, that can increase or decrease, at the current moment in time. For example, collecting CPU usage metrics.
Count metrics are useful to capture raw counters. If you're collecting a metric that persists values between checks you will need to calculate the delta before submitting the metric, or you could use a monotonic count metric type.
Similar to the count metrics except the agent will automatically calculate the delta between the current and previous values. Useful for understanding how much a counter is increasing by on each check run, rather than gathering the raw value of the count. If the value submitted is lower than the previous value it will be discarded, so this should only be used to capture metrics that are monotonically increasing.
The histogram metric type will calculate the statistical distribution of a set of values for you. Values are aggregated per the flush interval (currently 60s), and multiple submissions of a histogram metric in this time will cause extra metrics to also be calculated. For example, if you submit a value every second during the flush interval for my.custom.metric the following metrics will also be returned:
my.custom.metric.avg: provides the average of the submitted 60 values during the flush interval
my.custom.metric.count: provides the count of the values (60 in this instance) submitted during the flush interval
my.custom.metric.median: provides the median of the values submitted in the flush interval
my.custom.metric.95percentile: provides the 95th percentile value of the values submitted in the flush interval
my.custom.metric.max: provides the maximum value of the values submitted in the flush interval
my.custom.metric.min: provides the minimum value of the values submitted in the flush interval
The rate metric type will calculate the rate over the flush interval from a monotonically increasing counter. The rate metrics should only be submitted once per check instance and the value must be higher than the previous value seen by the agent, else it is discarded.