Skip to content

Commit 7cb8bb7

Browse files
authored
docs: add group costs and api reference (#98)
* Add toc * docs: update group costs * docs: add API reference * Update symlinks
1 parent 6a1cbf2 commit 7cb8bb7

22 files changed

Lines changed: 775 additions & 81 deletions

CODE-OF-CONDUCT.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
Please refer to [Project Jupyter's Code of Conduct](https://github.com/jupyter/governance/blob/HEAD/conduct/code_of_conduct.md).
1+
# Code of Conduct
2+
3+
This project abides by [Project Jupyter's Code of Conduct](https://github.com/jupyter/governance/blob/HEAD/conduct/code_of_conduct.md).

CONTRIBUTING.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ This project uses the Python package manager `uv`. Below are the steps to set up
3434
aws sts get-session-token --serial-number $MFA_DEVICE_ID --profile $AWS_PROFILE --token-code ******
3535
```
3636

37-
1. Run the Flask web server
37+
1. Run the FastAPI web server
3838

3939
```bash
4040
cd src/jupyterhub_cost_monitoring
41-
flask run --port=8080 --reload
41+
fastapi dev app.py --port 8080
4242
```
4343

4444
1. Visit [http://127.0.0.1:8080](http://127.0.0.1:8080) to view the application.
@@ -70,3 +70,25 @@ To run tests, use `pytest`:
7070
```bash
7171
uv run pytest
7272
```
73+
74+
## Documentation
75+
76+
The documentation is built using [MySTMD](https://mystmd.org/) and hosted at [jupyterhub-cost-monitoring.readthedocs.io](https://jupyterhub-cost-monitoring.readthedocs.io/).
77+
78+
To build the documentation locally, run:
79+
80+
```bash
81+
cd docs
82+
uv run myst start
83+
```
84+
85+
To build the API documentation, download the OpenAPI specification from the FastAPI server default URL `/openapi.json` and place it in the `docs/reference` directory.
86+
87+
Install [`widdershins`](https://github.com/Mermade/widdershins) to convert this to a Markdown and name this `docs/reference/api.md`:
88+
89+
```bash
90+
npm install -g widdershins
91+
widdershins --code --summary true --user_templates api_templates openapi.json -o api.md
92+
```
93+
94+
There are custom templates in `docs/reference/api_templates` to style the output.

LICENSE renamed to LICENSE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# License
2+
13
BSD 3-Clause License
24

35
Copyright (c) 2025, 2i2c
@@ -25,4 +27,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2527
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2628
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2729
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# jupyterhub-cost-monitoring
22

3-
![Grafana dashboard with multiple panels showing stacked bar charts of user cloud costs over time.](./images/dashboard.png)
3+
![Grafana dashboard with multiple panels showing stacked bar charts of user cloud costs over time.](./images/dashboard_users.png)
44

55
Cloud cost monitoring is moving beyond just preventing runaway cost explosions – it’s about empowering JupyterHub administrators with the guardrails they need to run efficient, transparent, and sustainable infrastructures. A cloud cost bill can show a broad view of services and machines provisioned, but how can we provide granular insights into each user and the value they are deriving from the hub on an application level?
66

@@ -14,7 +14,7 @@ This tool provides a per-user cost reporting system for JupyterHubs running on A
1414

1515
## Installation
1616

17-
[Helm Chart Repository](https://2i2c.org/jupyterhub-cost-monitoring/)
17+
📦 Packaged helm charts for this project can be found at [https://2i2c.org/jupyterhub-cost-monitoring/](https://2i2c.org/jupyterhub-cost-monitoring/).
1818

1919
This project is designed to be compatible with Zero to JupyterHub distributions, making it easy to deploy in the cloud with Kubernetes.
2020

@@ -38,9 +38,11 @@ jupyterhub-cost-monitoring:
3838
value: "<name-of-cluster>"
3939
```
4040
41+
An example of configuring an AWS IAM role to talk to the AWS Cost Explorer API can be found in the [2i2c Infrastructure Guide](https://infrastructure.2i2c.org/topic/billing/cost-monitoring-system/).
42+
4143
## Documentation
4244
43-
Please refer to the documentation at [https://jupyterhub-cost-monitoring.readthedocs.io/en/latest/](https://jupyterhub-cost-monitoring.readthedocs.io/en/latest/)
45+
Documentation can be found at [https://jupyterhub-cost-monitoring.readthedocs.io/en/latest/](https://jupyterhub-cost-monitoring.readthedocs.io/en/latest/)
4446
4547
## Contributing
4648
@@ -54,4 +56,10 @@ Please refer to [`CONTRIBUTING.md`](CONTRIBUTING.md) for more details.
5456

5557
## License
5658

57-
This project is licensed under the [BSD 3-Clause License](LICENSE).
59+
This project is licensed under the [BSD 3-Clause License](LICENSE.md).
60+
61+
## Resources
62+
63+
- [Documentation](https://jupyterhub-cost-monitoring.readthedocs.io/en/latest/)
64+
- [2i2c Infrastructure Guide](https://infrastructure.2i2c.org/topic/billing/cost-monitoring-system/)
65+
- [Helm Chart Repository](https://2i2c.org/jupyterhub-cost-monitoring/)

docs/CONTRIBUTING.md

Lines changed: 0 additions & 64 deletions
This file was deleted.

docs/CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../CONTRIBUTING.md

docs/how-to/dashboard.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
1-
# Explore the Dashboard
1+
# Explore the Dashboards
22

3-
![Grafana dashboard with multiple panels showing stacked bar charts of user cloud costs over time.](../images/dashboard.png)
3+
## User cloud costs
44

5-
## Navigate to the *Cloud costs per user* dashboard
5+
![Grafana dashboard with multiple panels showing stacked bar charts of user cloud costs over time.](../images/dashboard_users.png)
6+
7+
### Navigate to the *Cloud costs per user* dashboard
68

79
From the Grafana homepage, navigate to *Home > Dashboards > Cloud cost dashboards* and then click on *Cloud costs per user*.
810

911
This will load the dashboard, which may take a few moments to populate with data.
1012

11-
## Understand the dashboard layout
13+
### Understand the user costs dashboard layout
1214

1315
The dashboard is organized into several panels, each providing insights into different aspects of user cloud costs:
1416

1517
- **Top 5 Users**: a quick at a glance view of the top 5 users by total cost over the selected time range.
1618
- **Total by Hub**: a breakdown of total costs by hub, allowing you to see which hubs are incurring the most expenses.
1719
- **Total by Component**: a breakdown of total costs by [component](../topics/components.md), helping you identify which resources are driving costs.
18-
- **Hub**: individual panels for each hub, showing daily costs by users within that hub. User costs summed over all hubs is shown by default. Try toggling the variable `hub` at the top of the dashboard to see splits by individual hubs.
19-
- **Component**: individual panels showing daily costs by users for compute and home storage. You can also toggle the variable `component` at the top of the dashboard to show or hide panels.
20+
- **Hub – Component**: daily user costs. Sums over all hubs and components are shown by default. Try toggling the variable `hub` and `component` at the top of the dashboard to filter between hubs, or home storage and compute components.
21+
22+
## Group cloud costs
23+
24+
![Grafana dashboard with multiple panels showing time series charts of group cloud costs over time.](../images/dashboard_groups.png)
25+
26+
### Understand the group costs dashboard layout
27+
28+
The Group Costs dashboard is organized into the following panels:
29+
30+
- **Total by Group**: a breakdown of total costs by user group, summed over the selected time range.
31+
- **Users with multiple group memberships**: a table of users who belong to more than one group, where their costs are double-counted in group costs.
32+
- **Users with no group memberships**: a table of users who do not belong to any group, where their costs are not attributed to any group.
33+
- **Hub – Component**: daily group costs. Sums over all hubs and components are shown by default. Try toggling the variable `hub` and `component` at the top of the dashboard to filter between hubs, or home storage and compute components.
2034

2135
## Interact with the dashboard
2236

23-
You can interact with the dashboard in several ways:
37+
You can interact with the dashboards in several ways:
2438

2539
- **Time Range**: use the time range selector in the top right corner to adjust the period for which data is displayed. The last 30 days are shown by default. The timezone is always UTC, since daily cost data prepared by cloud providers is typically settled at 00:00 UTC.
26-
- **Variables**: use the dropdowns at the top of the dashboard to filter data by hub or component.
40+
- **Variables**: use the dropdowns at the top of the dashboard to filter data by hub, component or group, or limit number of users displayed.
2741
- **Legend**: click on user names in the legend to isolate or hide specific users in the graphs. You can select multiple users by holding down the `Shift` key while clicking, and double-click to reset the selection.
2842
- **Tooltips**: hover over data points in the graphs to see detailed information, including exact cost values and timestamps of each user.
2943

docs/myst.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ project:
88
# authors: []
99
github: https://github.com/2i2c-org/jupyterhub-cost-monitoring
1010
# To autogenerate a Table of Contents, run "myst init --write-toc"
11+
toc:
12+
# Auto-generated by `myst init --write-toc`
13+
- file: README.md
14+
- title: How To
15+
children:
16+
- file: how-to/dashboard.md
17+
- title: Topics
18+
children:
19+
- file: topics/architecture.md
20+
- file: topics/components.md
21+
- file: topics/cost-calculations.md
22+
- title: Reference
23+
children:
24+
- file: reference/api.md
25+
- file: reference/License.md
26+
- file: reference/CODE-OF-CONDUCT.md
27+
- file: CONTRIBUTING.md
28+
1129
site:
1230
template: book-theme
1331
# options:

docs/reference/CODE-OF-CONDUCT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../CODE-OF-CONDUCT.md

docs/reference/License.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE.md

0 commit comments

Comments
 (0)