PrometheusCounter: Prometheus Counter implementation

Description Methods Examples

Description

These objects only increase in value

Methods

Public methods


Method new()

Usage
PrometheusCounter$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 counter metric you are collecting

help

helper text to display to Prometheus

namespace

mechanism to scope counter name

label_names

the names of the labels.

Returns

instance of PrometheusCounter Getter for the type, which will always be 'counter'


Method getType()

Usage
PrometheusCounter$getType()
Returns

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

This could include a concatenated namespace


Method getName()

Usage
PrometheusCounter$getName()
Returns

string of name text Getter for the helper text


Method getHelp()

Usage
PrometheusCounter$getHelp()
Returns

string of helper text Getter for the label names


Method getLabelNames()

Usage
PrometheusCounter$getLabelNames()
Returns

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


Method getKey()

Usage
PrometheusCounter$getKey()
Returns

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


Method set()

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

value to set the counter to

labels

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


Method incBy()

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

value to implement the counter by

labels

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

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


Method inc()

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

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

Examples
my_counter$inc()
my_colors$inc(list('red'))

Method clone()

The objects of this class are cloneable with this method.

Usage
PrometheusCounter$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
## ------------------------------------------------
## Method `PrometheusCounter$incBy`
## ------------------------------------------------

my_counter$incBy(3)
my_colors$incBy(3, list('red'))
increment the counter by a 1


## ------------------------------------------------
## Method `PrometheusCounter$inc`
## ------------------------------------------------

my_counter$inc()
my_colors$inc(list('red'))

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