Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prometheus info metrics listing server extensions + versions #1470

Merged
merged 4 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading