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

Allow /metrics by default if auth is off #5974

Merged
merged 1 commit into from
Feb 8, 2021
Merged
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
15 changes: 15 additions & 0 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,21 @@ def _update_server_extensions(self, change):
"""
).tag(config=True)

@default('authenticate_prometheus')
def _default_authenticate_prometheus(self):
""" Authenticate Prometheus by default, unless auth is disabled. """
auth = bool(self.password) or bool(self.token)
if auth is False:
self.log.info(_("Authentication of /metrics is OFF, since other authentication is disabled."))
return auth

@observe('authenticate_prometheus')
def _update_authenticate_prometheus(self, change):
newauth = change['new']
if self.authenticate_prometheus is True and newauth is False:
self.log.info(_("Authentication of /metrics is being turned OFF."))
self.authenticate_prometheus = newauth

# Since use of terminals is also a function of whether the terminado package is
# available, this variable holds the "final indication" of whether terminal functionality
# should be considered (particularly during shutdown/cleanup). It is enabled only
Expand Down