From 48eacd1ea6478ac35cd485cfe3e7ebd838a6c00b Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Thu, 14 Oct 2021 16:20:06 +0200 Subject: [PATCH] Remove unused httpMethod (#40471) --- pkg/tsdb/prometheus/prometheus.go | 10 +--------- pkg/tsdb/prometheus/types.go | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/pkg/tsdb/prometheus/prometheus.go b/pkg/tsdb/prometheus/prometheus.go index ce87fb87bd3..ac41b9b3749 100644 --- a/pkg/tsdb/prometheus/prometheus.go +++ b/pkg/tsdb/prometheus/prometheus.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "math" - "net/http" "regexp" "sort" "strconv" @@ -62,7 +61,6 @@ func ProvideService(httpClientProvider httpclient.Provider, backendPluginManager func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.InstanceFactoryFunc { return func(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) { - defaultHttpMethod := http.MethodPost jsonData := map[string]interface{}{} err := json.Unmarshal(settings.JSONData, &jsonData) if err != nil { @@ -78,19 +76,14 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst httpCliOpts.SigV4.Service = "aps" } - httpMethod, ok := jsonData["httpMethod"].(string) - if !ok { - httpMethod = defaultHttpMethod - } - // timeInterval can be a string or can be missing. // if it is missing, we set it to empty-string - timeInterval := "" timeIntervalJson := jsonData["timeInterval"] if timeIntervalJson != nil { // if it is not nil, it must be a string + var ok bool timeInterval, ok = timeIntervalJson.(string) if !ok { return nil, errors.New("invalid time-interval provided") @@ -105,7 +98,6 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst mdl := DatasourceInfo{ ID: settings.ID, URL: settings.URL, - HTTPMethod: httpMethod, TimeInterval: timeInterval, promClient: client, } diff --git a/pkg/tsdb/prometheus/types.go b/pkg/tsdb/prometheus/types.go index b660f0ff10c..27cad43a0ae 100644 --- a/pkg/tsdb/prometheus/types.go +++ b/pkg/tsdb/prometheus/types.go @@ -9,7 +9,6 @@ import ( type DatasourceInfo struct { ID int64 URL string - HTTPMethod string TimeInterval string promClient apiv1.API