Skip to content

Commit f8275e6

Browse files
authored
Merge pull request #171 from Nexucis/feature/bump-client-go
upgrade dependency client_golang to v1.7.0
2 parents ca17700 + 0dd3f9e commit f8275e6

File tree

7 files changed

+34
-18
lines changed

7 files changed

+34
-18
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/gorilla/websocket v1.4.2
99
github.com/kelseyhightower/envconfig v1.4.0
1010
github.com/pkg/errors v0.9.1
11-
github.com/prometheus/client_golang v1.6.0
11+
github.com/prometheus/client_golang v1.7.0
1212
github.com/prometheus/common v0.10.0
1313
github.com/prometheus/prometheus v1.8.2-0.20200507164740-ecee9c8abfd1
1414
github.com/rakyll/statik v0.1.7

go.sum

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
306306
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
307307
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
308308
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
309+
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
310+
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
309311
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
310312
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
311313
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
@@ -430,6 +432,8 @@ github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46O
430432
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
431433
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
432434
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
435+
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
436+
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
433437
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
434438
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
435439
github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o=
@@ -590,8 +594,8 @@ github.com/prometheus/client_golang v1.3.0 h1:miYCvYqFXtl/J9FIy8eNpBfYthAEFg+Ys0
590594
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
591595
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
592596
github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
593-
github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A=
594-
github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4=
597+
github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U=
598+
github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
595599
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
596600
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
597601
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -618,6 +622,8 @@ github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLk
618622
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
619623
github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI=
620624
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
625+
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
626+
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
621627
github.com/prometheus/prometheus v1.8.2-0.20200507164740-ecee9c8abfd1 h1:Oh/bmW9DXCbMeAZbxMmt2wuY6Q4cD0IIbR6vJP3kdHg=
622628
github.com/prometheus/prometheus v1.8.2-0.20200507164740-ecee9c8abfd1/go.mod h1:S5n0C6tSgdnwWshBUceRx5G1OsjLv/EeZ9t3wIfEtsY=
623629
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
@@ -872,6 +878,8 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
872878
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
873879
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8=
874880
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
881+
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
882+
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
875883
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
876884
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
877885
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1013,6 +1021,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
10131021
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
10141022
google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw=
10151023
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
1024+
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
1025+
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
10161026
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
10171027
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10181028
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

langserver/completion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ OUTER:
355355

356356
// nolint: funlen
357357
func (s *server) completeLabelValue(ctx context.Context, completions *[]protocol.CompletionItem, location *cache.Location, labelName string) error {
358-
labelValues, err := s.metadataService.LabelValues(ctx, labelName)
358+
labelValues, err := s.metadataService.LabelValues(ctx, labelName, time.Now().Add(-100*time.Hour), time.Now())
359359
if err != nil {
360360
// nolint: errcheck
361361
s.client.LogMessage(s.lifetime, &protocol.LogMessageParams{

prometheus/compatible.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ func (c *compatibleHTTPClient) AllMetricMetadata(ctx context.Context) (map[strin
4646
return c.prometheusClient.Metadata(ctx, "", "")
4747
}
4848

49-
func (c *compatibleHTTPClient) LabelNames(ctx context.Context, name string, startTime time.Time, endTime time.Time) ([]string, error) {
49+
func (c *compatibleHTTPClient) LabelNames(ctx context.Context, name string,
50+
startTime time.Time, endTime time.Time) ([]string, error) {
5051
if len(name) == 0 {
51-
names, _, err := c.prometheusClient.LabelNames(ctx)
52+
names, _, err := c.prometheusClient.LabelNames(ctx, startTime, endTime)
5253
return names, err
5354
}
5455
labelNames, _, err := c.prometheusClient.Series(ctx, []string{name}, startTime, endTime)
@@ -69,8 +70,9 @@ func (c *compatibleHTTPClient) LabelNames(ctx context.Context, name string, star
6970
return result, nil
7071
}
7172

72-
func (c *compatibleHTTPClient) LabelValues(ctx context.Context, label string) ([]model.LabelValue, error) {
73-
values, _, err := c.prometheusClient.LabelValues(ctx, label)
73+
func (c *compatibleHTTPClient) LabelValues(ctx context.Context, label string,
74+
startTime time.Time, endTime time.Time) ([]model.LabelValue, error) {
75+
values, _, err := c.prometheusClient.LabelValues(ctx, label, startTime, endTime)
7476
return values, err
7577
}
7678

prometheus/empty.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (c *emptyHTTPClient) LabelNames(_ context.Context, _ string, _ time.Time, _
3838
return []string{}, nil
3939
}
4040

41-
func (c *emptyHTTPClient) LabelValues(_ context.Context, _ string) ([]model.LabelValue, error) {
41+
func (c *emptyHTTPClient) LabelValues(_ context.Context, _ string, _ time.Time, _ time.Time) ([]model.LabelValue, error) {
4242
return []model.LabelValue{}, nil
4343
}
4444

prometheus/metadata_service.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type MetadataService interface {
9494
// If a metric is provided, then it will return all unique label names linked to the metric during a predefined period of time
9595
LabelNames(ctx context.Context, metricName string, startTime time.Time, endTime time.Time) ([]string, error)
9696
// LabelValues performs a query for the values of the given label.
97-
LabelValues(ctx context.Context, label string) ([]model.LabelValue, error)
97+
LabelValues(ctx context.Context, label string, startTime time.Time, endTime time.Time) ([]model.LabelValue, error)
9898
// ChangeDataSource is used if the prometheusURL is changing.
9999
// The client should re init its own parameter accordingly if necessary
100100
ChangeDataSource(prometheusURL string) error
@@ -136,16 +136,18 @@ func (c *httpClient) AllMetricMetadata(ctx context.Context) (map[string][]v1.Met
136136
return c.subClient.AllMetricMetadata(ctx)
137137
}
138138

139-
func (c *httpClient) LabelNames(ctx context.Context, name string, startTime time.Time, endTime time.Time) ([]string, error) {
139+
func (c *httpClient) LabelNames(ctx context.Context, name string,
140+
startTime time.Time, endTime time.Time) ([]string, error) {
140141
c.mutex.RLock()
141142
defer c.mutex.RUnlock()
142143
return c.subClient.LabelNames(ctx, name, startTime, endTime)
143144
}
144145

145-
func (c *httpClient) LabelValues(ctx context.Context, label string) ([]model.LabelValue, error) {
146+
func (c *httpClient) LabelValues(ctx context.Context, label string,
147+
startTime time.Time, endTime time.Time) ([]model.LabelValue, error) {
146148
c.mutex.RLock()
147149
defer c.mutex.RUnlock()
148-
return c.subClient.LabelValues(ctx, label)
150+
return c.subClient.LabelValues(ctx, label, startTime, endTime)
149151
}
150152

151153
func (c *httpClient) GetURL() string {

prometheus/not_compatible.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (c *notCompatibleHTTPClient) MetricMetadata(ctx context.Context, metric str
4343
}
4444

4545
func (c *notCompatibleHTTPClient) AllMetricMetadata(ctx context.Context) (map[string][]v1.Metadata, error) {
46-
metricNames, _, err := c.prometheusClient.LabelValues(ctx, "__name__")
46+
metricNames, _, err := c.prometheusClient.LabelValues(ctx, "__name__", time.Now().Add(-100*time.Hour), time.Now())
4747
if err != nil {
4848
return nil, err
4949
}
@@ -54,9 +54,10 @@ func (c *notCompatibleHTTPClient) AllMetricMetadata(ctx context.Context) (map[st
5454
return allMetadata, nil
5555
}
5656

57-
func (c *notCompatibleHTTPClient) LabelNames(ctx context.Context, name string, startTime time.Time, endTime time.Time) ([]string, error) {
57+
func (c *notCompatibleHTTPClient) LabelNames(ctx context.Context, name string,
58+
startTime time.Time, endTime time.Time) ([]string, error) {
5859
if len(name) == 0 {
59-
names, _, err := c.prometheusClient.LabelNames(ctx)
60+
names, _, err := c.prometheusClient.LabelNames(ctx, startTime, endTime)
6061
return names, err
6162
}
6263
labelNames, _, err := c.prometheusClient.Series(ctx, []string{name}, startTime, endTime)
@@ -77,8 +78,9 @@ func (c *notCompatibleHTTPClient) LabelNames(ctx context.Context, name string, s
7778
return result, nil
7879
}
7980

80-
func (c *notCompatibleHTTPClient) LabelValues(ctx context.Context, label string) ([]model.LabelValue, error) {
81-
values, _, err := c.prometheusClient.LabelValues(ctx, label)
81+
func (c *notCompatibleHTTPClient) LabelValues(ctx context.Context, label string,
82+
startTime time.Time, endTime time.Time) ([]model.LabelValue, error) {
83+
values, _, err := c.prometheusClient.LabelValues(ctx, label, startTime, endTime)
8284
return values, err
8385
}
8486

0 commit comments

Comments
 (0)