prometheus.Gauge.set()

Sets the gauge to a specific float value for the specified label values.

Syntax

Note:

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

set( value FLOAT, [ labels ] )
  1. value sets the gauge to a value of type FLOAT.
  2. 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.set() method to set the gauge metric to a specific float value. 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"])
-- Set the gauge to a value
CALL gauge.set(4.2, ["valuea", "valueb"])