Skip to content

Commit

Permalink
Update write path to match updated InfluxDB v2 API (influxdata#4844)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and rgitzel committed Oct 17, 2018
1 parent 4c7224a commit f54c773
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/outputs/influxdb_v2/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ func makeWriteURL(loc url.URL, org, bucket string) (string, error) {
case "unix":
loc.Scheme = "http"
loc.Host = "127.0.0.1"
loc.Path = "v2/write"
loc.Path = "/api/v2/write"
case "http", "https":
loc.Path = path.Join(loc.Path, "v2/write")
loc.Path = path.Join(loc.Path, "/api/v2/write")
default:
return "", fmt.Errorf("unsupported scheme: %q", loc.Scheme)
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/outputs/influxdb_v2/http_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ func TestMakeWriteURL(t *testing.T) {
}{
{
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"),
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,
Expand Down

0 comments on commit f54c773

Please sign in to comment.