openanalytics / shinyproxy

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

grafana dashboard empty but prometheus metrics available #513

Open parisni opened 1 month ago

parisni commented 1 month ago

SP 3.1.1, docker deployment, followed tutorial there

Problem is my imported grafana dash is empty, while the prometheus endpoint returns metrics, and the prometheus database scraps it well. for eg this one:

absolute_users_logged_in{shinyproxy_instance="6e6fdf4a6cd7ae36fc486501a0ea8ee65d1a1375",shinyproxy_realm="",} 1.0

Now when doing such explore in prometheus:

absolute_users_logged_in{shinyproxy_realm="",} => returns data
absolute_users_logged_in{shinyproxy_realm=".+",} => no data

BTW the grafana source (the second query comes from it) likely expect the realm is not empty.

Is there any assumption about some values to configure so that the dash grab the metrics ?

LEDfan commented 1 month ago

Thanks for opening this issue! The dashboard indeed assume that the shinyproxy_realm variable is defined. I just updated our documentation to include this as a label in the prometheus config, see: https://www.shinyproxy.io/documentation/usage-statistics/#setup-prometheus

E.g. change your config from:

scrape_configs:
  - job_name: 'shinyproxy'
    metrics_path: '/actuator/prometheus'
    static_configs:
      # note: this is the port of ShinyProxy Actuator service, not the port of Prometheus which is by default also 9090
      - targets: [ 'localhost:9090' ]
        labels:
          namespace: local

to:

scrape_configs:
  - job_name: 'shinyproxy'
    metrics_path: '/actuator/prometheus'
    static_configs:
      # note: this is the port of ShinyProxy Actuator service, not the port of Prometheus which is by default also 9090
      - targets: [ 'localhost:9090' ]
        labels:
          namespace: local
          shinyproxy_realm: local
parisni commented 1 month ago

Makes sense. Many thx

parisni commented 1 month ago

Well now the the realm is visible. However all but apps and users panel are empty Screenshot-nparis_2024-07-31_22:35:50

LEDfan commented 1 month ago

Strange, in my test setup this is working (once I added the realm). Did you start a new app in the time period shown on the graph? The apps and users metrics are updated constantly, while the startup time is only updated if an app is started.

parisni commented 1 month ago

Yes i did restart apps. Thanks for confirming it works on your side. I will dig on my side for mistake.

parisni commented 2 weeks ago

I am afraid the dash is still 90% empty. I did import a brand new dash with the json, double checked the prometheus setup and restarted it.

  - job_name: 'test'
    metrics_path: '/actuator/prometheus'
    scheme: https
    static_configs:
    - targets: ['domain.org']
      labels:
          namespace: test
          shinyproxy_realm: test

Screenshot-nparis_2024-09-01_01:34:27