@@ -42,6 +42,12 @@ class SetupAdapter {
4242 std::string auth_;
4343 std::chrono::seconds timeout_;
4444};
45+
46+ std::string concatenate (const std::string& host, const std::string& port) {
47+ std::stringstream ss;
48+ ss << host << " :" << port;
49+ return ss.str ();
50+ }
4551} // namespace
4652
4753Gateway::Gateway (const std::string& host, const std::string& port,
@@ -52,12 +58,21 @@ Gateway::Gateway(const std::string& host, const std::string& port,
5258 labels) {}
5359
5460Gateway::Gateway (const std::string& host, const std::string& port,
61+ std::function<void (CURL*)> presetupCurl,
62+ const std::string& jobname, const Labels& labels)
63+ : Gateway(concatenate(host, port), presetupCurl, jobname, labels) {}
64+
65+ Gateway::Gateway (const std::string& url,
5566 std::function<void (CURL*)> presetupCurl,
5667 const std::string& jobname, const Labels& labels) {
5768 curlWrapper_ = detail::make_unique<detail::CurlWrapper>(presetupCurl);
5869
5970 std::stringstream jobUriStream;
60- jobUriStream << host << ' :' << port << " /metrics" ;
71+ jobUriStream << url;
72+ if (!url.empty () && url.back () != ' /' ) {
73+ jobUriStream << " /" ;
74+ }
75+ jobUriStream << " metrics" ;
6176 detail::encodeLabel (jobUriStream, {" job" , jobname});
6277 jobUri_ = jobUriStream.str ();
6378
0 commit comments