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

prometheus: Properly split the port off IPv6 addresses #36594

Merged
merged 1 commit into from Sep 2, 2020

Conversation

matthewoliver
Copy link
Contributor

The Prometheus module when splitting the port nubmer for public and
client networks/ips doesn't take IPv6 addresses into account.

This patch fixes this by using rsplit(':', 1) rather then split(':')
which leads to bugs like:

curl --silent http://localhost:9283/metrics | grep ceph_mon_metadata{
ceph_mon_metadata{ceph_daemon="mon.mon2",hostname="mon2.example.net",public_addr="[2001",rank="0",ceph_version="ceph version 15.2.4 (7447c15) octopus (stable)"} 1.0

Note the public_addr above being split at the first ':' of an IPv6
address.

Signed-off-by: Matthew Oliver moliver@suse.com
Fixes: https://tracker.ceph.com/issues/46846

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 api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

The Prometheus module when splitting the port nubmer for public and
client networks/ips doesn't take IPv6 addresses into account.

This patch fixes this by using `rsplit(':', 1)` rather then `split(':')`
which leads to bugs like:

  curl --silent http://localhost:9283/metrics | grep ceph_mon_metadata{
  ceph_mon_metadata{ceph_daemon="mon.mon2",hostname="mon2.example.net",public_addr="[2001",rank="0",ceph_version="ceph version 15.2.4 (7447c15) octopus (stable)"} 1.0

Note the public_addr above being split at the first ':' of an IPv6
address.

Signed-off-by: Matthew Oliver <moliver@suse.com>
Fixes: https://tracker.ceph.com/issues/46846
@matthewoliver
Copy link
Contributor Author

This is really a drive by fix as I saw the tracker bug.

I haven't actually tested it as I don't have the env set up.

@jdurgin jdurgin requested review from b-ranto and jan--f and removed request for b-ranto August 21, 2020 21:23
Copy link
Contributor

@jan--f jan--f left a comment

Choose a reason for hiding this comment

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

Thx, lgtm!

@jan--f jan--f merged commit b8aab17 into ceph:master Sep 2, 2020
@tchaikov
Copy link
Contributor

tchaikov commented Sep 3, 2020

@jan--f could you please add a Reviewed-by line when merging PRs in future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants