connectwidgets icon indicating copy to clipboard operation
connectwidgets copied to clipboard

Widget for app monitoring

Open iainmwallace opened this issue 3 years ago • 1 comments

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>

iainmwallace avatar May 12 '22 13:05 iainmwallace

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
  )
}

wfulp avatar Jun 23 '22 20:06 wfulp