Update write path to match updated InfluxDB v2 API (#4844)

This commit is contained in:
Greg 2018-10-10 16:53:01 -06:00 committed by Daniel Nelson
parent 7bb219222a
commit b075686400
2 changed files with 4 additions and 4 deletions

View File

@ -267,9 +267,9 @@ func makeWriteURL(loc url.URL, org, bucket string) (string, error) {
case "unix": case "unix":
loc.Scheme = "http" loc.Scheme = "http"
loc.Host = "127.0.0.1" loc.Host = "127.0.0.1"
loc.Path = "v2/write" loc.Path = "/api/v2/write"
case "http", "https": case "http", "https":
loc.Path = path.Join(loc.Path, "v2/write") loc.Path = path.Join(loc.Path, "/api/v2/write")
default: default:
return "", fmt.Errorf("unsupported scheme: %q", loc.Scheme) return "", fmt.Errorf("unsupported scheme: %q", loc.Scheme)
} }

View File

@ -21,11 +21,11 @@ func TestMakeWriteURL(t *testing.T) {
}{ }{
{ {
url: genURL("http://localhost:9999"), url: genURL("http://localhost:9999"),
act: "http://localhost:9999/v2/write?bucket=telegraf&org=influx", act: "http://localhost:9999/api/v2/write?bucket=telegraf&org=influx",
}, },
{ {
url: genURL("unix://var/run/influxd.sock"), url: genURL("unix://var/run/influxd.sock"),
act: "http://127.0.0.1/v2/write?bucket=telegraf&org=influx", act: "http://127.0.0.1/api/v2/write?bucket=telegraf&org=influx",
}, },
{ {
err: true, err: true,