R library for reading and analysing metrics stored on a Prometheus server.
You can install promR
using devtools
:
if (requireNamespace("devtools", quietly = TRUE)) { devtools::install_github('glenn-m/promR') } else { install.packages("devtools") devtools::install_github('glenn-m/promR') }
To retrieve the value of the go_goroutines
metric 60 seconds ago.
library(promR) prom <- Prometheus$new(host = "http://demo.robustperception.io", port = 9090) # Timestamps can be in rfc3339 or unix format metrics_instant <- prom$query(query = "go_goroutines", time = as.POSIXct(Sys.time() - 60))
Output:
knitr::kable(head(metrics_instant))
library(promR) prom <- Prometheus$new(host = "http://demo.robustperception.io", port = 9090) metrics_range <- prom$rangeQuery( query = "go_goroutines", start = as.numeric(as.POSIXct(Sys.time() - 600)), end = as.numeric(as.POSIXct(Sys.time())), step = "10s" )
Output:
head(metrics_range, n = 1)
library(promR) prom <- Prometheus$new(host = "http://demo.robustperception.io", port = 9090) metrics_metadata <- prom$metadataQuery(match_target = '{job="node"}')
Output:
knitr::kable(head(metrics_metadata))
library(promR) prom <- Prometheus$new(host = "http://demo.robustperception.io", port = 9090) metrics_metadata <- prom$metadataQuery(match_target = '{job=~".+"}')
Output:
knitr::kable(head(metrics_metadata))
devtools::test()
to ensure tests are passing.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.