Learning objectives
- Differentiate between logs and metrics.
- Log events from your code using the {log4r} package.
- Recognize some open source options for emitting metrics.
Logs and Metrics
- Logs = events as they happen.
- Metrics = measurements of how things are working.
log4r Basics
- {log4r} vs {base} vs {cli}
- {base} message/warning/error have least structure.
- {cli} adds structure for human readability.
- {log4r} adds structure that’s useful for a stream of events (timestamp, etc)
- The object created via
logger()
defines where things go & how they look.
log4r Layouts
- Alex hinted at this but didn’t dig into it.
Metrics
- Prometheus = open source monitoring tool
- Grafana = open source viz for Prometheus
- {openmetrics} = R package to add metrics to {plumber} & {shiny}
- {vetiver} = RStudio’s model deployment framework, includes metrics
- Hoping to revisit this in January (“What has changed?” meeting)
Review Discussion
- Differentiate between logs and metrics.
- Log events from your code using the {log4r} package.
- Recognize some open source options for emitting metrics.
Meeting Videos
Cohort 1