Skip to content

Commit

Permalink
Add prometheus info metrics listing server extensions + versions (#1470)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
yuvipanda and pre-commit-ci[bot] authored Nov 4, 2024
1 parent 32679b9 commit 0d3eeb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions jupyter_server/prometheus/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@

# New prometheus metrics that do not exist in notebook v6 go here
SERVER_INFO = Info("jupyter_server", "Jupyter Server Version information")
SERVER_EXTENSION_INFO = Info(
"jupyter_server_extension",
"Jupyter Server Extensiom Version Information",
["name", "version", "enabled"],
)

__all__ = [
"HTTP_REQUEST_DURATION_SECONDS",
Expand Down
7 changes: 6 additions & 1 deletion jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
GatewaySessionManager,
)
from jupyter_server.log import log_request
from jupyter_server.prometheus.metrics import SERVER_INFO
from jupyter_server.prometheus.metrics import SERVER_EXTENSION_INFO, SERVER_INFO
from jupyter_server.services.config import ConfigManager
from jupyter_server.services.contents.filemanager import (
AsyncFileContentsManager,
Expand Down Expand Up @@ -2703,6 +2703,11 @@ def init_metrics(self) -> None:
"""
SERVER_INFO.info({"version": __version__})

for ext in self.extension_manager.extensions.values():
SERVER_EXTENSION_INFO.labels(
name=ext.name, version=ext.version, enabled=str(ext.enabled).lower()
)

@catch_config_error
def initialize(
self,
Expand Down

0 comments on commit 0d3eeb0

Please sign in to comment.