prometheus.Gauge.sub()
Subtracts a float value from the gauge for the specified label values.
Syntax
Note:
In this syntax diagram, the square brackets ([ ]) are part of the syntax.
sub( value FLOAT, [ labels ] )
- value is a value of type FLOAT to subtract from the gauge.
- labels labels is a comma-separated list of label names inside
square brackets that define the metric's dimensions (for example:
[method,endpoint]). A label name cannot be empty; if you don't need labels, use empty brackets[]
Usage
Use the prometheus.Gauge.sub() method to subtract a specific float value
from the gauge metric. The labels parameter must match the label definition of
the gauge.
Example
-- Define the gauge variable
DEFINE gauge prometheus.Gauge
-- Create a gauge metric
LET gauge = prometheus.Gauge.create("gauge_hello", "a gauge", ["labela", "labelb"])
-- Subtract a value from the gauge
CALL gauge.sub(2.3, ["valuea", "valueb"])