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

mgr/prometheus: Make prometheus standby behaviour configurable #43464

Merged
merged 1 commit into from Nov 11, 2021

Conversation

rsommer
Copy link
Contributor

@rsommer rsommer commented Oct 8, 2021

The dashboard module provides configuration options to configure the standby behaviour for better integration with reverse proxys or loadbalancers. Adding this to the prometheus module simplifys a similiar setup for the prometheus endpoint.

Fixes: https://tracker.ceph.com/issues/53229

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@avanthakkar avanthakkar added this to In progress in Dashboard via automation Oct 8, 2021
@avanthakkar avanthakkar requested review from a team, pereman2, nizamial09 and p-se and removed request for a team, pereman2 and nizamial09 October 8, 2021 11:06
Copy link
Member

@epuertat epuertat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: it seems inspired by the Dashboard approach (except for the 301 redirection) and it's not breaking the default behaviour. However, as Prometheus will always scrape the /metrics endpoint, have you checked whether this behaves as intended (I assume it returns 4xx-5xx in the /metrics as well)?

src/pybind/mgr/prometheus/module.py Outdated Show resolved Hide resolved
src/pybind/mgr/prometheus/module.py Outdated Show resolved Hide resolved
src/pybind/mgr/prometheus/module.py Outdated Show resolved Hide resolved
Dashboard automation moved this from In progress to Reviewer approved Oct 18, 2021
@rsommer rsommer force-pushed the wip-prometheus-standby-behaviour branch from adf9520 to 0d3dc00 Compare October 19, 2021 06:11
@rsommer
Copy link
Contributor Author

rsommer commented Oct 19, 2021

jenkins test api

@epuertat
Copy link
Member

@p-se can you please check this PR? Thanks!

@epuertat epuertat moved this from Reviewer approved to Ready-to-merge in Dashboard Nov 5, 2021
@epuertat
Copy link
Member

@rsommer this is ready for merging, but can you please squash all these commits?

And, if you like to see this landing in Pacific, a tracker issue would be required (and the subsequent "Fixes: https://tracker..." in the commit message and the PR description). Thanks!

Enable config settings to modify standby's behaviour on the index page
This makes the standby discoverable by reverse proxy or loadbalancer
setups. Testing for the empty response of the '/metrics' endpoint would
trigger metric collection on the active manager instance.

The newly added configuration options settings standby_behaviour and
standby_error_status_code are documented and flagged as runtime, as
modifying both settings has an immediate effect (no restart required).

Co-authored-by: Ernesto Puerta <37327689+epuertat@users.noreply.github.com>
Signed-off-by: Roland Sommer <rol@ndsommer.de>
Fixes: https://tracker.ceph.com/issues/53229
@rsommer rsommer force-pushed the wip-prometheus-standby-behaviour branch from 0d3dc00 to c1570f8 Compare November 11, 2021 07:36
@rsommer
Copy link
Contributor Author

rsommer commented Nov 11, 2021

Squashed, tracker ticket created and pull request updated. Hope this is all good now ;)

@epuertat epuertat merged commit 45eb9dd into ceph:master Nov 11, 2021
Dashboard automation moved this from Ready-to-merge to Done Nov 11, 2021
@epuertat
Copy link
Member

Thank you very much @rsommer ! Merged!

})

module = self

class Root(object):
@cherrypy.expose
def index(self) -> str:
active_uri = module.get_active_uri()
return '''<!DOCTYPE html>
standby_behaviour = module.get_module_option('standby_behaviour')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line introduces a regression, as None is returned if nothing is set for standby_behaviour. Proposed fix in #43904.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understood (because I had the default value in there in the beginning, see #43464 (comment)) this should have been handled by the default value set in the option definition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Dashboard
  
Done
4 participants