Skip to content

Fix instance_ip_grouping_key not working on macOS#687

Merged
csmarchbanks merged 3 commits into
prometheus:masterfrom
AceFire6:patch-1
Sep 15, 2021
Merged

Fix instance_ip_grouping_key not working on macOS#687
csmarchbanks merged 3 commits into
prometheus:masterfrom
AceFire6:patch-1

Conversation

@AceFire6

Copy link
Copy Markdown
Contributor

Fixes #629

The solution is adapted from this StackOverflow answer: https://stackoverflow.com/a/28950776

@csmarchbanks I decided I'd just make the PR so long and if the solution isn't acceptable it can just be closed 👍

Fixes prometheus#629

The solution is adapted from this StackOverflow answer: https://stackoverflow.com/a/28950776

Signed-off-by: Jethro Muller <git@jethromuller.co.za>
Signed-off-by: Jethro Muller <git@jethromuller.co.za>
@csmarchbanks

Copy link
Copy Markdown
Member

Thank you for the PR, I just got back from a couple weeks of vacation, and will take a look at this soon. Just need to make sure I fully understand the workaround.

@csmarchbanks csmarchbanks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I apologize for the delay. I spent some time testing this, and my main concern is that it looks like the result could be different with this change. E.g. on my local machine instance_ip_grouping_key() changes from {'instance': '127.0.0.1'} to {'instance': '192.168.1.107'}. For many cases the new result probably makes more sense, but this could be a breaking change if someone is configuring their servers with a specific IP address.

@AceFire6

Copy link
Copy Markdown
Contributor Author

Ah okay. That isn't good!

I wasn't really sure how to test it and we didn't end up using the patch upstream as we had intended to when I made this PR.

I guess this doesn't fit the bill then. I'm not really sure where to go from here so I guess I'll leave what happens next up to you.

Thanks for the review 👍

@csmarchbanks

Copy link
Copy Markdown
Member

One option would be to check if the platform is Darwin and use your new version in that case, but keep the old behavior for all other platforms? If there is a comment for why the two are handled slightly differently I would be happy moving forward with that.

@AceFire6

Copy link
Copy Markdown
Contributor Author

@csmarchbanks Cool, I can change the PR to do that 👍

Signed-off-by: Jethro Muller <git@jethromuller.co.za>
@AceFire6

Copy link
Copy Markdown
Contributor Author

@csmarchbanks I've made the change to choose which method is used based on the platform 👍

@csmarchbanks csmarchbanks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@csmarchbanks csmarchbanks merged commit 09fb459 into prometheus:master Sep 15, 2021
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.

instance_ip_grouping_key does not work on macOS

2 participants