Skip to content

Commit f5c08d9

Browse files
committed
Revert "collector: add tasks API collection (prometheus-community#778)"
This reverts commit 7a98b17.
1 parent 1ac3623 commit f5c08d9

File tree

7 files changed

+16
-260
lines changed

7 files changed

+16
-260
lines changed

collector/cluster_info.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type VersionInfo struct {
7777
LuceneVersion semver.Version `json:"lucene_version"`
7878
}
7979

80-
func (c *ClusterInfoCollector) Update(_ context.Context, ch chan<- prometheus.Metric) error {
80+
func (c *ClusterInfoCollector) Update(ctx context.Context, ch chan<- prometheus.Metric) error {
8181
resp, err := c.hc.Get(c.u.String())
8282
if err != nil {
8383
return err

collector/cluster_settings_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package collector
1515

1616
import (
17+
"context"
1718
"io"
1819
"net/http"
1920
"net/http/httptest"
@@ -23,9 +24,21 @@ import (
2324
"testing"
2425

2526
"github.com/go-kit/log"
27+
"github.com/prometheus/client_golang/prometheus"
2628
"github.com/prometheus/client_golang/prometheus/testutil"
2729
)
2830

31+
type wrapCollector struct {
32+
c Collector
33+
}
34+
35+
func (w wrapCollector) Describe(ch chan<- *prometheus.Desc) {
36+
}
37+
38+
func (w wrapCollector) Collect(ch chan<- prometheus.Metric) {
39+
w.c.Update(context.Background(), ch)
40+
}
41+
2942
func TestClusterSettingsStats(t *testing.T) {
3043
// Testcases created using:
3144
// docker run -d -p 9200:9200 elasticsearch:VERSION-alpine

collector/collector_test.go

-36
This file was deleted.

collector/nodes_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ type basicAuth struct {
138138
Next http.Handler
139139
}
140140

141-
func (h *basicAuth) checkAuth(_ http.ResponseWriter, r *http.Request) bool {
141+
func (h *basicAuth) checkAuth(w http.ResponseWriter, r *http.Request) bool {
142142
s := strings.SplitN(r.Header.Get("Authorization"), " ", 2)
143143
if len(s) != 2 {
144144
return false

collector/tasks.go

-143
This file was deleted.

collector/tasks_test.go

-78
This file was deleted.

pkg/clusterinfo/clusterinfo_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const (
4444

4545
type mockES struct{}
4646

47-
func (mockES) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
47+
func (mockES) ServeHTTP(w http.ResponseWriter, r *http.Request) {
4848

4949
fmt.Fprintf(w, `{
5050
"name" : "%s",

0 commit comments

Comments
 (0)