Widget for app monitoring
It would be useful to have a table widget that displays a health status of a list of apps so that developers could monitor if their apps are working or not.
I believe something like this might work - check for status 200 which indicates app is working as expected, but returns 503 if there is a problem with the app curl -s -I https://<;CONNECT_SERVER_URL>/<APP_VANITY_URL>
I couldn't figure out how to get the status directly using the client. I would always get 200 status code, regardless if the content was broken (i.e. the app would say "An error has occurred. The application failed to start. Contact the author or review the logs for more information.")
I wrote a work-around that does catch these error apps (either 404 or 500 status codes), incase this is useful.
get_content_health <- function(client, guid) {
purrr::map_int(
guid,
~ httr::GET(
glue::glue("{client$server}/content/{.x}"),
httr::add_headers(Authorization = paste("Key", client$api_key))
)$status_code
)
}