DataScript: avi.vs.analytics.get_metric

DataScript

Function avi.vs.analytics.get_metric ( metric_name, metric_type )
Description Returns the value of the metric, be it of type counter or gauge. Before doing so, the function first checks if metric_name has been defined. If it has, it then compares the value of metric_type to the type previously stored. If metric_name has never been defined, or the type is not correct, the function will report an error on the log and the request/response causing this function call will be aborted.

Refer to the User-defined Metrics article for important details.
Events HTTP_REQ
HTTP_RESP
RESP_FAILED
Parameter metric_name is a string value chosen by the user to identify the metric.

metric_type is a numeric parameter to be set by making a symbolic reference to avi.vs.analytics.METRICTYPE_GAUGE or avi.vs.analytics.METRICTYPE_COUNTER.
Returns The value of the metric
Related avi.vs.analytics.counter(), avi.vs.analytics.gauge()
Example Set goo-current-val to the current value of a counter-type metric named "goo," if it exists.

goo-current-val = avi.vs.analytics.get_metric ("goo", avi.vs.analytics.METRICTYPE_COUNTER)