Skip to content

Add basic auth support for Prometheus pushgateway #22548

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

Closed

Conversation

AndrewDi
Copy link
Contributor

We hide pushgateway behind nginx, and use HTTP basic auth, so need pushgateway to implement it.

@pivotal-issuemaster
Copy link

@AndrewDi Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@AndrewDi Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 24, 2020
Copy link
Member

@snicoll snicoll left a comment

Choose a reason for hiding this comment

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

Thanks for submitting your first PR. I've added a few comments. Can you please also update PrometheusMetricsExportAutoConfigurationTests to add the necessary tests that exercise this change?

/**
* Enable publishing via a Prometheus Pushgateway with Basic Auth.
*/
private Boolean authEnabled = false;
Copy link
Member

Choose a reason for hiding this comment

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

We don't have such enabled flag. What we usually do is to check that the username is set, something like StringUtils.hasText can help you with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean check this value in PrometheusMetricsExportAutoConfigurationTests?

Copy link
Member

Choose a reason for hiding this comment

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

No. I mean that we don't enable authentication based on a flag but based on the fact that the username property is set.

private Boolean authEnabled = false;

/**
* Basic Auth Username.
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure if "basic auth" is really important here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushgateway already support basic auth, we just need to pass auth parameters to setConnectionFactory function.

Copy link
Member

Choose a reason for hiding this comment

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

I am aware of that. The comment is on the key description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@snicoll snicoll changed the title alter pushgateway to add basic auth Add basic auth support for Prometheus pushgateway Jul 24, 2020
@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Jul 24, 2020
@snicoll
Copy link
Member

snicoll commented Aug 3, 2020

@AndrewDi how is it going? Did you get a chance to look at the review?

snicoll pushed a commit that referenced this pull request Aug 12, 2020
@snicoll snicoll closed this in 369cd15 Aug 12, 2020
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Aug 12, 2020
@snicoll snicoll self-assigned this Aug 12, 2020
@snicoll snicoll added this to the 2.4.0-M2 milestone Aug 12, 2020
@snicoll
Copy link
Member

snicoll commented Aug 12, 2020

I've decided to give this one anyway, see this polish commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants