R/diagnostics.r

Defines functions kbfs_metrics kbfs_errors

Documented in kbfs_errors kbfs_metrics

#' Retrieve KBFS error log
#'
#' @return data frame of error log entries
#' @export
kbfs_errors <- function() {
  err_log <- "/keybase/.kbfs_error"
  if (file.exists(err_log)) {
    as_tibble(jsonlite::fromJSON(err_log, flatten=TRUE))
  }
}

#' Retrieve KBFS performance metrics
#'
#' TODO: Parse this into a data frame
#'
#' @export
kbfs_metrics <- function() {
  metrics <- "/keybase/.kbfs_metrics"
  if (file.exists(metrics)) {
    message("HERE")
    tmp <- readBin(metrics, "raw", file.size(metrics))
    tmp <- rawToChar(tmp)
    cat(tmp)
    invisiblke(tmp)
  }
}
hrbrmstr/keybase documentation built on May 16, 2022, 6:58 a.m.