Classic data object to encapsulate a sampling of a metric. You likely will not interact witht this object
new()
PrometheusSample$new(name, value, label_names = list(), label_values = list())
name
name of the sample, combined in other functions or R6 objects with namespace
value
the actual value of the sample
label_names
the name of the labels being passed in
label_values
the actual values of the labels. This must be UTF-8 encoded and the same number of labels
instance of PrometheusSample
sample <- PrometheusSample$new("sample name", 10) Getter for the sample name
getName()
PrometheusSample$getName()
fully qualified name of the sample
sample <- PrometheusSample$new("sample name", 10) print(sample$getName()) # 'sample name' Getter for the label names
getLabelNames()
PrometheusSample$getLabelNames()
list of label names in the sample Getter for the label values
getLabelValues()
PrometheusSample$getLabelValues()
list of label values in the sample Getter for the sample value
getValue()
PrometheusSample$getValue()
list of sample values in the sample Setter for the sample value
setValue()
PrometheusSample$setValue(val)
val
value to actually set
self Helper function to check if this sample has labels by checking label names
hasLabelNames()
PrometheusSample$hasLabelNames()
bool if sample has label_names
sample <- PrometheusSample$new("sample name", 10, list("colors"), list("red")) sample$hasLabelNames() # TRUE
clone()
The objects of this class are cloneable with this method.
PrometheusSample$clone(deep = FALSE)
deep
Whether to make a deep clone.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## ------------------------------------------------
## Method `PrometheusSample$new`
## ------------------------------------------------
sample <- PrometheusSample$new("sample name", 10)
Getter for the sample name
## ------------------------------------------------
## Method `PrometheusSample$getName`
## ------------------------------------------------
sample <- PrometheusSample$new("sample name", 10)
print(sample$getName()) # 'sample name'
Getter for the label names
## ------------------------------------------------
## Method `PrometheusSample$hasLabelNames`
## ------------------------------------------------
sample <- PrometheusSample$new("sample name", 10, list("colors"), list("red"))
sample$hasLabelNames() # TRUE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.