Allow configuration of stop duration metric buckets

Issue #4833 proposes allowing configuration of buckets for server spawn
duration. It was resolved with PR #4967

This follows a similar pattern to support the same kind of configuration
for server stop duration
This commit is contained in:
Srikanth Chelluri
2025-04-10 10:49:38 -04:00
parent 9fe7822098
commit 2e5fc51b6b
2 changed files with 41 additions and 8 deletions

View File

@@ -33,14 +33,19 @@ export JUPYTERHUB_METRICS_PREFIX=jupyterhub_prod
would result in the metric `jupyterhub_prod_active_users`, etc.
## Customizing spawn bucket sizes
## Customizing bucket sizes
As of JupyterHub 5.3, override `JUPYTERHUB_SERVER_SPAWN_DURATION_SECONDS_BUCKETS` env variable in Hub's environment to allow custom bucket sizes. Otherwise default to, [0.5, 1, 2.5, 5, 10, 15, 30, 60, 120, 180, 300, 600, float("inf")]
As of JupyterHub 5.3, the following environment variables in the Hub's environment can be overridden to support custom bucket sizes - below are the defaults:
| Variable | Default |
| -------------------------------------------------- | ------------------------------------------------------------------ |
| `JUPYTERHUB_SERVER_SPAWN_DURATION_SECONDS_BUCKETS` | `0.5,1,2.5,5,10,15,30,60,120,180,300,600,inf` |
| `JUPYTERHUB_SERVER_STOP_DURATION_SECONDS_BUCKETS` | `0.005,0.01,0.025,0.05,0.075,0.1,0.25,0.5,0.75,1,2.5,5,7.5,10,inf` |
For example,
```bash
export JUPYTERHUB_SERVER_SPAWN_DURATION_SECONDS_BUCKETS="1,2,4,6,12,30,60,120"
export JUPYTERHUB_SERVER_SPAWN_DURATION_SECONDS_BUCKETS="1,2,4,6,12,30,60,120,inf"
```
## Configuring metrics