prometheus.Gauge.add()

Adds a float value to the gauge for the specified label values.

Syntax

Note:

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

add( value FLOAT, [ labels ] )
  1. value is a value of type FLOAT to add to the gauge.
  2. 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.add() method to add a specific float value to the gauge metric. The label values change from one call to the next. For example, with the label name ["category"] declared, add(3, ["books"]) adds to the level recorded for that category.

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"])
-- Add a value to the gauge
CALL gauge.add(3, ["books"])