prometheusRenderShiny: Prometheus with Shiny

Description Usage Arguments Examples

View source: R/prometheusShiny.R

Description

Render the metrics and serve the '/metrics' endpoint in shiny.semantic

Usage

1
prometheusRenderShiny(app, registry)

Arguments

app

A shiny application as returned by [shiny::shinyApp()].

registry

A registry as returned by [CollectorRegistry].

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
library(shiny)

registry <<- CollectorRegistry$new()
registry$registerGauge(
 name = 'test',
 help = 'some_gauge',
 namespace = "my_space"
)

ui <- fluidPage(
 actionButton("click", "Click")
)

server <- function(input, output){
 gauge <- registry$getGauge(name = 'test', namespace = "my_space")

 observeEvent(input$click, {
   gauge$inc()
 })
}


app <- shinyApp(ui, server)

if(interactive())
 prometheusRenderShiny(app, registry)

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