Skip to content
This repository was archived by the owner on Jun 22, 2021. It is now read-only.

Commit 852da0b

Browse files
committed
Scrape notebook & hub prometheus metrics
- /metrics now responds with prometheus metrics, rather than nbresuse metrics (jupyter-server/jupyter-resource-usage#68) - Notebook Server's /metrics endpoint is now available without authentication, so prometheus can scrape those metrics (jupyter/notebook#5870) - Annotations are set up on the user pods to tell prometheus the port and path to scrape. - NetworkPolicy is set up to allow prometheus server to hit the singleuser server and the hub pods. Note that this required manually editing netpol in prometheus - should add that feature to the prometheus chart.
1 parent 3cbc52e commit 852da0b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

hub/values.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ etcJupyter:
1919
# https://github.com/jupyter/jupyter/issues/174
2020
# https://github.com/ipython/ipython/issues/9163
2121
db_file: ":memory:"
22+
NotebookApp:
23+
authenticate_prometheus: false
24+
ResourceUseDisplay:
25+
disable_legacy_endpoint: true
2226

2327
nfsPVC:
2428
enabled: true
@@ -114,6 +118,10 @@ jupyterhub:
114118
SHELL: /bin/bash
115119
startTimeout: 600 # 10 mins, because sometimes we have too many new nodes coming up together
116120
defaultUrl: /tree
121+
extraAnnotations:
122+
prometheus.io/scrape: "true"
123+
prometheus.io/path: "/user/{username}/metrics"
124+
prometheus.io/port: "8888"
117125
networkPolicy:
118126
# In clusters with NetworkPolicy enabled, do not
119127
# allow outbound internet access that's not DNS, FTP, HTTP or HTTPS
@@ -134,6 +142,20 @@ jupyterhub:
134142
# Allow FTP access https://github.com/berkeley-dsep-infra/datahub/issues/1789
135143
- port: 21
136144
protocol: TCP
145+
# Allow ingress from promethetheus scraper in support namespace
146+
# This lets us get notebook metrics!
147+
ingress:
148+
- ports:
149+
- port: 8888
150+
protocol: TCP
151+
from:
152+
- namespaceSelector:
153+
matchLabels:
154+
name: support
155+
podSelector:
156+
matchLabels:
157+
app: prometheus
158+
component: server
137159
auth:
138160
google:
139161
hostedDomain: [berkeley.edu]
@@ -161,6 +183,13 @@ jupyterhub:
161183
- namespaceSelector:
162184
matchLabels:
163185
name: support
186+
podSelector:
187+
matchLabels:
188+
app: prometheus
189+
component: server
190+
ports:
191+
- port: http
192+
protocol: TCP
164193
livenessProbe:
165194
enabled: true
166195
initialDelaySeconds: 180

0 commit comments

Comments
 (0)