Skip to content

Commit c4e6d28

Browse files
authored
Merge pull request #269 from jnywong/cost-monitoring-users
Add how to guide for cloud costs per user dashboard
2 parents 89db308 + 1776e44 commit c4e6d28

File tree

7 files changed

+167
-120
lines changed

7 files changed

+167
-120
lines changed

admin/howto/monitoring/cost-attribution.md

Lines changed: 0 additions & 106 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# General cloud costs
2+
3+
:::{note}
4+
Available for dedicated AWS clusters only (and excluding CloudBank managed accounts). Other deployments on GCP will be supported in the future.
5+
:::
6+
7+
## Accessing the general cloud costs dashboard
8+
9+
Community Champions can view the cloud cost dashboards from their Grafana instance (please see [Grafana Dashboards](grafana-dashboards.md) for how to gain access).
10+
11+
From the main menu of Grafana, navigate to *Dashboards > Cloud cost dashboards > General cloud costs* to view the dashboard.
12+
13+
## Understanding the cloud cost dashboard
14+
15+
The dashboard is made of several panels:
16+
17+
- Daily costs
18+
- Daily costs per hub
19+
- Total daily costs per component
20+
- Daily costs per component per hub.
21+
22+
### Daily costs
23+
24+
:::{figure} images/cost-attribution-daily.png
25+
:alt: A line graph showing daily cloud costs over a 1 month period.
26+
:::
27+
28+
*Cost account* refers to the associated AWS account's *total* costs, and *Cost attributable* refers to the costs that have been *attributed* to 2i2c managed cloud infrastructure.
29+
30+
There are some costs associated with 2i2c managed cloud infrastructure that can't be attributed. For example, the act of loading the Cloud Cost dashboard itself incurs a cost that isn't attributed to 2i2c managed cloud infrastructure but forms a small part of the total cost.
31+
32+
If *Cost account* is significantly larger than *Cost attributable*, then in principle this should be because of activity unrelated to 2i2c managed cloud infrastructure. Please contact [support](/support.md) if you have any questions about understanding your cloud costs.
33+
34+
:::{note}
35+
36+
- All costs are [unblended costs](https://aws.amazon.com/blogs/aws-cloud-financial-management/understanding-your-aws-cost-datasets-a-cheat-sheet/)
37+
- All costs are pure usage costs, and doesn't account for credits etc.
38+
:::
39+
40+
### Daily costs per hub
41+
42+
:::{figure} images/cost-attribution-daily-per-hub.png
43+
:alt: A line graph showing daily cloud costs per hub over a 1 month period.
44+
:::
45+
46+
Costs can sometimes be attributed to a specific hub, and that can then be seen here. A typical 2i2c-managed deployment comprises of a staging hub and a production hub, although some other communities may have extra hubs such as a workshop hub.
47+
48+
*Cost support* reflects all 2i2c cloud infrastructure support costs that aren't attributable to a specific hub.
49+
50+
### Total daily costs per component
51+
52+
:::{figure} images/cost-attribution-component.png
53+
:alt: A time series showing daily cloud costs per component over a 1 month period.
54+
:::
55+
56+
Components are groupings of cloud-provided services, such as
57+
58+
- compute
59+
- home storage
60+
- object storage
61+
- networking
62+
- support
63+
64+
For specific definitions, see [https://github.com/2i2c-org/jupyterhub-cost-monitoring/blob/2a810989bb1c1685277d2574d3b76e673bc6e5ad/src/jupyterhub_cost_monitoring/const_cost_aws.py#L11](https://github.com/2i2c-org/jupyterhub-cost-monitoring/blob/2a810989bb1c1685277d2574d3b76e673bc6e5ad/src/jupyterhub_cost_monitoring/const_cost_aws.py#L11).
65+
66+
### Daily costs per component per hub
67+
68+
:::{figure} images/cost-attribution-component-per-hub.png
69+
:alt: A time series showing daily cloud costs per component per hub over a 1 month period.
70+
:::
71+
72+
This panel shows the same information as above, but broken down for each specific hub also.
73+
74+
## Sharing and reporting Grafana dashboards
75+
76+
See [Sharing and reporting Grafana dashboards](reporting.md) for how to share and generate reports from Grafana dashboards.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# User cloud costs
2+
3+
![Grafana dashboard with multiple panels showing stacked bar charts of user cloud costs over time.](https://raw.githubusercontent.com/2i2c-org/jupyterhub-cost-monitoring/refs/heads/main/images/dashboard.png)
4+
5+
:::{note}
6+
Available for dedicated AWS clusters only (and excluding CloudBank managed accounts). Other deployments on GCP will be supported in the future.
7+
:::
8+
9+
## Navigate to the user cloud costs dashboard
10+
11+
From the Grafana homepage, navigate to *Home > Dashboards > Cloud cost dashboards* and then click on *User cloud costs*.
12+
13+
This will load the dashboard, which may take a few moments to populate with data.
14+
15+
## Understand the dashboard layout
16+
17+
The dashboard is organized into several panels, each providing insights into different aspects of user cloud costs:
18+
19+
- **Total by Hub**: a breakdown of total costs by hub, allowing you to see which hubs are incurring the most expenses.
20+
- **Total by Component**: a breakdown of total costs by component (such as compute, home storage, etc.), helping you identify which resources are driving costs.
21+
- **Top 5 Users**: a quick at a glance view of the top 5 users by total cost over the selected time range across all hubs and components.
22+
- **Hub**: individual panels for each hub, showing daily costs by users within that hub. User costs summed over all hubs and components are shown by default. Try toggling the variable `hub` at the top of the dashboard to see splits by individual hubs or the variable `component` at the top of the dashboard to filter by specific components.
23+
24+
## Interact with the dashboard
25+
26+
You can interact with the dashboard in several ways:
27+
28+
- **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.
29+
- **Variables**: use the dropdowns at the top of the dashboard to filter data by hub or component.
30+
- **Number of users**: enter a number in the field to display the top N users by total cost over the selected time range.
31+
- **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.
32+
- **Tooltips**: hover over data points in the graphs to see detailed information, including exact cost values and timestamps of each user.
33+
34+
:::{tip}
35+
Some interactions may re-trigger additional queries to fetch data, so there may be a slight delay while the graph is updated. The latest day may not have complete data, as cloud providers often take some time to finalize daily cost data.
36+
:::
37+
38+
## Sharing and reporting Grafana dashboards
39+
40+
See [Sharing and reporting Grafana dashboards](./reporting.md) for how to share and generate reports from Grafana dashboards.
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# Grafana dashboards
22

33
:::{note}
4-
Grafana dashboards are only available to communities on **dedicated** clusters. If a community is on a shared cluster and would like to discuss transitioning, please contact [[email protected]](mailto:[email protected]).
4+
Grafana dashboards are only available to communities on **dedicated** AWS clusters (and excludes CloudBank-managed accounts). If a community is on a shared cluster and would like to discuss transitioning, please contact [[email protected]](mailto:[email protected]).
55
:::
66

7-
To discover the URL to the Grafana dashboard, use the [List of Running Hubs](https://infrastructure.2i2c.org/reference/hubs/) table. This table also shows which cluster each hub is running on.
7+
To find the URL to the Grafana dashboard for your community, use the [List of Running Hubs](https://infrastructure.2i2c.org/reference/hubs/) table.
88

9-
Note that data is retained for up to 3 years on 2i2c hubs.
9+
Note that monitoring data is retained for up to 3 years on 2i2c hubs.
1010

1111
## Getting a Grafana account
1212

13-
During the hub deployment process, 2i2c engineering will send the Hub Champions an email with an invitation link to Grafana to allow them to create an account. **This invite link only lasts for seven days;** and is unique to the recipient's email address. If a new invite link is required please contact [support](support:email) to request a new invite link.
13+
During the hub deployment process, 2i2c engineering will send Hub Champions an email with an invitation link to Grafana to create an account. **This invite link expires after seven days;** and is unique to the recipient's email address. If a new invite link is required please contact [support](support:email).
1414

1515
:::{figure} images/grafana-invite.png
1616
:alt: Screenshot of a form containing fields for email, name, username and password.
17-
The Grafana website after clicking invitation link.
17+
The Grafana website after clicking the invite link.
1818
:::
1919

20-
This Grafana account is separate from the account used to log into JupyterHub. This new account has administrative privileges and will allow Hub Champions to invite others to have access to Grafana as admins or viewers for the community. See the [instructions](https://infrastructure.2i2c.org/sre-guide/support/grafana-account) for how to invite others to join Grafana.
20+
This Grafana account is *separate* from the account used to log into JupyterHub. This new account has administrative privileges and will allow Hub Champions to invite others to access Grafana with admin or viewer roles. See the [instructions](https://infrastructure.2i2c.org/sre-guide/support/grafana-account) for how to invite others to join Grafana.
2121

2222
## Using Grafana for your JupyterHub
2323

@@ -26,10 +26,17 @@ This Grafana account is separate from the account used to log into JupyterHub. T
2626
The "Activity" Grafana dashboard.
2727
:::
2828

29-
There is work-in-progress documentation available about what each dashboard or panel represents in the upstream [JupyterHub Grafana](https://jupyterhub-grafana.readthedocs.io/en/latest/) project. You can also hover over the {octicon}`info` icon in the top-right corner of each panel for more information.
29+
There is work-in-progress documentation available about what each dashboard or panel represents in the upstream [JupyterHub Grafana Dashboards](https://jupyterhub-grafana.readthedocs.io/en/latest/) project. You can also hover over the {octicon}`info` icon in the top-right corner of each panel for more information.
3030

3131
## Making changes to Grafana dashboards
3232

33-
Changes to the `JupyterHub dashboard` directory will not persist. If changes are required on a persistent basis, we encourage you to contribute to the upstream [jupyterhub/grafana-dashboards](https://github.com/jupyterhub/grafana-dashboards) project.
33+
If you make any changes to the pre-configured dashboards in the *JupyterHub Default Dashboards* and *Cloud Cost Dashboards* folders, then they will not be saved.
3434

35-
Hub Champions are welcome to create their own custom dashboards and panel in a separate directory, but the configuration will not be backed up.
35+
We encourage you to create new dashboards outside of these folders (however the configurations will not be backed up), or even contribute to:
36+
37+
- the upstream [https://github.com/jupyterhub/grafana-dashboards](https://github.com/jupyterhub/grafana-dashboards) project for *JupyterHub Default Dashboards*
38+
- the [https://github.com/2i2c-org/jupyterhub-cost-monitoring](https://github.com/2i2c-org/jupyterhub-cost-monitoring) project for *Cloud Cost Dashboards*
39+
40+
## Resources
41+
42+
Grafana is a powerful open source data visualization tool with many features. For more information on how to use Grafana, refer to the [Grafana documentation](https://grafana.com/docs/grafana/latest/).

admin/howto/monitoring/index.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
# Usage monitoring
1+
# Usage and cost monitoring
22

33
This section describes how to monitor the usage of your hub. Note that not all features are available for all hubs – please [contact us](/support) if you would like to discuss enabling a feature for your community with us.
44

55
```{toctree}
66
:maxdepth: 1
77
grafana-dashboards
8+
cost-general
9+
cost-users
10+
reporting
811
prometheus-access
9-
cost-attribution
1012
```
13+
14+
## Feedback and support
15+
16+
If you have any feedback or suggestions on what works well or how you would like to improve usage monitoring, feel free to [open a GitHub issue](https://github.com/2i2c-org/jupyterhub-cost-monitoring/issues/new) or contact [support](/support.md)!

admin/howto/monitoring/prometheus-access.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
## Overview
44

5-
Grafana is an open-source analytics and interactive visualization web application. Prometheus is an open-source monitoring and alerting platform that collects and stores metrics as time-series data, which feeds into Grafana as a data source.
6-
7-
Grafana dashboard deployments for 2i2c hubs (k8s+JupyterHub) follow the templates outlined in the upstream [JupyterHub GitHub repository](https://github.com/jupyterhub/grafana-dashboards). Note that Prometheus data is retained for up to 3 years on 2i2c hubs.
5+
Grafana is an open-source analytics and interactive visualization web application. However the datasource is fetched from Prometheus, an open-source monitoring and alerting platform that collects and stores metrics in a time series database.
86

97
## Prerequisites
108

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Sharing and reporting Grafana dashboards
2+
3+
Grafana dashboards can be shared with other community members and stakeholders so they can understand usage and cost patterns. Community Champions can
4+
5+
- export data to a CSV file
6+
- generate a snapshot of the Grafana dashboard and share a public link
7+
- or even [Programmatically access Prometheus data](prometheus-access.md) themselves.
8+
9+
## Generate a CSV file
10+
11+
1. Click on the three dots {material-regular}`more_vert`, in the top-right corner of the panel you wish to generate a CSV file for.
12+
1. From the dropdown menu select *{octicon}`info` Inspect > Data*.
13+
1. Click on the {bdg-primary}`Download CSV` button to download the data as a CSV file.
14+
15+
## Share a snapshot of the dashboard or panel
16+
17+
This function is available to Grafana admins only. A snapshot is a frozen view of data that can with others without the need to login with a Grafana account.
18+
19+
1. If you wish to share the *entire dashboard*, click on the {bdg-primary}`Share` button to the left of the time-range selector.
20+
1. If you wish to share a *single panel*, click on the three dots {material-regular}`more_vert`, in the top-right corner of a panel. From the dropdown menu select *Share*.
21+
1. From the pop-up *Share Panel* dialog, select the *Snapshot* tab and fill out the details.
22+
1. Click the {bdg-primary}`Publish Snapshot` button to generate a public link that you can share with others.
23+
24+
:::{figure} images/cost-attribution-snapshot.png
25+
:alt: Snapshot of the share panel dialog, with Snapshot name, Expire and Timeout fields.
26+
:::

0 commit comments

Comments
 (0)