||avi.vs.analytics.gauge ( metric_name, [operation], [value] )
||Increments, decrements, sets or clears the named gauge metric.
Refer to the User-defined Metrics article for important details.
||metric_name is a string value chosen by the user to identify the gauge metric.
operation is a numeric which may take on one of four values:
value is the increment/decrement amount or desired setting of the metric. If value is not specified for these operations, it defaults to 1.
- avi.vs.analytics.INCR — Increments the gauge metric by value.
- avi.vs.analytics.DECR — Decrements the gauge metric by value. If the current value of the gauge metric is less than value, this operation resets the gauge metric to 0.
- avi.vs.analytics.SET — Sets the gauge metric to value.
- avi.vs.analytics.CLEAR — Clears the gauge metric to 0. The value parameter is ignored.
- If the operation is not specified, it defaults to avi.vs.analytics.INCR.
- The following applies to all invocations of avi.vs.analytics.gauge.
- If metric_name has never been defined, the function will define it and set the metric_type to avi.vs.analytics.METRICTYPE_GAUGE. Thereafter, the function will perform the indicated operation as modified by value.
- If metric_name has been defined before, but has a metric_type other than avi.vs.analytics.METRICTYPE_GAUGE, the function will log an error and the request/response causing this function call will be ended prematurely.
||No value returned
1. Create a gauge-type metric with name “speedo” and add 42 to it. If the gauge-type metric is not present, then create it and initialize it with default value, 0.
avi.vs.analytics.gauge(“speedo”, avi.vs.analytics.INCR, 42)
2. Increment the gauge-type metric named "speedo." by 1.