prometheus.Gauge.dec()

Decreases the gauge by one for the specified label values.

Syntax

Note:

In this syntax diagram, the square brackets ([ ]) are part of the syntax.

dec( [ labels ] )
  1. labels is a comma-separated list of label values inside square brackets, one for each label name declared when the metric was created, in the same order. Where the metric declares no label names, use empty brackets [].

Usage

Use the prometheus.Gauge.dec() method to decrement the value of a gauge metric by one. This is typically used to track resource levels that can increase and decrease. The label values change from one call to the next. For example, with the label name ["category"] declared, dec(["books"]) decreases the level recorded for that category by one.

Example


-- Define the gauge variable
DEFINE gauge prometheus.Gauge
-- Create a gauge metric
LET gauge = prometheus.Gauge.create("gauge_basket_items", "items in the basket",
                                    ["category"])
-- Decrement the gauge
CALL gauge.dec(["books"])