The metrics and how they are used never changes, the only thing that changes across projects is how the metrics are served.
Create the plumber API as you normally would.
1 2 3 4 5 6 7 8 9 10 11 12 13
Then use the function
prTitan as you would normally use
pr. This example here will serve the metrics but none are currently tracked.
1 2 3 4
As with shiny, titan provides an out-of-the-box metric to track:
latency. As with shiny (
latency argument defaults to
NULL meaning this is not being tracked, to turn on that tracking pass it a character string: the name of the metric.
Latency tracks the time it takes for the API to serve requests. This is tracked with a Histogram that uses predefined
buckets that put the request time in milliseconds in various bins (e.g.: 300 milliseconds, 600 milliseconds, etc.). It also uses some labels to track:
- The method used for the request, e.g.:
- The path of the request, e.g.:
- The status of the request, e.g.:
1 2 3 4