cheddar commented on a change in pull request #12296:
URL: https://github.com/apache/druid/pull/12296#discussion_r822222173
##########
File path:
extensions-contrib/prometheus-emitter/src/main/java/org/apache/druid/emitter/prometheus/PrometheusEmitter.java
##########
@@ -78,9 +81,24 @@ public void start()
log.error("HTTPServer is already started");
}
} else if (strategy.equals(PrometheusEmitterConfig.Strategy.pushgateway)) {
- pushGateway = new PushGateway(config.getPushGatewayAddress());
+ String address = config.getPushGatewayAddress();
+ if (address.startsWith("https") || address.startsWith("http")) {
+ URL myURL = createURLSneakily(address);
+ pushGateway = new PushGateway(myURL);
+ } else {
+ pushGateway = new PushGateway(address);
+ }
}
+ }
+ private static URL createURLSneakily(final String urlString)
+ {
+ try {
+ return new URL(urlString);
+ }
+ catch (MalformedURLException e) {
+ throw new RuntimeException(e);
Review comment:
Druid has an "RE" class that does auto-formatting. Just to make sure
you get some information about what's going on here, I'd suggest you actually
```
throw new RE(e, "couldn't parse https URL from[%s]", urlString);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]