openanalytics / shinyproxy

ShinyProxy - Open Source Enterprise Deployment for Shiny and data science apps
https://www.shinyproxy.io
Apache License 2.0
525 stars 152 forks source link

Actuator prometheus endpoint always returns zero appCrashes #536

Open adambondarzewski opened 6 days ago

adambondarzewski commented 6 days ago

I've configured Shinyproxy actuator endpoint, to get Usage Statistics following the official readme.

Then I've checked localhost:9090/actuator/prometheus and I've noticed that appCrash_total counter continues to show 0.0 even though I delibaretely crashed the app several times to check the setup. The crashes resulted in greying the app and stopping the app container. In the same time, other statistics like absolute_users_logged_in or startFailed_total are correct:

# HELP appCrashes_total  
# TYPE appCrashes_total counter
appCrashes_total{shinyproxy_instance="5f79677a427ad7226f7a97995600a89a528e9906",shinyproxy_realm="",spec_id="myapp",} 0.0
# HELP startFailed_total  
# TYPE startFailed_total counter
startFailed_total{shinyproxy_instance="5f79677a427ad7226f7a97995600a89a528e9906",shinyproxy_realm="",spec_id="myapp",} 5.0

Am I missing something obvious?

My application.yaml:

proxy:
  title:
  favicon-path: favicon.png
  landing-page: /app/myapp
  heartbeat-rate: 1000000
  heartbeat-timeout: 6000000
  container-wait-time: 240000
  port: 8080
  hide-navbar: true
  authentication: openid
  openid:
  ...
  docker:
    internal-networking: true
  specs:
      ...
      container-cmd:
        [
          "R",
          "-s",
          "-e",
          "library(shiny); library(shinyjs); library(shinydashboard); library(readr); library(magrittr); library(dplyr); myApp::start(options=list(host='0.0.0.0', port = 3838L))",
        ]
  usage-stats-url: micrometer
server:
  servlet.session.timeout: 0
  servlet.context-path: ${CONTEXT_PATH:-/}
  forward-headers-strategy: native
  secureCookies: ${SECURE_COOKIE}
management:
  prometheus:
    metrics:
      export:
        enabled: true
LEDfan commented 1 day ago

Hi, the appCrash_total metric will only be increased if ShinyProxy is aware of the crash. In this case, ShinyProxy shows the following screen:

image

and also logs this message:

Proxy unreachable/crashed, stopping it now, failed request: GET ...

Can you confirm whether you see this behavior?

adambondarzewski commented 1 day ago

Thanks for the response! Indeed I don't see this screen. Just greying the app and error message in the app container logs.

adambondarzewski commented 14 hours ago

I've double checked and I can confirm that I don't see the "This app has crashed..." screen nor any indication in shinyproxy logs. Last log is something like

2024-11-13T11:27:42.608Z  INFO 9 --- [ProxyService-15] e.o.containerproxy.service.ProxyService  : [user=adam.bondarzewski@company.com proxyId=35bd385c-7b08-4921-bafe-13759239adef specId=myapp] Proxy activated

Could you please advice how to make shinyproxy aware of the crashes? I'm using a setup with docker (one container per user, without preinitialization). The container is still up after the crash. I just see error message in the app container logs.