PrometheusGauge: Prometheus Gauge object

Description Methods Examples

Description

Gauges differ from Counters as they can decrease in value

Methods

Public methods


Method new()

Usage
PrometheusGauge$new(
  storage_adapter,
  name,
  help,
  namespace = NULL,
  label_names = list()
)
Arguments
storage_adapter

instance of the storage adapter to how you want to persist metrics

name

name of the gauge metric you are collecting

help

helper text to display to Prometheus

namespace

mechanism to scope gauge name

label_names

the names of the labels.

Returns

instance of PrometheusGauge Getter for the type, which will always be 'gauge'


Method getType()

Usage
PrometheusGauge$getType()
Returns

string of 'gauge' Getter for the scoped name of the gauge

This could include a concatenated namespace


Method getName()

Usage
PrometheusGauge$getName()
Returns

string of name text Getter for the helper text


Method getHelp()

Usage
PrometheusGauge$getHelp()
Returns

string of helper text Getter for the label names


Method getLabelNames()

Usage
PrometheusGauge$getLabelNames()
Returns

list of label names in the gauge Getter for an adapter usaged key to include name, namespace, and label_names


Method getKey()

Usage
PrometheusGauge$getKey()
Returns

string to uniquely identify the gauge Setter for the value of gauge


Method set()

Usage
PrometheusGauge$set(value, labels = list())
Arguments
value

value to set the gauge to

labels

list of label values, which must match to the same number of label names increment the gauge by a discrete value


Method incBy()

Usage
PrometheusGauge$incBy(value, labels = list())
Arguments
value

value to implement the gauge by

labels

list of label values, which must match to the same number of label names

Examples
my_gauge$incBy(3)
my_colors$incBy(3, list('red'))
increment the gauge by a 1


Method inc()

Usage
PrometheusGauge$inc(labels = list())
Arguments
labels

list of label values, which must match to the same number of label names

Examples
my_gauge$inc()
my_colors$inc(list('red'))
decrement the gauge by a discrete value


Method decBy()

Usage
PrometheusGauge$decBy(value, labels = list())
Arguments
value

value to decrement the gauge by. Should be a positive number

labels

list of label values, which must match to the same number of label names

Examples
my_gauge$decBy(3)
my_colors$decBy(3, list('red'))
decrement the gauge by a 1


Method dec()

Usage
PrometheusGauge$dec(labels = list())
Arguments
labels

list of label values, which must match to the same number of label names

Examples
my_gauge$dec()
my_colors$dec(list('red'))

Method clone()

The objects of this class are cloneable with this method.

Usage
PrometheusGauge$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## ------------------------------------------------
## Method `PrometheusGauge$incBy`
## ------------------------------------------------

my_gauge$incBy(3)
my_colors$incBy(3, list('red'))
increment the gauge by a 1


## ------------------------------------------------
## Method `PrometheusGauge$inc`
## ------------------------------------------------

my_gauge$inc()
my_colors$inc(list('red'))
decrement the gauge by a discrete value


## ------------------------------------------------
## Method `PrometheusGauge$decBy`
## ------------------------------------------------

my_gauge$decBy(3)
my_colors$decBy(3, list('red'))
decrement the gauge by a 1


## ------------------------------------------------
## Method `PrometheusGauge$dec`
## ------------------------------------------------

my_gauge$dec()
my_colors$dec(list('red'))

cfmack/pRometheus documentation built on Jan. 25, 2021, 3:45 a.m.