Skip to content

Commit c2b8289

Browse files
committed
Add prometheus metric with version information
Allows for collection of jupyter server version as a prometheus metric, and filtering of various other metrics based on server version. Builds on top of conventions in other servers that expose version (or build) info. For example, kubernetes puts out this metric: > kubernetes_build_info{build_date="2024-09-09T04:15:23Z", compiler="gc", > git_commit="fa081458abcdbbc3ddfc3f99546ae5ea45aece17", git_tree_state="clean", > git_version="v1.29.8-gke.1700", go_version="go1.22.5 X:boringcrypto", > instance="10.128.0.50:443", job="kubernetes-apiservers", major="1", minor="29", > platform="linux/amd64"} Most of these parameters are not particularly relevant to us, but version is. So this PR only adds version - future labels can be added as needed.
1 parent 74655ce commit c2b8289

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jupyter_server/prometheus/metrics.py

+7
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,15 @@
3636
)
3737

3838

39+
from prometheus_client import Info
40+
from .._version import __version__
41+
42+
SERVER_INFO = Info("jupyter_server_info", "Jupyter Server Version information")
43+
SERVER_INFO.info({"version": __version__})
44+
3945
__all__ = [
4046
"HTTP_REQUEST_DURATION_SECONDS",
4147
"TERMINAL_CURRENTLY_RUNNING_TOTAL",
4248
"KERNEL_CURRENTLY_RUNNING_TOTAL",
49+
"SERVER_INFO"
4350
]

0 commit comments

Comments
 (0)