Description Usage Arguments Value Examples
Automatically wrap a Plumber API app, adding metrics for HTTP request count
and duration, and then expose them on a /metrics
endpoint.
The endpoint will check the METRICS_HTTP_AUTHORIZATION
environment
variable, and if present will use it as the expected
Authorization
header of the request to the /metrics
endpoint. This can be used to
implement basic HTTP authentication for access to runtime metrics.
1 | register_plumber_metrics(app, registry = global_registry())
|
app |
A Plumber router object. |
registry |
A |
A modified Plumber router.
1 2 3 4 5 6 7 8 | if (requireNamespace("plumber", quietly = TRUE)) {
app <- plumber::plumber$new() # Normally this is plumber::plumb().
app <- register_plumber_metrics(app)
## Not run:
app$run()
## End(Not run)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.