# \[Feature request\] More useful metrics collected by JupyterHub

**URL:** <https://discourse.jupyter.org/t/feature-request-more-useful-metrics-collected-by-jupyterhub/14632>\
**Category:** JupyterHub\
**Tags:** feature-idea\
**Created:** [June 16, 2022, 11:50pm UTC](https://discourse.jupyter.org/t/feature-request-more-useful-metrics-collected-by-jupyterhub/14632 "2022-06-16T23:50:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktaletsk](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/ktaletsk/32/528_2.png) [@ktaletsk](https://discourse.jupyter.org/u/ktaletsk)\
**Post date:** [June 16, 2022, 11:50pm UTC](https://discourse.jupyter.org/t/feature-request-more-useful-metrics-collected-by-jupyterhub/14632/1 "2022-06-16T23:50:02Z")

</div>

Hi everyone, I would like to create a feature request and help in developing it.

As a developer and maintainer of our organization JupyterHub, I am interested in collecting more useful data about our Hub, which can justify the development and cloud costs dedicated to the project. Currently, I found 2 very useful metrics collected by JupyterHub: total number of registered users and number of currently running servers. I wish to know, for example, the number of currently active (logged in) users, distribution of server lifetimes and many more. I can also see that there are plans on the [roadmap](https://github.com/jupyterhub/jupyterhub/blob/6be3160d7487bb362df7095f24454ef2814951fc/docs/source/contributing/roadmap.md#soon) to have more resource tracking inside servers as well.

In that vein, I would like to ask the community, if someone already working on that, and if not, to get some pointers to get me started developing that. In particular, I would be glad for any recommendations on how to start implementing the number of currently active users metric.

---

<div class="post-metadata">

**Author:** ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)\
**Post date:** [June 17, 2022, 12:33pm UTC](https://discourse.jupyter.org/t/feature-request-more-useful-metrics-collected-by-jupyterhub/14632/2 "2022-06-17T12:33:14Z")

</div>

JupyterHub is very flexible and highly customisable, so some of those stats depend on what’s offered by the underlying platform. JupyterHub could gather some standard metrics, but for now I think the easiest solution is to leverage your base infrstructure.

For example, if you’re using Kubernetes you can use Prometheus/Grafana to build dashboards visualising the current pods/user, resource consumption, storage, etc, in much more detail than would be possible with a generic set of JupyterHub metrics. If you’re using JupyterHub on HPC you should be able to get stats from your cluster management system.

---

<div class="post-metadata">

**Author:** ![ktaletsk](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/ktaletsk/32/528_2.png) [@ktaletsk](https://discourse.jupyter.org/u/ktaletsk)\
**Post date:** [June 17, 2022, 3:57pm UTC](https://discourse.jupyter.org/t/feature-request-more-useful-metrics-collected-by-jupyterhub/14632/3 "2022-06-17T15:57:02Z")

</div>

@manics thanks for the reply! If using kubespawner on k8s + Prometheus/Grafana stack, how would I get the gauge for the number of unique active users, given that they can run multilple servers at a time. I can only think of running some regexp on pod names and trying to count unique usernames in the list of Jupyter pods.  
If someone have solved this problem, I would be interested to know the approach

---

<div class="post-metadata">

**Author:** ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)\
**Post date:** [June 17, 2022, 8:06pm UTC](https://discourse.jupyter.org/t/feature-request-more-useful-metrics-collected-by-jupyterhub/14632/4 "2022-06-17T20:06:55Z")

</div>

Yes, going through the pod metrics and matching/grouping/aggregating by labels will get you the most useful information, especially as you’ll see the resource usage of each pod

There are some example Grafana dashboards you could extend in

> **[GitHub - jupyterhub/grafana-dashboards: Grafana Dashboards useful for k8s +...](https://github.com/jupyterhub/grafana-dashboards)**
>
> Grafana Dashboards useful for k8s + JupyterHub. Contribute to jupyterhub/grafana-dashboards development by creating an account on GitHub.
