diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 71f1adc36..8646819ac 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -15,6 +15,7 @@ package main import ( + "context" "fmt" "net" "net/http" @@ -34,7 +35,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/common/version" - "golang.org/x/net/context" "gopkg.in/alecthomas/kingpin.v2" k8s_runtime "k8s.io/apimachinery/pkg/util/runtime" diff --git a/discovery/azure/azure.go b/discovery/azure/azure.go index d78b5c37e..991a542d1 100644 --- a/discovery/azure/azure.go +++ b/discovery/azure/azure.go @@ -14,6 +14,7 @@ package azure import ( + "context" "fmt" "net" "strings" @@ -27,7 +28,6 @@ import ( "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/util/strutil" diff --git a/discovery/consul/consul.go b/discovery/consul/consul.go index d782a2722..8279fed79 100644 --- a/discovery/consul/consul.go +++ b/discovery/consul/consul.go @@ -14,6 +14,7 @@ package consul import ( + "context" "fmt" "net" "net/http" @@ -30,7 +31,6 @@ import ( "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/util/httputil" "github.com/prometheus/prometheus/util/strutil" - "golang.org/x/net/context" ) const ( diff --git a/discovery/discovery.go b/discovery/discovery.go index 07343be69..9cf5f8190 100644 --- a/discovery/discovery.go +++ b/discovery/discovery.go @@ -14,6 +14,7 @@ package discovery import ( + "context" "fmt" "sync" "time" @@ -32,7 +33,6 @@ import ( "github.com/prometheus/prometheus/discovery/openstack" "github.com/prometheus/prometheus/discovery/triton" "github.com/prometheus/prometheus/discovery/zookeeper" - "golang.org/x/net/context" ) // A TargetProvider provides information about target groups. It maintains a set diff --git a/discovery/discovery_test.go b/discovery/discovery_test.go index 033c0999d..9df4a3454 100644 --- a/discovery/discovery_test.go +++ b/discovery/discovery_test.go @@ -14,10 +14,10 @@ package discovery import ( + "context" "testing" "github.com/prometheus/prometheus/config" - "golang.org/x/net/context" yaml "gopkg.in/yaml.v2" ) diff --git a/discovery/dns/dns.go b/discovery/dns/dns.go index c710de161..db8c1b19a 100644 --- a/discovery/dns/dns.go +++ b/discovery/dns/dns.go @@ -14,6 +14,7 @@ package dns import ( + "context" "fmt" "net" "strings" @@ -25,7 +26,6 @@ import ( "github.com/miekg/dns" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" ) diff --git a/discovery/ec2/ec2.go b/discovery/ec2/ec2.go index 0923c8fd1..f33a915d1 100644 --- a/discovery/ec2/ec2.go +++ b/discovery/ec2/ec2.go @@ -14,6 +14,7 @@ package ec2 import ( + "context" "fmt" "net" "strings" @@ -27,7 +28,6 @@ import ( "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "golang.org/x/net/context" "github.com/aws/aws-sdk-go/service/ec2" "github.com/prometheus/prometheus/config" diff --git a/discovery/file/file.go b/discovery/file/file.go index 3e3497643..3dedd90b8 100644 --- a/discovery/file/file.go +++ b/discovery/file/file.go @@ -14,6 +14,7 @@ package file import ( + "context" "encoding/json" "errors" "fmt" @@ -26,7 +27,6 @@ import ( "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "golang.org/x/net/context" "gopkg.in/fsnotify.v1" "gopkg.in/yaml.v2" diff --git a/discovery/file/file_test.go b/discovery/file/file_test.go index 173678e15..63a33e661 100644 --- a/discovery/file/file_test.go +++ b/discovery/file/file_test.go @@ -14,6 +14,7 @@ package file import ( + "context" "fmt" "io" "os" @@ -22,7 +23,6 @@ import ( "time" "github.com/prometheus/common/model" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" ) diff --git a/discovery/gce/gce.go b/discovery/gce/gce.go index a56c17e9b..8172886cf 100644 --- a/discovery/gce/gce.go +++ b/discovery/gce/gce.go @@ -14,20 +14,19 @@ package gce import ( + "context" "fmt" "net/http" "strings" "time" - "google.golang.org/api/compute/v1" - "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "golang.org/x/net/context" "golang.org/x/oauth2" "golang.org/x/oauth2/google" + "google.golang.org/api/compute/v1" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/util/strutil" diff --git a/discovery/kubernetes/endpoints.go b/discovery/kubernetes/endpoints.go index b8e702fa1..2fcbb971c 100644 --- a/discovery/kubernetes/endpoints.go +++ b/discovery/kubernetes/endpoints.go @@ -14,18 +14,18 @@ package kubernetes import ( + "context" "fmt" "net" "strconv" - "github.com/prometheus/prometheus/config" - "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/prometheus/common/model" - "golang.org/x/net/context" apiv1 "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/tools/cache" + + "github.com/prometheus/prometheus/config" ) // Endpoints discovers new endpoint targets. diff --git a/discovery/kubernetes/ingress.go b/discovery/kubernetes/ingress.go index 33a425093..4b5fae151 100644 --- a/discovery/kubernetes/ingress.go +++ b/discovery/kubernetes/ingress.go @@ -14,6 +14,7 @@ package kubernetes import ( + "context" "fmt" "github.com/go-kit/kit/log" @@ -21,7 +22,6 @@ import ( "github.com/prometheus/common/model" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/util/strutil" - "golang.org/x/net/context" "k8s.io/client-go/pkg/apis/extensions/v1beta1" "k8s.io/client-go/tools/cache" ) diff --git a/discovery/kubernetes/kubernetes.go b/discovery/kubernetes/kubernetes.go index 91d78ec19..934f7f24b 100644 --- a/discovery/kubernetes/kubernetes.go +++ b/discovery/kubernetes/kubernetes.go @@ -14,23 +14,23 @@ package kubernetes import ( + "context" "io/ioutil" "sync" "time" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/prometheus/config" - "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "golang.org/x/net/context" "k8s.io/client-go/kubernetes" "k8s.io/client-go/pkg/api" apiv1 "k8s.io/client-go/pkg/api/v1" extensionsv1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + + "github.com/prometheus/prometheus/config" ) const ( diff --git a/discovery/kubernetes/node.go b/discovery/kubernetes/node.go index e3162d0f2..7e8603446 100644 --- a/discovery/kubernetes/node.go +++ b/discovery/kubernetes/node.go @@ -14,6 +14,7 @@ package kubernetes import ( + "context" "fmt" "net" "strconv" @@ -23,7 +24,6 @@ import ( "github.com/prometheus/common/model" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/util/strutil" - "golang.org/x/net/context" "k8s.io/client-go/pkg/api" apiv1 "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/tools/cache" diff --git a/discovery/kubernetes/node_test.go b/discovery/kubernetes/node_test.go index 9d4c926a0..0d2ed3d17 100644 --- a/discovery/kubernetes/node_test.go +++ b/discovery/kubernetes/node_test.go @@ -14,6 +14,7 @@ package kubernetes import ( + "context" "encoding/json" "fmt" "sync" @@ -21,12 +22,12 @@ import ( "time" "github.com/prometheus/common/model" - "github.com/prometheus/prometheus/config" "github.com/stretchr/testify/require" - "golang.org/x/net/context" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/tools/cache" + + "github.com/prometheus/prometheus/config" ) type fakeInformer struct { diff --git a/discovery/kubernetes/pod.go b/discovery/kubernetes/pod.go index 325efeece..08dbeac4b 100644 --- a/discovery/kubernetes/pod.go +++ b/discovery/kubernetes/pod.go @@ -14,6 +14,7 @@ package kubernetes import ( + "context" "fmt" "net" "strconv" @@ -22,12 +23,12 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/prometheus/common/model" - "github.com/prometheus/prometheus/config" - "github.com/prometheus/prometheus/util/strutil" - "golang.org/x/net/context" "k8s.io/client-go/pkg/api" apiv1 "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/tools/cache" + + "github.com/prometheus/prometheus/config" + "github.com/prometheus/prometheus/util/strutil" ) // Pod discovers new pod targets. diff --git a/discovery/kubernetes/service.go b/discovery/kubernetes/service.go index 8e00698b6..29902555a 100644 --- a/discovery/kubernetes/service.go +++ b/discovery/kubernetes/service.go @@ -14,6 +14,7 @@ package kubernetes import ( + "context" "fmt" "net" "strconv" @@ -21,11 +22,11 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/prometheus/common/model" - "github.com/prometheus/prometheus/config" - "github.com/prometheus/prometheus/util/strutil" - "golang.org/x/net/context" apiv1 "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/tools/cache" + + "github.com/prometheus/prometheus/config" + "github.com/prometheus/prometheus/util/strutil" ) // Service implements discovery of Kubernetes services. diff --git a/discovery/marathon/marathon.go b/discovery/marathon/marathon.go index 596114a06..03f85fa40 100644 --- a/discovery/marathon/marathon.go +++ b/discovery/marathon/marathon.go @@ -14,6 +14,7 @@ package marathon import ( + "context" "encoding/json" "fmt" "io/ioutil" @@ -24,8 +25,6 @@ import ( "strings" "time" - "golang.org/x/net/context" - "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/mwitkow/go-conntrack" diff --git a/discovery/marathon/marathon_test.go b/discovery/marathon/marathon_test.go index 2f185061f..31ce60471 100644 --- a/discovery/marathon/marathon_test.go +++ b/discovery/marathon/marathon_test.go @@ -14,13 +14,13 @@ package marathon import ( + "context" "errors" "net/http" "testing" "time" "github.com/prometheus/common/model" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" ) diff --git a/discovery/openstack/hypervisor.go b/discovery/openstack/hypervisor.go index d4418f122..80a23466b 100644 --- a/discovery/openstack/hypervisor.go +++ b/discovery/openstack/hypervisor.go @@ -14,6 +14,7 @@ package openstack import ( + "context" "fmt" "net" "time" @@ -25,7 +26,6 @@ import ( "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/hypervisors" "github.com/gophercloud/gophercloud/pagination" "github.com/prometheus/common/model" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" ) diff --git a/discovery/openstack/instance.go b/discovery/openstack/instance.go index 5cd8bfb3d..66082a0d3 100644 --- a/discovery/openstack/instance.go +++ b/discovery/openstack/instance.go @@ -14,6 +14,7 @@ package openstack import ( + "context" "fmt" "net" "time" @@ -26,7 +27,6 @@ import ( "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" "github.com/gophercloud/gophercloud/pagination" "github.com/prometheus/common/model" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/util/strutil" diff --git a/discovery/openstack/openstack.go b/discovery/openstack/openstack.go index 171ead8b2..2e67f8977 100644 --- a/discovery/openstack/openstack.go +++ b/discovery/openstack/openstack.go @@ -14,6 +14,7 @@ package openstack import ( + "context" "errors" "time" @@ -21,7 +22,6 @@ import ( "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" ) diff --git a/discovery/triton/triton.go b/discovery/triton/triton.go index bddadbe7c..75bc4f48a 100644 --- a/discovery/triton/triton.go +++ b/discovery/triton/triton.go @@ -14,6 +14,7 @@ package triton import ( + "context" "encoding/json" "fmt" "io/ioutil" @@ -25,9 +26,9 @@ import ( "github.com/mwitkow/go-conntrack" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" + "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/util/httputil" - "golang.org/x/net/context" ) const ( diff --git a/discovery/triton/triton_test.go b/discovery/triton/triton_test.go index e952a977f..86c59fee8 100644 --- a/discovery/triton/triton_test.go +++ b/discovery/triton/triton_test.go @@ -14,6 +14,7 @@ package triton import ( + "context" "fmt" "net" "net/http" @@ -23,10 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/prometheus/common/model" "github.com/prometheus/prometheus/config" - "github.com/stretchr/testify/assert" - "golang.org/x/net/context" ) var ( diff --git a/discovery/zookeeper/zookeeper.go b/discovery/zookeeper/zookeeper.go index 2aada9d58..66c5ca228 100644 --- a/discovery/zookeeper/zookeeper.go +++ b/discovery/zookeeper/zookeeper.go @@ -14,17 +14,17 @@ package zookeeper import ( + "context" "encoding/json" "fmt" "net" "strconv" "time" + "github.com/go-kit/kit/log" "github.com/prometheus/common/model" "github.com/samuel/go-zookeeper/zk" - "golang.org/x/net/context" - "github.com/go-kit/kit/log" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/util/strutil" "github.com/prometheus/prometheus/util/treecache" diff --git a/documentation/examples/remote_storage/remote_storage_adapter/opentsdb/client.go b/documentation/examples/remote_storage/remote_storage_adapter/opentsdb/client.go index a79821d40..da74c511a 100644 --- a/documentation/examples/remote_storage/remote_storage_adapter/opentsdb/client.go +++ b/documentation/examples/remote_storage/remote_storage_adapter/opentsdb/client.go @@ -15,6 +15,7 @@ package opentsdb import ( "bytes" + "context" "encoding/json" "fmt" "io/ioutil" @@ -26,7 +27,6 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/prometheus/common/model" - "golang.org/x/net/context" "golang.org/x/net/context/ctxhttp" ) diff --git a/notifier/notifier.go b/notifier/notifier.go index a6e1d82f9..9179c931e 100644 --- a/notifier/notifier.go +++ b/notifier/notifier.go @@ -15,6 +15,7 @@ package notifier import ( "bytes" + "context" "encoding/json" "fmt" "net" @@ -30,7 +31,7 @@ import ( "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "golang.org/x/net/context" + old_ctx "golang.org/x/net/context" "golang.org/x/net/context/ctxhttp" "github.com/prometheus/prometheus/config" @@ -123,7 +124,7 @@ type Options struct { ExternalLabels model.LabelSet RelabelConfigs []*config.RelabelConfig // Used for sending HTTP requests to the Alertmanager. - Do func(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) + Do func(ctx old_ctx.Context, client *http.Client, req *http.Request) (*http.Response, error) Registerer prometheus.Registerer } diff --git a/notifier/notifier_test.go b/notifier/notifier_test.go index e37753703..2911e5c19 100644 --- a/notifier/notifier_test.go +++ b/notifier/notifier_test.go @@ -14,6 +14,7 @@ package notifier import ( + "context" "encoding/json" "fmt" "io/ioutil" @@ -24,7 +25,7 @@ import ( "testing" "time" - "golang.org/x/net/context" + old_ctx "golang.org/x/net/context" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/config" @@ -198,7 +199,7 @@ func TestCustomDo(t *testing.T) { var received bool h := New(&Options{ - Do: func(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) { + Do: func(ctx old_ctx.Context, client *http.Client, req *http.Request) (*http.Response, error) { received = true body, err := ioutil.ReadAll(req.Body) if err != nil { diff --git a/promql/test.go b/promql/test.go index 18aea5ae7..b600b00f4 100644 --- a/promql/test.go +++ b/promql/test.go @@ -14,6 +14,7 @@ package promql import ( + "context" "fmt" "io/ioutil" "math" @@ -23,7 +24,6 @@ import ( "time" "github.com/prometheus/common/model" - "golang.org/x/net/context" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/storage" diff --git a/retrieval/scrape.go b/retrieval/scrape.go index ac632ebfb..267ff1262 100644 --- a/retrieval/scrape.go +++ b/retrieval/scrape.go @@ -17,6 +17,7 @@ import ( "bufio" "bytes" "compress/gzip" + "context" "fmt" "io" "math" @@ -29,9 +30,7 @@ import ( "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "github.com/prometheus/common/version" - "golang.org/x/net/context" "golang.org/x/net/context/ctxhttp" "github.com/prometheus/prometheus/config" diff --git a/retrieval/scrape_test.go b/retrieval/scrape_test.go index b267bbc40..e43ed80a7 100644 --- a/retrieval/scrape_test.go +++ b/retrieval/scrape_test.go @@ -15,6 +15,7 @@ package retrieval import ( "bytes" + "context" "fmt" "io" "io/ioutil" @@ -30,7 +31,6 @@ import ( "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/pkg/labels" diff --git a/retrieval/targetmanager.go b/retrieval/targetmanager.go index e1b3af404..2bca64abe 100644 --- a/retrieval/targetmanager.go +++ b/retrieval/targetmanager.go @@ -14,11 +14,11 @@ package retrieval import ( + "context" "sync" "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/discovery" diff --git a/rules/alerting.go b/rules/alerting.go index 90134aca3..47cb0b32f 100644 --- a/rules/alerting.go +++ b/rules/alerting.go @@ -14,17 +14,16 @@ package rules import ( + "context" "fmt" "net/url" "sync" "time" - yaml "gopkg.in/yaml.v2" - - "golang.org/x/net/context" - html_template "html/template" + yaml "gopkg.in/yaml.v2" + "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/prometheus/common/model" diff --git a/rules/manager.go b/rules/manager.go index 29b7cf62d..02846670e 100644 --- a/rules/manager.go +++ b/rules/manager.go @@ -14,6 +14,7 @@ package rules import ( + "context" "errors" "fmt" "math" @@ -28,7 +29,6 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/notifier" diff --git a/rules/recording.go b/rules/recording.go index be3b06456..38ec3928a 100644 --- a/rules/recording.go +++ b/rules/recording.go @@ -14,6 +14,7 @@ package rules import ( + "context" "fmt" "html/template" "net/url" @@ -21,8 +22,6 @@ import ( yaml "gopkg.in/yaml.v2" - "golang.org/x/net/context" - "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/pkg/rulefmt" "github.com/prometheus/prometheus/promql" diff --git a/rules/recording_test.go b/rules/recording_test.go index 64ab2f198..bad9e8234 100644 --- a/rules/recording_test.go +++ b/rules/recording_test.go @@ -14,12 +14,11 @@ package rules import ( + "context" "reflect" "testing" "time" - "golang.org/x/net/context" - "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/pkg/timestamp" "github.com/prometheus/prometheus/promql" diff --git a/storage/remote/client.go b/storage/remote/client.go index 7e4b23206..b2c054ac4 100644 --- a/storage/remote/client.go +++ b/storage/remote/client.go @@ -16,6 +16,7 @@ package remote import ( "bufio" "bytes" + "context" "fmt" "io" "io/ioutil" @@ -24,10 +25,9 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/snappy" - "golang.org/x/net/context" + "github.com/prometheus/common/model" "golang.org/x/net/context/ctxhttp" - "github.com/prometheus/common/model" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/prompb" "github.com/prometheus/prometheus/util/httputil" diff --git a/template/template.go b/template/template.go index 7fc0f4c08..b8a87f1a0 100644 --- a/template/template.go +++ b/template/template.go @@ -15,6 +15,7 @@ package template import ( "bytes" + "context" "errors" "fmt" "math" @@ -28,9 +29,8 @@ import ( text_template "text/template" "github.com/prometheus/common/model" - "github.com/prometheus/prometheus/pkg/labels" - "golang.org/x/net/context" + "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/util/strutil" ) diff --git a/template/template_test.go b/template/template_test.go index 316137c94..686d820f6 100644 --- a/template/template_test.go +++ b/template/template_test.go @@ -14,13 +14,13 @@ package template import ( + "context" "math" "net/url" "testing" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - "golang.org/x/net/context" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/promql" diff --git a/web/api/v1/api.go b/web/api/v1/api.go index b179dbdde..81e55e524 100644 --- a/web/api/v1/api.go +++ b/web/api/v1/api.go @@ -14,6 +14,7 @@ package v1 import ( + "context" "encoding/json" "errors" "fmt" @@ -26,7 +27,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/common/route" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/pkg/labels" diff --git a/web/api/v1/api_test.go b/web/api/v1/api_test.go index 93a278c36..b306f82d1 100644 --- a/web/api/v1/api_test.go +++ b/web/api/v1/api_test.go @@ -14,6 +14,7 @@ package v1 import ( + "context" "encoding/json" "errors" "fmt" @@ -27,7 +28,6 @@ import ( "github.com/prometheus/common/model" "github.com/prometheus/common/route" - "golang.org/x/net/context" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/pkg/labels" diff --git a/web/api/v2/api.go b/web/api/v2/api.go index cd1546760..415f5746e 100644 --- a/web/api/v2/api.go +++ b/web/api/v2/api.go @@ -14,7 +14,7 @@ package api_v2 import ( - native_context "context" + "context" "fmt" "math" "math/rand" @@ -24,7 +24,7 @@ import ( "path/filepath" "time" - "golang.org/x/net/context" + old_ctx "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -33,14 +33,15 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/pkg/errors" + "github.com/prometheus/tsdb" + tsdbLabels "github.com/prometheus/tsdb/labels" + "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/pkg/timestamp" pb "github.com/prometheus/prometheus/prompb" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/retrieval" "github.com/prometheus/prometheus/storage" - "github.com/prometheus/tsdb" - tsdbLabels "github.com/prometheus/tsdb/labels" ) // API encapsulates all API services. @@ -48,7 +49,7 @@ type API struct { enableAdmin bool now func() time.Time db func() *tsdb.DB - q func(ctx native_context.Context, mint, maxt int64) (storage.Querier, error) + q func(ctx context.Context, mint, maxt int64) (storage.Querier, error) targets func() []*retrieval.Target alertmanagers func() []*url.URL } @@ -58,7 +59,7 @@ func New( now func() time.Time, db func() *tsdb.DB, qe *promql.Engine, - q func(ctx native_context.Context, mint, maxt int64) (storage.Querier, error), + q func(ctx context.Context, mint, maxt int64) (storage.Querier, error), targets func() []*retrieval.Target, alertmanagers func() []*url.URL, enableAdmin bool, @@ -139,12 +140,12 @@ type adminDisabled struct { } // TSDBSnapshot implements pb.AdminServer. -func (s *adminDisabled) TSDBSnapshot(_ context.Context, _ *pb.TSDBSnapshotRequest) (*pb.TSDBSnapshotResponse, error) { +func (s *adminDisabled) TSDBSnapshot(_ old_ctx.Context, _ *pb.TSDBSnapshotRequest) (*pb.TSDBSnapshotResponse, error) { return nil, status.Error(codes.Unavailable, "Admin APIs are disabled") } // DeleteSeries imeplements pb.AdminServer. -func (s *adminDisabled) DeleteSeries(_ context.Context, r *pb.SeriesDeleteRequest) (*pb.SeriesDeleteResponse, error) { +func (s *adminDisabled) DeleteSeries(_ old_ctx.Context, r *pb.SeriesDeleteRequest) (*pb.SeriesDeleteResponse, error) { return nil, status.Error(codes.Unavailable, "Admin APIs are disabled") } @@ -161,7 +162,7 @@ func NewAdmin(db func() *tsdb.DB) *Admin { } // TSDBSnapshot implements pb.AdminServer. -func (s *Admin) TSDBSnapshot(_ context.Context, _ *pb.TSDBSnapshotRequest) (*pb.TSDBSnapshotResponse, error) { +func (s *Admin) TSDBSnapshot(_ old_ctx.Context, _ *pb.TSDBSnapshotRequest) (*pb.TSDBSnapshotResponse, error) { db := s.db() if db == nil { return nil, status.Errorf(codes.Unavailable, "TSDB not ready") @@ -181,7 +182,7 @@ func (s *Admin) TSDBSnapshot(_ context.Context, _ *pb.TSDBSnapshotRequest) (*pb. } // DeleteSeries implements pb.AdminServer. -func (s *Admin) DeleteSeries(_ context.Context, r *pb.SeriesDeleteRequest) (*pb.SeriesDeleteResponse, error) { +func (s *Admin) DeleteSeries(_ old_ctx.Context, r *pb.SeriesDeleteRequest) (*pb.SeriesDeleteResponse, error) { mint, maxt, err := extractTimeRange(r.MinTime, r.MaxTime) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) diff --git a/web/web.go b/web/web.go index 04d7f11ed..93e37dcb4 100644 --- a/web/web.go +++ b/web/web.go @@ -15,6 +15,7 @@ package web import ( "bytes" + "context" "encoding/json" "fmt" "io" @@ -41,23 +42,22 @@ import ( "github.com/cockroachdb/cmux" "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/mwitkow/go-conntrack" "github.com/opentracing-contrib/go-stdlib/nethttp" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/common/route" - "github.com/prometheus/prometheus/storage" "github.com/prometheus/tsdb" - "golang.org/x/net/context" "golang.org/x/net/netutil" - "github.com/mwitkow/go-conntrack" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/notifier" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/retrieval" "github.com/prometheus/prometheus/rules" + "github.com/prometheus/prometheus/storage" "github.com/prometheus/prometheus/template" "github.com/prometheus/prometheus/util/httputil" api_v1 "github.com/prometheus/prometheus/web/api/v1"