Merge pull request #197 from Laci21/set-url-custom-path

Add ability to set Prometheus url with custom path without trailing "/"
This commit is contained in:
Stefan Prodan
2019-06-04 19:04:56 +03:00
committed by GitHub
+3
View File
@@ -9,6 +9,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"path"
"strconv"
"strings"
"text/template"
@@ -84,6 +85,7 @@ func (p *PrometheusClient) RunQuery(query string) (float64, error) {
if err != nil {
return 0, err
}
u.Path = path.Join(p.url.Path, u.Path)
u = p.url.ResolveReference(u)
@@ -150,6 +152,7 @@ func (p *PrometheusClient) IsOnline() (bool, error) {
if err != nil {
return false, err
}
u.Path = path.Join(p.url.Path, u.Path)
u = p.url.ResolveReference(u)