Add ability to set Prometheus url with custom path without trailing '/'

This commit is contained in:
László Bence Nagy
2019-06-04 17:31:27 +02:00
parent abb8d946cc
commit 631d93b8d9
+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)