Object -
observe
:
Gauge
This represents the metric type - gauge, that can hold instantaneous, increased or decreased value during the usage.
Constructor
__init
(string name, string? desc, map? tags, StatisticConfig[]? statisticConfig)
- name string
-
Name of the Gauge instance.
- desc string? <string?>
-
Description of the Gauge instance. If no description is provided, the the default empty string will be used.
- tags map? <map<string>?> ()
-
The key/value pair of Tags. If no tags are provided, the default nil value will be used.
- statisticConfig StatisticConfig[]? <ballerina/observe:StatisticConfig[]?> ()
-
Statistics configurations array is used for statistics calculation. In case if empty statistics configurations array is passed, then statistics calculation will be disabled. If nil () is passed, then default statistics configs will be used for the statitics calculation.
Methods
Fields
- name string
-
Name of the counter metric.
- description string
-
Description of the counter metric.
- metricTags map
-
Tags associated with the counter metric.
- statisticConfigs StatisticConfig[]
-
Array of StatisticConfig objects which defines about the statistical calculation of the gauge during its usage.
-
Return Type
(error?) Returns error if there is any metric registered already with the same name but different parameters or in a different kind.
Parameters
- amount float (default 1.0)
-
The amount by which the value of gauge needs to be increased. The amount is defaulted as 1.0 and will be used if there is no amount passed in.
Parameters
- amount float (default 1.0)
-
The amount by which the value of gauge needs to be decreased. The amount is defaulted as 1.0 and will be used if there is no amount passed in.
Parameters
- amount float
-
The instantaneous value that needs to be set as gauge value.
-
Return Type
(float) The current value of the gauge.