-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Auto-configured PrometheusPushGatewayManager cannot be configured to use HTTPS to connect to the gateway #16084
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
Conversation
|
||
private PushGateway getPushGateway(String url) { | ||
try { | ||
return new PushGateway(new URL(Objects.toString(url, ""))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to do Objects.toString(url, "")
since the property has a default value of localhost:9091
.
@mbhave Thank you very much! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I am not sure that's quite what we had in mind. We want to get away from using the String
based constructor as I am expecting prometheus to deprecate and remove it in a future release. We also want to educate our users and offer a migration strategy.
I am not sure how to deal with this: the property is called base-url
but isn't an URL
so we can't just change its type. If we keep a String
there is no easy way to signal to users they have to provide a valid URL. IDEs do not perform any validation on the String at the moment so using a custom value hint won't help.
Push gateway calls the string-based one an address but I guess it's a bit dumb to rename it to re-introduce the URL-based afterwards.
Flagging for team attention to see what the rest of the team thinks.
Duration pushRate = properties.getPushRate(); | ||
String job = getJob(properties, environment); | ||
Map<String, String> groupingKey = properties.getGroupingKey(); | ||
ShutdownOperation shutdownOperation = properties.getShutdownOperation(); | ||
return new PrometheusPushGatewayManager(pushGateway, collectorRegistry, | ||
pushRate, job, groupingKey, shutdownOperation); | ||
return new PrometheusPushGatewayManager( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason to change the flow of the code here. I also feel that the previous version was easier to read. Can you please revert that part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spring-java-format
:(
I've introduced a variable to avoid this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That probably wasn't what I was talking about. I meant the fact you remove the PushGateway
variable and therefore changed this constructor. I see no good reason for doing so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 constructors.
String
createsURL
as"http://" + address
and delegates it to the underlyingURL
constructor.URL
usesURL
as is.
So, that is why I've introduced a method to create a PushGateway
instance using different constructors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not what I am talking about and what you pushed force in the meantime is addressing it, thank you.
…use HTTPS to connect to the gateway. spring-projectsgh-16073
We've decided to try to parse the URL and log a warning if the URL is invalid, calling the deprecated constructor in that case. We'll also change the default value to include |
@snicoll Thank you |
* pr/16084: Polish "Permit use of https for configuring Prometheus push gateway" Permit use of https for configuring Prometheus push gateway
gh-16073