Skip to content

[feat/1316] Support Serving Metrics On an Alternate Port #1529

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

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

divyabiyani
Copy link

@divyabiyani divyabiyani commented Jun 15, 2025

Feature Request: Jupyter Server Issue #1316
Support Serving Metrics On an Alternate Port

Label suggestion: enhancement

Summary Of Changes:

  • Introduced support for serving metrics on an alternate port.
  • Updated the default behavior to publish metrics on port 9090.
  • The port can be customized using the --ServerApp.metrics_port=<port> argument. Setting --ServerApp.metrics_port=0 will disable the separate server and serve metrics through the main Tornado server.
  • The metrics server honors the following configuration flags:
    • --ServerApp.authenticate_prometheus=<bool> — Enables authentication for metrics endpoint if set to true.
    • --ServerApp.record_http_request_metrics=<bool> — Enables or disables recording of HTTP request metrics.
  • Enhanced info logs to include the metrics URL for better visibility.

Test Scenarios Verified:

  • Info logs correctly include the metrics URL.
Screenshot 2025-06-15 at 7 16 04 PM - Verified that when a custom metrics port is provided, metrics are only served on the specified port and not on the default port or tornado server port. Screenshot 2025-06-15 at 7 09 59 PM
  • Verified behavior when no ServerApp.token='' or --ServerApp.password='' is provided:
    • With --ServerApp.authenticate_prometheus=False.
Screenshot 2025-06-15 at 7 10 08 PM
  • With --ServerApp.authenticate_prometheus=True.
Screenshot 2025-06-15 at 7 12 49 PM Screenshot 2025-06-15 at 7 16 00 PM
  • Verified behavior when both ServerApp.token and ServerApp.password are provided.
  • Verified functionality with --ServerApp.record_http_request_metrics=True.
Screenshot 2025-06-15 at 7 09 41 PM
  • Verified metrics served with --ServerApp.metrics_port=9009.
    Uploading Screenshot 2025-06-15 at 7.34.03 PM.png…

  • Verified fallback behavior with --ServerApp.metrics_port=0 (metrics served on main Tornado server).
    Uploading Screenshot 2025-06-15 at 7.33.44 PM.png…

  • Verified that when the configured metrics port is already in use, server startup fails with appropriate error.
    Uploading Screenshot 2025-06-15 at 11.24.08 PM.png…

divyabiyani and others added 26 commits June 15, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant