|
@@ -4,16 +4,16 @@ import (
|
|
|
"context"
|
|
"context"
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "io/ioutil"
|
|
|
"net/http"
|
|
"net/http"
|
|
|
"net/url"
|
|
"net/url"
|
|
|
"path"
|
|
"path"
|
|
|
|
|
|
|
|
- "golang.org/x/net/context/ctxhttp"
|
|
|
|
|
-
|
|
|
|
|
"github.com/grafana/grafana/pkg/log"
|
|
"github.com/grafana/grafana/pkg/log"
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
"github.com/grafana/grafana/pkg/models"
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
"github.com/grafana/grafana/pkg/tsdb"
|
|
"github.com/grafana/grafana/pkg/tsdb"
|
|
|
|
|
+ "golang.org/x/net/context/ctxhttp"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
type InfluxDBExecutor struct {
|
|
type InfluxDBExecutor struct {
|
|
@@ -71,13 +71,14 @@ func (e *InfluxDBExecutor) Query(ctx context.Context, dsInfo *models.DataSource,
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ defer resp.Body.Close()
|
|
|
if resp.StatusCode/100 != 2 {
|
|
if resp.StatusCode/100 != 2 {
|
|
|
|
|
+ ioutil.ReadAll(resp.Body)
|
|
|
return nil, fmt.Errorf("Influxdb returned statuscode invalid status code: %v", resp.Status)
|
|
return nil, fmt.Errorf("Influxdb returned statuscode invalid status code: %v", resp.Status)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var response Response
|
|
var response Response
|
|
|
dec := json.NewDecoder(resp.Body)
|
|
dec := json.NewDecoder(resp.Body)
|
|
|
- defer resp.Body.Close()
|
|
|
|
|
dec.UseNumber()
|
|
dec.UseNumber()
|
|
|
err = dec.Decode(&response)
|
|
err = dec.Decode(&response)
|
|
|
|
|
|