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

Add support for multiple scrape addresses #539

Merged
merged 1 commit into from
Nov 20, 2023
Merged

Add support for multiple scrape addresses #539

merged 1 commit into from
Nov 20, 2023

Conversation

brandon1024
Copy link
Contributor

Proposed changes

Make the nginx.scrape-uri accept a slice of addresses, and register prometheus collectors for each monitored nginx instance.

This revision came out of a discussion in #229. The general concensus by those in the thread was that it would be better to run an nginx-exporter for every monitored nginx instance. I had implemented these changes for my own use, so I decided to make them available to the wider community here.

Feel free to merge, or don't :-) I'm fine with either.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING
    guide
  • I have proven my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have ensured the README is up to date
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch on my own fork

@github-actions github-actions bot added the documentation Pull requests/issues for documentation label Oct 30, 2023
@brandon1024 brandon1024 requested a review from a team as a code owner October 30, 2023 21:50
@shaun-nx shaun-nx self-requested a review November 10, 2023 09:20
@lucacome
Copy link
Member

Hi @brandon1024, thanks for the PR!

It seems like a relatively small change and it would make a few people happy 🙂

My only concern is that we're adding a new label addr to all the metrics and this is generally not recommended (as I mentioned in the issue). Do you think it would make sense to add the label only if there are multiple scrape URIs? So the majority of the users would not see any difference when running the exporter with just one URI? Or do we want to keep it consistent?

Also, do you think this is considered a breaking change?

@brandon1024
Copy link
Contributor Author

Thanks for the review @lucacome 🙂

My only concern is that we're adding a new label addr to all the metrics and this is generally not recommended (as I mentioned in the issue). Do you think it would make sense to add the label only if there are multiple scrape URIs? So the majority of the users would not see any difference when running the exporter with just one URI? Or do we want to keep it consistent?

That's fair, and this did cross my mind when I was implementing these changes. I agree it would be better to add the address label only when more than one address is given. This will be pretty easy to implement, I'll make some tweaks today and push a new revision.

Also, do you think this is considered a breaking change?

Once I make those minor changes, it would be completely backwards compatible :-)

@brandon1024
Copy link
Contributor Author

Done!

Make the `nginx.scrape-uri` accept a slice of addresses, and register
prometheus collectors for each nginx instance. When multiple scrape
addresses are registered, include the scrape address as a label to
differentiate the metrics for each instance.
@brandon1024 brandon1024 requested a review from a team as a code owner November 16, 2023 20:10
Copy link
Member

@lucacome lucacome left a comment

Choose a reason for hiding this comment

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

Thanks @brandon1024 !

@lucacome lucacome requested review from a team and removed request for a team November 17, 2023 00:47
@lucacome lucacome merged commit 69bd82f into nginxinc:main Nov 20, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests/issues for documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants