From 0669e2dca18307ae460a89251c4e1d130fe6b330 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:09:55 +0000 Subject: [PATCH 01/11] Bump github.com/prometheus/common from 0.44.0 to 0.45.0 Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.44.0 to 0.45.0. - [Release notes](https://github.com/prometheus/common/releases) - [Commits](https://github.com/prometheus/common/compare/v0.44.0...v0.45.0) --- updated-dependencies: - dependency-name: github.com/prometheus/common dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 14 ++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 43b6745c..a163d999 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/go-kit/log v0.2.1 github.com/imdario/mergo v0.3.13 github.com/prometheus/client_golang v1.17.0 - github.com/prometheus/common v0.44.0 + github.com/prometheus/common v0.45.0 github.com/prometheus/exporter-toolkit v0.10.0 ) @@ -34,14 +34,14 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/kr/text v0.2.0 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect github.com/prometheus/procfs v0.11.1 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect golang.org/x/crypto v0.14.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect + golang.org/x/oauth2 v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/go.sum b/go.sum index 8b84485d..86b9693d 100644 --- a/go.sum +++ b/go.sum @@ -43,7 +43,6 @@ github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= @@ -60,8 +59,8 @@ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -70,8 +69,8 @@ github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1 github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/exporter-toolkit v0.10.0 h1:yOAzZTi4M22ZzVxD+fhy1URTuNRj/36uQJJ5S8IPza8= github.com/prometheus/exporter-toolkit v0.10.0/go.mod h1:+sVFzuvV5JDyw+Ih6p3zFxZNVnKQa3x5qPmDSiPu4ZY= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= @@ -88,9 +87,8 @@ golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= From acddc580d6b807d3400a4d711cf2516049912f39 Mon Sep 17 00:00:00 2001 From: Joe Adams Date: Tue, 14 Nov 2023 21:29:18 -0500 Subject: [PATCH 02/11] Refactor tests for cluster health - Remove up, totalScrapes, and jsonParseFailures metrics. They are not useful. - Move fixtures to individual files - Base tests on the metric output for better testing the expected output instead of the internals. Signed-off-by: Joe Adams --- collector/cluster_health.go | 32 ---- collector/cluster_health_test.go | 245 +++++++++++++++++++++++++----- fixtures/clusterhealth/1.7.6.json | 15 ++ fixtures/clusterhealth/2.4.5.json | 17 +++ fixtures/clusterhealth/5.4.2.json | 17 +++ 5 files changed, 255 insertions(+), 71 deletions(-) create mode 100644 fixtures/clusterhealth/1.7.6.json create mode 100644 fixtures/clusterhealth/2.4.5.json create mode 100644 fixtures/clusterhealth/5.4.2.json diff --git a/collector/cluster_health.go b/collector/cluster_health.go index 0ea351d3..29f3a41c 100644 --- a/collector/cluster_health.go +++ b/collector/cluster_health.go @@ -50,9 +50,6 @@ type ClusterHealth struct { client *http.Client url *url.URL - up prometheus.Gauge - totalScrapes, jsonParseFailures prometheus.Counter - metrics []*clusterHealthMetric statusMetric *clusterHealthStatusMetric } @@ -66,19 +63,6 @@ func NewClusterHealth(logger log.Logger, client *http.Client, url *url.URL) *Clu client: client, url: url, - up: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "up"), - Help: "Was the last scrape of the Elasticsearch cluster health endpoint successful.", - }), - totalScrapes: prometheus.NewCounter(prometheus.CounterOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "total_scrapes"), - Help: "Current total Elasticsearch cluster health scrapes.", - }), - jsonParseFailures: prometheus.NewCounter(prometheus.CounterOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "json_parse_failures"), - Help: "Number of errors while parsing JSON.", - }), - metrics: []*clusterHealthMetric{ { Type: prometheus.GaugeValue, @@ -225,10 +209,6 @@ func (c *ClusterHealth) Describe(ch chan<- *prometheus.Desc) { ch <- metric.Desc } ch <- c.statusMetric.Desc - - ch <- c.up.Desc() - ch <- c.totalScrapes.Desc() - ch <- c.jsonParseFailures.Desc() } func (c *ClusterHealth) fetchAndDecodeClusterHealth() (clusterHealthResponse, error) { @@ -258,12 +238,10 @@ func (c *ClusterHealth) fetchAndDecodeClusterHealth() (clusterHealthResponse, er bts, err := io.ReadAll(res.Body) if err != nil { - c.jsonParseFailures.Inc() return chr, err } if err := json.Unmarshal(bts, &chr); err != nil { - c.jsonParseFailures.Inc() return chr, err } @@ -272,24 +250,14 @@ func (c *ClusterHealth) fetchAndDecodeClusterHealth() (clusterHealthResponse, er // Collect collects ClusterHealth metrics. func (c *ClusterHealth) Collect(ch chan<- prometheus.Metric) { - var err error - c.totalScrapes.Inc() - defer func() { - ch <- c.up - ch <- c.totalScrapes - ch <- c.jsonParseFailures - }() - clusterHealthResp, err := c.fetchAndDecodeClusterHealth() if err != nil { - c.up.Set(0) level.Warn(c.logger).Log( "msg", "failed to fetch and decode cluster health", "err", err, ) return } - c.up.Set(1) for _, metric := range c.metrics { ch <- prometheus.MustNewConstMetric( diff --git a/collector/cluster_health_test.go b/collector/cluster_health_test.go index aac34af0..57ba94f3 100644 --- a/collector/cluster_health_test.go +++ b/collector/cluster_health_test.go @@ -14,13 +14,16 @@ package collector import ( - "fmt" + "io" "net/http" "net/http/httptest" "net/url" + "os" + "strings" "testing" "github.com/go-kit/log" + "github.com/prometheus/client_golang/prometheus/testutil" ) func TestClusterHealth(t *testing.T) { @@ -28,46 +31,210 @@ func TestClusterHealth(t *testing.T) { // docker run -d -p 9200:9200 elasticsearch:VERSION-alpine // curl -XPUT http://localhost:9200/twitter // curl http://localhost:9200/_cluster/health - tcs := map[string]string{ - "1.7.6": `{"cluster_name":"elasticsearch","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0}`, - "2.4.5": `{"cluster_name":"elasticsearch","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":12,"active_shards_percent_as_number":50.0}`, - "5.4.2": `{"cluster_name":"elasticsearch","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":12,"active_shards_percent_as_number":50.0}`, + + tests := []struct { + name string + file string + want string + }{ + { + name: "1.7.6", + file: "../fixtures/clusterhealth/1.7.6.json", + want: ` + # HELP elasticsearch_cluster_health_active_primary_shards The number of primary shards in your cluster. This is an aggregate total across all indices. + # TYPE elasticsearch_cluster_health_active_primary_shards gauge + elasticsearch_cluster_health_active_primary_shards{cluster="elasticsearch"} 5 + # HELP elasticsearch_cluster_health_active_shards Aggregate total of all shards across all indices, which includes replica shards. + # TYPE elasticsearch_cluster_health_active_shards gauge + elasticsearch_cluster_health_active_shards{cluster="elasticsearch"} 5 + # HELP elasticsearch_cluster_health_delayed_unassigned_shards Shards delayed to reduce reallocation overhead + # TYPE elasticsearch_cluster_health_delayed_unassigned_shards gauge + elasticsearch_cluster_health_delayed_unassigned_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_initializing_shards Count of shards that are being freshly created. + # TYPE elasticsearch_cluster_health_initializing_shards gauge + elasticsearch_cluster_health_initializing_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_number_of_data_nodes Number of data nodes in the cluster. + # TYPE elasticsearch_cluster_health_number_of_data_nodes gauge + elasticsearch_cluster_health_number_of_data_nodes{cluster="elasticsearch"} 1 + # HELP elasticsearch_cluster_health_number_of_in_flight_fetch The number of ongoing shard info requests. + # TYPE elasticsearch_cluster_health_number_of_in_flight_fetch gauge + elasticsearch_cluster_health_number_of_in_flight_fetch{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_number_of_nodes Number of nodes in the cluster. + # TYPE elasticsearch_cluster_health_number_of_nodes gauge + elasticsearch_cluster_health_number_of_nodes{cluster="elasticsearch"} 1 + # HELP elasticsearch_cluster_health_number_of_pending_tasks Cluster level changes which have not yet been executed + # TYPE elasticsearch_cluster_health_number_of_pending_tasks gauge + elasticsearch_cluster_health_number_of_pending_tasks{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_relocating_shards The number of shards that are currently moving from one node to another node. + # TYPE elasticsearch_cluster_health_relocating_shards gauge + elasticsearch_cluster_health_relocating_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_status Whether all primary and replica shards are allocated. + # TYPE elasticsearch_cluster_health_status gauge + elasticsearch_cluster_health_status{cluster="elasticsearch",color="green"} 0 + elasticsearch_cluster_health_status{cluster="elasticsearch",color="red"} 0 + elasticsearch_cluster_health_status{cluster="elasticsearch",color="yellow"} 1 + # HELP elasticsearch_cluster_health_task_max_waiting_in_queue_millis Tasks max time waiting in queue. + # TYPE elasticsearch_cluster_health_task_max_waiting_in_queue_millis gauge + elasticsearch_cluster_health_task_max_waiting_in_queue_millis{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_unassigned_shards The number of shards that exist in the cluster state, but cannot be found in the cluster itself. + # TYPE elasticsearch_cluster_health_unassigned_shards gauge + elasticsearch_cluster_health_unassigned_shards{cluster="elasticsearch"} 5 + `, + }, + { + name: "2.4.5", + file: "../fixtures/clusterhealth/2.4.5.json", + want: ` + # HELP elasticsearch_cluster_health_active_primary_shards The number of primary shards in your cluster. This is an aggregate total across all indices. + # TYPE elasticsearch_cluster_health_active_primary_shards gauge + elasticsearch_cluster_health_active_primary_shards{cluster="elasticsearch"} 5 + # HELP elasticsearch_cluster_health_active_shards Aggregate total of all shards across all indices, which includes replica shards. + # TYPE elasticsearch_cluster_health_active_shards gauge + elasticsearch_cluster_health_active_shards{cluster="elasticsearch"} 5 + # HELP elasticsearch_cluster_health_delayed_unassigned_shards Shards delayed to reduce reallocation overhead + # TYPE elasticsearch_cluster_health_delayed_unassigned_shards gauge + elasticsearch_cluster_health_delayed_unassigned_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_initializing_shards Count of shards that are being freshly created. + # TYPE elasticsearch_cluster_health_initializing_shards gauge + elasticsearch_cluster_health_initializing_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_number_of_data_nodes Number of data nodes in the cluster. + # TYPE elasticsearch_cluster_health_number_of_data_nodes gauge + elasticsearch_cluster_health_number_of_data_nodes{cluster="elasticsearch"} 1 + # HELP elasticsearch_cluster_health_number_of_in_flight_fetch The number of ongoing shard info requests. + # TYPE elasticsearch_cluster_health_number_of_in_flight_fetch gauge + elasticsearch_cluster_health_number_of_in_flight_fetch{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_number_of_nodes Number of nodes in the cluster. + # TYPE elasticsearch_cluster_health_number_of_nodes gauge + elasticsearch_cluster_health_number_of_nodes{cluster="elasticsearch"} 1 + # HELP elasticsearch_cluster_health_number_of_pending_tasks Cluster level changes which have not yet been executed + # TYPE elasticsearch_cluster_health_number_of_pending_tasks gauge + elasticsearch_cluster_health_number_of_pending_tasks{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_relocating_shards The number of shards that are currently moving from one node to another node. + # TYPE elasticsearch_cluster_health_relocating_shards gauge + elasticsearch_cluster_health_relocating_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_status Whether all primary and replica shards are allocated. + # TYPE elasticsearch_cluster_health_status gauge + elasticsearch_cluster_health_status{cluster="elasticsearch",color="green"} 0 + elasticsearch_cluster_health_status{cluster="elasticsearch",color="red"} 0 + elasticsearch_cluster_health_status{cluster="elasticsearch",color="yellow"} 1 + # HELP elasticsearch_cluster_health_task_max_waiting_in_queue_millis Tasks max time waiting in queue. + # TYPE elasticsearch_cluster_health_task_max_waiting_in_queue_millis gauge + elasticsearch_cluster_health_task_max_waiting_in_queue_millis{cluster="elasticsearch"} 12 + # HELP elasticsearch_cluster_health_unassigned_shards The number of shards that exist in the cluster state, but cannot be found in the cluster itself. + # TYPE elasticsearch_cluster_health_unassigned_shards gauge + elasticsearch_cluster_health_unassigned_shards{cluster="elasticsearch"} 5 + `, + }, + { + name: "5.4.2", + file: "../fixtures/clusterhealth/5.4.2.json", + want: ` + # HELP elasticsearch_cluster_health_active_primary_shards The number of primary shards in your cluster. This is an aggregate total across all indices. + # TYPE elasticsearch_cluster_health_active_primary_shards gauge + elasticsearch_cluster_health_active_primary_shards{cluster="elasticsearch"} 5 + # HELP elasticsearch_cluster_health_active_shards Aggregate total of all shards across all indices, which includes replica shards. + # TYPE elasticsearch_cluster_health_active_shards gauge + elasticsearch_cluster_health_active_shards{cluster="elasticsearch"} 5 + # HELP elasticsearch_cluster_health_delayed_unassigned_shards Shards delayed to reduce reallocation overhead + # TYPE elasticsearch_cluster_health_delayed_unassigned_shards gauge + elasticsearch_cluster_health_delayed_unassigned_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_initializing_shards Count of shards that are being freshly created. + # TYPE elasticsearch_cluster_health_initializing_shards gauge + elasticsearch_cluster_health_initializing_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_number_of_data_nodes Number of data nodes in the cluster. + # TYPE elasticsearch_cluster_health_number_of_data_nodes gauge + elasticsearch_cluster_health_number_of_data_nodes{cluster="elasticsearch"} 1 + # HELP elasticsearch_cluster_health_number_of_in_flight_fetch The number of ongoing shard info requests. + # TYPE elasticsearch_cluster_health_number_of_in_flight_fetch gauge + elasticsearch_cluster_health_number_of_in_flight_fetch{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_number_of_nodes Number of nodes in the cluster. + # TYPE elasticsearch_cluster_health_number_of_nodes gauge + elasticsearch_cluster_health_number_of_nodes{cluster="elasticsearch"} 1 + # HELP elasticsearch_cluster_health_number_of_pending_tasks Cluster level changes which have not yet been executed + # TYPE elasticsearch_cluster_health_number_of_pending_tasks gauge + elasticsearch_cluster_health_number_of_pending_tasks{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_relocating_shards The number of shards that are currently moving from one node to another node. + # TYPE elasticsearch_cluster_health_relocating_shards gauge + elasticsearch_cluster_health_relocating_shards{cluster="elasticsearch"} 0 + # HELP elasticsearch_cluster_health_status Whether all primary and replica shards are allocated. + # TYPE elasticsearch_cluster_health_status gauge + elasticsearch_cluster_health_status{cluster="elasticsearch",color="green"} 0 + elasticsearch_cluster_health_status{cluster="elasticsearch",color="red"} 0 + elasticsearch_cluster_health_status{cluster="elasticsearch",color="yellow"} 1 + # HELP elasticsearch_cluster_health_task_max_waiting_in_queue_millis Tasks max time waiting in queue. + # TYPE elasticsearch_cluster_health_task_max_waiting_in_queue_millis gauge + elasticsearch_cluster_health_task_max_waiting_in_queue_millis{cluster="elasticsearch"} 12 + # HELP elasticsearch_cluster_health_unassigned_shards The number of shards that exist in the cluster state, but cannot be found in the cluster itself. + # TYPE elasticsearch_cluster_health_unassigned_shards gauge + elasticsearch_cluster_health_unassigned_shards{cluster="elasticsearch"} 5 + `, + }, } - for ver, out := range tcs { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, out) - })) - defer ts.Close() - u, err := url.Parse(ts.URL) - if err != nil { - t.Fatalf("Failed to parse URL: %s", err) - } - c := NewClusterHealth(log.NewNopLogger(), http.DefaultClient, u) - chr, err := c.fetchAndDecodeClusterHealth() - if err != nil { - t.Fatalf("Failed to fetch or decode cluster health: %s", err) - } - t.Logf("[%s] Cluster Health Response: %+v", ver, chr) - if chr.ClusterName != "elasticsearch" { - t.Errorf("Invalid cluster health response") - } - if chr.Status != "yellow" { - t.Errorf("Invalid cluster status") - } - if chr.TimedOut { - t.Errorf("Check didn't time out") - } - if chr.NumberOfNodes != 1 { - t.Errorf("Wrong number of nodes") - } - if chr.NumberOfDataNodes != 1 { - t.Errorf("Wrong number of data nodes") - } - if ver != "1.7.6" { - if chr.TaskMaxWaitingInQueueMillis != 12 { - t.Errorf("Wrong task max waiting time in millis") + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f, err := os.Open(tt.file) + if err != nil { + t.Fatal(err) + } + defer f.Close() + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + io.Copy(w, f) + })) + defer ts.Close() + + u, err := url.Parse(ts.URL) + if err != nil { + t.Fatal(err) + } + + c := NewClusterHealth(log.NewNopLogger(), http.DefaultClient, u) + if err != nil { + t.Fatal(err) + } + + if err := testutil.CollectAndCompare(c, strings.NewReader(tt.want)); err != nil { + t.Fatal(err) } - } + }) } + + // for ver, out := range tcs { + // ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // fmt.Fprintln(w, out) + // })) + // defer ts.Close() + + // u, err := url.Parse(ts.URL) + // if err != nil { + // t.Fatalf("Failed to parse URL: %s", err) + // } + // c := NewClusterHealth(log.NewNopLogger(), http.DefaultClient, u) + // chr, err := c.fetchAndDecodeClusterHealth() + // if err != nil { + // t.Fatalf("Failed to fetch or decode cluster health: %s", err) + // } + // t.Logf("[%s] Cluster Health Response: %+v", ver, chr) + // if chr.ClusterName != "elasticsearch" { + // t.Errorf("Invalid cluster health response") + // } + // if chr.Status != "yellow" { + // t.Errorf("Invalid cluster status") + // } + // if chr.TimedOut { + // t.Errorf("Check didn't time out") + // } + // if chr.NumberOfNodes != 1 { + // t.Errorf("Wrong number of nodes") + // } + // if chr.NumberOfDataNodes != 1 { + // t.Errorf("Wrong number of data nodes") + // } + // if ver != "1.7.6" { + // if chr.TaskMaxWaitingInQueueMillis != 12 { + // t.Errorf("Wrong task max waiting time in millis") + // } + // } + // } } diff --git a/fixtures/clusterhealth/1.7.6.json b/fixtures/clusterhealth/1.7.6.json new file mode 100644 index 00000000..39d3a368 --- /dev/null +++ b/fixtures/clusterhealth/1.7.6.json @@ -0,0 +1,15 @@ +{ + "cluster_name": "elasticsearch", + "status": "yellow", + "timed_out": false, + "number_of_nodes": 1, + "number_of_data_nodes": 1, + "active_primary_shards": 5, + "active_shards": 5, + "relocating_shards": 0, + "initializing_shards": 0, + "unassigned_shards": 5, + "delayed_unassigned_shards": 0, + "number_of_pending_tasks": 0, + "number_of_in_flight_fetch": 0 +} diff --git a/fixtures/clusterhealth/2.4.5.json b/fixtures/clusterhealth/2.4.5.json new file mode 100644 index 00000000..170f8616 --- /dev/null +++ b/fixtures/clusterhealth/2.4.5.json @@ -0,0 +1,17 @@ +{ + "cluster_name": "elasticsearch", + "status": "yellow", + "timed_out": false, + "number_of_nodes": 1, + "number_of_data_nodes": 1, + "active_primary_shards": 5, + "active_shards": 5, + "relocating_shards": 0, + "initializing_shards": 0, + "unassigned_shards": 5, + "delayed_unassigned_shards": 0, + "number_of_pending_tasks": 0, + "number_of_in_flight_fetch": 0, + "task_max_waiting_in_queue_millis": 12, + "active_shards_percent_as_number": 50.0 +} diff --git a/fixtures/clusterhealth/5.4.2.json b/fixtures/clusterhealth/5.4.2.json new file mode 100644 index 00000000..170f8616 --- /dev/null +++ b/fixtures/clusterhealth/5.4.2.json @@ -0,0 +1,17 @@ +{ + "cluster_name": "elasticsearch", + "status": "yellow", + "timed_out": false, + "number_of_nodes": 1, + "number_of_data_nodes": 1, + "active_primary_shards": 5, + "active_shards": 5, + "relocating_shards": 0, + "initializing_shards": 0, + "unassigned_shards": 5, + "delayed_unassigned_shards": 0, + "number_of_pending_tasks": 0, + "number_of_in_flight_fetch": 0, + "task_max_waiting_in_queue_millis": 12, + "active_shards_percent_as_number": 50.0 +} From 391c7df5b43ee30d251c89bb99b10254cf2609d0 Mon Sep 17 00:00:00 2001 From: Joe Adams Date: Tue, 14 Nov 2023 21:38:31 -0500 Subject: [PATCH 03/11] Refactor tests for ilm_indices - Remove up, totalScrapes, and jsonParseFailures metrics. They are not useful. - Move fixtures to individual files - Base tests on the metric output for better testing the expected output instead of the internals. Signed-off-by: Joe Adams --- collector/ilm_indices.go | 30 ----------- collector/ilm_indices_test.go | 92 +++++++++++++++------------------ fixtures/ilm_indices/6.6.0.json | 20 +++++++ 3 files changed, 63 insertions(+), 79 deletions(-) create mode 100644 fixtures/ilm_indices/6.6.0.json diff --git a/collector/ilm_indices.go b/collector/ilm_indices.go index 22410b00..2982675a 100644 --- a/collector/ilm_indices.go +++ b/collector/ilm_indices.go @@ -39,10 +39,6 @@ type IlmIndiciesCollector struct { client *http.Client url *url.URL - up prometheus.Gauge - totalScrapes prometheus.Counter - jsonParseFailures prometheus.Counter - ilmMetric ilmMetric } @@ -72,18 +68,6 @@ func NewIlmIndicies(logger log.Logger, client *http.Client, url *url.URL) *IlmIn client: client, url: url, - up: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "up"), - Help: "Was the last scrape of the ElasticSearch ILM endpoint successful.", - }), - totalScrapes: prometheus.NewCounter(prometheus.CounterOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "total_scrapes"), - Help: "Current total ElasticSearch ILM scrapes.", - }), - jsonParseFailures: prometheus.NewCounter(prometheus.CounterOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "json_parse_failures"), - Help: "Number of errors while parsing JSON.", - }), ilmMetric: ilmMetric{ Type: prometheus.GaugeValue, Desc: prometheus.NewDesc( @@ -100,9 +84,6 @@ func NewIlmIndicies(logger log.Logger, client *http.Client, url *url.URL) *IlmIn // Describe adds metrics description func (i *IlmIndiciesCollector) Describe(ch chan<- *prometheus.Desc) { ch <- i.ilmMetric.Desc - ch <- i.up.Desc() - ch <- i.totalScrapes.Desc() - ch <- i.jsonParseFailures.Desc() } func (i *IlmIndiciesCollector) fetchAndDecodeIlm() (IlmResponse, error) { @@ -133,12 +114,10 @@ func (i *IlmIndiciesCollector) fetchAndDecodeIlm() (IlmResponse, error) { bts, err := io.ReadAll(res.Body) if err != nil { - i.jsonParseFailures.Inc() return ir, err } if err := json.Unmarshal(bts, &ir); err != nil { - i.jsonParseFailures.Inc() return ir, err } @@ -154,24 +133,15 @@ func bool2int(managed bool) float64 { // Collect pulls metric values from Elasticsearch func (i *IlmIndiciesCollector) Collect(ch chan<- prometheus.Metric) { - defer func() { - ch <- i.up - ch <- i.totalScrapes - ch <- i.jsonParseFailures - }() - // indices ilmResp, err := i.fetchAndDecodeIlm() if err != nil { - i.up.Set(0) level.Warn(i.logger).Log( "msg", "failed to fetch and decode ILM stats", "err", err, ) return } - i.totalScrapes.Inc() - i.up.Set(1) for indexName, indexIlm := range ilmResp.Indices { ch <- prometheus.MustNewConstMetric( diff --git a/collector/ilm_indices_test.go b/collector/ilm_indices_test.go index 27218f51..ed550da8 100644 --- a/collector/ilm_indices_test.go +++ b/collector/ilm_indices_test.go @@ -14,13 +14,16 @@ package collector import ( - "fmt" + "io" "net/http" "net/http/httptest" "net/url" + "os" + "strings" "testing" "github.com/go-kit/log" + "github.com/prometheus/client_golang/prometheus/testutil" ) func TestILMMetrics(t *testing.T) { @@ -61,57 +64,48 @@ func TestILMMetrics(t *testing.T) { // } // ' // curl http://localhost:9200/_all/_ilm/explain - tcs := map[string]string{ - "6.6.0": `{ - "indices": { - "twitter": { "index": "twitter", "managed": false }, - "facebook": { - "index": "facebook", - "managed": true, - "policy": "my_policy", - "lifecycle_date_millis": 1660799138565, - "phase": "new", - "phase_time_millis": 1660799138651, - "action": "complete", - "action_time_millis": 1660799138651, - "step": "complete", - "step_time_millis": 1660799138651 - } - } - }`, + tests := []struct { + name string + file string + want string + }{ + { + name: "6.6.0", + file: "../fixtures/ilm_indices/6.6.0.json", + want: ` +# HELP elasticsearch_ilm_index_status Status of ILM policy for index +# TYPE elasticsearch_ilm_index_status gauge +elasticsearch_ilm_index_status{action="",index="twitter",phase="",step=""} 0 +elasticsearch_ilm_index_status{action="complete",index="facebook",phase="new",step="complete"} 1 + `, + }, } - for ver, out := range tcs { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, out) - })) - defer ts.Close() + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f, err := os.Open(tt.file) + if err != nil { + t.Fatal(err) + } + defer f.Close() + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + io.Copy(w, f) + })) + defer ts.Close() - u, err := url.Parse(ts.URL) - if err != nil { - t.Fatalf("Failed to parse URL: %s", err) - } - c := NewIlmIndicies(log.NewNopLogger(), http.DefaultClient, u) - chr, err := c.fetchAndDecodeIlm() - if err != nil { - t.Fatalf("Failed to fetch or decode indices ilm metrics: %s", err) - } - t.Logf("[%s] indices ilm metrics Response: %+v", ver, chr) + u, err := url.Parse(ts.URL) + if err != nil { + t.Fatal(err) + } - if chr.Indices["twitter"].Managed != false { - t.Errorf("Invalid ilm metrics at twitter.managed") - } - if chr.Indices["facebook"].Managed != true { - t.Errorf("Invalid ilm metrics at facebook.managed") - } - if chr.Indices["facebook"].Phase != "new" { - t.Errorf("Invalid ilm metrics at facebook.phase") - } - if chr.Indices["facebook"].Action != "complete" { - t.Errorf("Invalid ilm metrics at facebook.action") - } - if chr.Indices["facebook"].Step != "complete" { - t.Errorf("Invalid ilm metrics at facebook.step") - } + c := NewIlmIndicies(log.NewNopLogger(), http.DefaultClient, u) + if err != nil { + t.Fatal(err) + } + if err := testutil.CollectAndCompare(c, strings.NewReader(tt.want)); err != nil { + t.Fatal(err) + } + }) } } diff --git a/fixtures/ilm_indices/6.6.0.json b/fixtures/ilm_indices/6.6.0.json new file mode 100644 index 00000000..73fb55a2 --- /dev/null +++ b/fixtures/ilm_indices/6.6.0.json @@ -0,0 +1,20 @@ +{ + "indices": { + "twitter": { + "index": "twitter", + "managed": false + }, + "facebook": { + "index": "facebook", + "managed": true, + "policy": "my_policy", + "lifecycle_date_millis": 1660799138565, + "phase": "new", + "phase_time_millis": 1660799138651, + "action": "complete", + "action_time_millis": 1660799138651, + "step": "complete", + "step_time_millis": 1660799138651 + } + } +} From 8e7aebfaddceffc863d028c9e5fecb8b52e78f86 Mon Sep 17 00:00:00 2001 From: Joe Adams Date: Tue, 14 Nov 2023 21:40:04 -0500 Subject: [PATCH 04/11] Remove extra commented code Signed-off-by: Joe Adams --- collector/cluster_health_test.go | 38 -------------------------------- 1 file changed, 38 deletions(-) diff --git a/collector/cluster_health_test.go b/collector/cluster_health_test.go index 57ba94f3..8d520f54 100644 --- a/collector/cluster_health_test.go +++ b/collector/cluster_health_test.go @@ -199,42 +199,4 @@ func TestClusterHealth(t *testing.T) { } }) } - - // for ver, out := range tcs { - // ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // fmt.Fprintln(w, out) - // })) - // defer ts.Close() - - // u, err := url.Parse(ts.URL) - // if err != nil { - // t.Fatalf("Failed to parse URL: %s", err) - // } - // c := NewClusterHealth(log.NewNopLogger(), http.DefaultClient, u) - // chr, err := c.fetchAndDecodeClusterHealth() - // if err != nil { - // t.Fatalf("Failed to fetch or decode cluster health: %s", err) - // } - // t.Logf("[%s] Cluster Health Response: %+v", ver, chr) - // if chr.ClusterName != "elasticsearch" { - // t.Errorf("Invalid cluster health response") - // } - // if chr.Status != "yellow" { - // t.Errorf("Invalid cluster status") - // } - // if chr.TimedOut { - // t.Errorf("Check didn't time out") - // } - // if chr.NumberOfNodes != 1 { - // t.Errorf("Wrong number of nodes") - // } - // if chr.NumberOfDataNodes != 1 { - // t.Errorf("Wrong number of data nodes") - // } - // if ver != "1.7.6" { - // if chr.TaskMaxWaitingInQueueMillis != 12 { - // t.Errorf("Wrong task max waiting time in millis") - // } - // } - // } } From 989d4d608d2d84046846e23094868b049882c347 Mon Sep 17 00:00:00 2001 From: Joe Adams Date: Tue, 14 Nov 2023 21:46:15 -0500 Subject: [PATCH 05/11] Refactor tests for ilm_status - Remove up, totalScrapes, and jsonParseFailures metrics. They are not useful. - Move fixtures to individual files - Base tests on the metric output for better testing the expected output instead of the internals. Signed-off-by: Joe Adams --- collector/ilm_status.go | 29 -------------- collector/ilm_status_test.go | 70 +++++++++++++++++++++++----------- fixtures/ilm_status/6.6.0.json | 3 ++ 3 files changed, 51 insertions(+), 51 deletions(-) create mode 100644 fixtures/ilm_status/6.6.0.json diff --git a/collector/ilm_status.go b/collector/ilm_status.go index a00372df..57fda408 100644 --- a/collector/ilm_status.go +++ b/collector/ilm_status.go @@ -43,9 +43,6 @@ type IlmStatusCollector struct { client *http.Client url *url.URL - up prometheus.Gauge - totalScrapes, jsonParseFailures prometheus.Counter - metric ilmStatusMetric } @@ -62,18 +59,6 @@ func NewIlmStatus(logger log.Logger, client *http.Client, url *url.URL) *IlmStat client: client, url: url, - up: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "up"), - Help: "Was the last scrape of the ElasticSearch Indices Ilms endpoint successful.", - }), - totalScrapes: prometheus.NewCounter(prometheus.CounterOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "scrapes_total"), - Help: "Current total ElasticSearch Indices Ilms scrapes.", - }), - jsonParseFailures: prometheus.NewCounter(prometheus.CounterOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "json_parse_failures_total"), - Help: "Number of errors while parsing JSON.", - }), metric: ilmStatusMetric{ Type: prometheus.GaugeValue, Desc: prometheus.NewDesc( @@ -94,9 +79,6 @@ func NewIlmStatus(logger log.Logger, client *http.Client, url *url.URL) *IlmStat // Describe add Snapshots metrics descriptions func (im *IlmStatusCollector) Describe(ch chan<- *prometheus.Desc) { ch <- im.metric.Desc - ch <- im.up.Desc() - ch <- im.totalScrapes.Desc() - ch <- im.jsonParseFailures.Desc() } func (im *IlmStatusCollector) fetchAndDecodeIlm() (*IlmStatusResponse, error) { @@ -127,7 +109,6 @@ func (im *IlmStatusCollector) fetchAndDecodeIlm() (*IlmStatusResponse, error) { var imr IlmStatusResponse if err := json.Unmarshal(body, &imr); err != nil { - im.jsonParseFailures.Inc() return nil, err } @@ -136,24 +117,14 @@ func (im *IlmStatusCollector) fetchAndDecodeIlm() (*IlmStatusResponse, error) { // Collect gets all indices Ilms metric values func (im *IlmStatusCollector) Collect(ch chan<- prometheus.Metric) { - - im.totalScrapes.Inc() - defer func() { - ch <- im.up - ch <- im.totalScrapes - ch <- im.jsonParseFailures - }() - indicesIlmsResponse, err := im.fetchAndDecodeIlm() if err != nil { - im.up.Set(0) level.Warn(im.logger).Log( "msg", "failed to fetch and decode cluster ilm status", "err", err, ) return } - im.up.Set(1) for _, status := range ilmStatuses { ch <- prometheus.MustNewConstMetric( diff --git a/collector/ilm_status_test.go b/collector/ilm_status_test.go index 8744eec1..56254ba9 100644 --- a/collector/ilm_status_test.go +++ b/collector/ilm_status_test.go @@ -14,40 +14,66 @@ package collector import ( - "fmt" + "io" "net/http" "net/http/httptest" "net/url" + "os" + "strings" "testing" "github.com/go-kit/log" + "github.com/prometheus/client_golang/prometheus/testutil" ) func TestILMStatus(t *testing.T) { // Testcases created using: // docker run -d -p 9200:9200 elasticsearch:VERSION // curl http://localhost:9200/_ilm/status - tcs := map[string]string{ - "6.6.0": `{ "operation_mode": "RUNNING" }`, + tests := []struct { + name string + file string + want string + }{ + { + name: "6.6.0", + file: "../fixtures/ilm_status/6.6.0.json", + want: ` +# HELP elasticsearch_ilm_status Current status of ilm. Status can be STOPPED, RUNNING, STOPPING. +# TYPE elasticsearch_ilm_status gauge +elasticsearch_ilm_status{operation_mode="RUNNING"} 1 +elasticsearch_ilm_status{operation_mode="STOPPED"} 0 +elasticsearch_ilm_status{operation_mode="STOPPING"} 0 + `, + }, } - for ver, out := range tcs { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, out) - })) - defer ts.Close() - - u, err := url.Parse(ts.URL) - if err != nil { - t.Fatalf("Failed to parse URL: %s", err) - } - c := NewIlmStatus(log.NewNopLogger(), http.DefaultClient, u) - chr, err := c.fetchAndDecodeIlm() - if err != nil { - t.Fatalf("Failed to fetch or decode ilm status: %s", err) - } - t.Logf("[%s] ILM Status Response: %+v", ver, chr) - if chr.OperationMode != "RUNNING" { - t.Errorf("Invalid ilm status") - } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f, err := os.Open(tt.file) + if err != nil { + t.Fatal(err) + } + defer f.Close() + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + io.Copy(w, f) + })) + defer ts.Close() + + u, err := url.Parse(ts.URL) + if err != nil { + t.Fatal(err) + } + + c := NewIlmStatus(log.NewNopLogger(), http.DefaultClient, u) + if err != nil { + t.Fatal(err) + } + + if err := testutil.CollectAndCompare(c, strings.NewReader(tt.want)); err != nil { + t.Fatal(err) + } + }) } } diff --git a/fixtures/ilm_status/6.6.0.json b/fixtures/ilm_status/6.6.0.json new file mode 100644 index 00000000..6bf7b691 --- /dev/null +++ b/fixtures/ilm_status/6.6.0.json @@ -0,0 +1,3 @@ +{ + "operation_mode": "RUNNING" +} From 74d8ca45b033dd2c03d3e03d0faadf2bf390ac2c Mon Sep 17 00:00:00 2001 From: Joe Adams Date: Tue, 14 Nov 2023 21:57:40 -0500 Subject: [PATCH 06/11] Refactor tests for indices_mappings - Remove up, totalScrapes, and jsonParseFailures metrics. They are not useful. - Move fixtures to individual files - Base tests on the metric output for better testing the expected output instead of the internals. Signed-off-by: Joe Adams --- collector/indices_mappings.go | 30 --- collector/indices_mappings_test.go | 346 ++++---------------------- fixtures/indices_mappings/7.8.0.json | 43 ++++ fixtures/indices_mappings/counts.json | 183 ++++++++++++++ 4 files changed, 272 insertions(+), 330 deletions(-) create mode 100644 fixtures/indices_mappings/7.8.0.json create mode 100644 fixtures/indices_mappings/counts.json diff --git a/collector/indices_mappings.go b/collector/indices_mappings.go index bfe072ab..5f49eceb 100644 --- a/collector/indices_mappings.go +++ b/collector/indices_mappings.go @@ -42,9 +42,6 @@ type IndicesMappings struct { client *http.Client url *url.URL - up prometheus.Gauge - totalScrapes, jsonParseFailures prometheus.Counter - metrics []*indicesMappingsMetric } @@ -57,18 +54,6 @@ func NewIndicesMappings(logger log.Logger, client *http.Client, url *url.URL) *I client: client, url: url, - up: prometheus.NewGauge(prometheus.GaugeOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "up"), - Help: "Was the last scrape of the Elasticsearch Indices Mappings endpoint successful.", - }), - totalScrapes: prometheus.NewCounter(prometheus.CounterOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "scrapes_total"), - Help: "Current total Elasticsearch Indices Mappings scrapes.", - }), - jsonParseFailures: prometheus.NewCounter(prometheus.CounterOpts{ - Name: prometheus.BuildFQName(namespace, subsystem, "json_parse_failures_total"), - Help: "Number of errors while parsing JSON.", - }), metrics: []*indicesMappingsMetric{ { Type: prometheus.GaugeValue, @@ -117,10 +102,6 @@ func (im *IndicesMappings) Describe(ch chan<- *prometheus.Desc) { for _, metric := range im.metrics { ch <- metric.Desc } - - ch <- im.up.Desc() - ch <- im.totalScrapes.Desc() - ch <- im.jsonParseFailures.Desc() } func (im *IndicesMappings) getAndParseURL(u *url.URL) (*IndicesMappingsResponse, error) { @@ -148,7 +129,6 @@ func (im *IndicesMappings) getAndParseURL(u *url.URL) (*IndicesMappingsResponse, var imr IndicesMappingsResponse if err := json.Unmarshal(body, &imr); err != nil { - im.jsonParseFailures.Inc() return nil, err } @@ -163,24 +143,14 @@ func (im *IndicesMappings) fetchAndDecodeIndicesMappings() (*IndicesMappingsResp // Collect gets all indices mappings metric values func (im *IndicesMappings) Collect(ch chan<- prometheus.Metric) { - - im.totalScrapes.Inc() - defer func() { - ch <- im.up - ch <- im.totalScrapes - ch <- im.jsonParseFailures - }() - indicesMappingsResponse, err := im.fetchAndDecodeIndicesMappings() if err != nil { - im.up.Set(0) level.Warn(im.logger).Log( "msg", "failed to fetch and decode cluster mappings stats", "err", err, ) return } - im.up.Set(1) for _, metric := range im.metrics { for indexName, mappings := range *indicesMappingsResponse { diff --git a/collector/indices_mappings_test.go b/collector/indices_mappings_test.go index 7031ada2..65c61ffe 100644 --- a/collector/indices_mappings_test.go +++ b/collector/indices_mappings_test.go @@ -14,13 +14,16 @@ package collector import ( - "fmt" + "io" "net/http" "net/http/httptest" "net/url" + "os" + "strings" "testing" "github.com/go-kit/log" + "github.com/prometheus/client_golang/prometheus/testutil" ) func TestMapping(t *testing.T) { @@ -66,315 +69,58 @@ func TestMapping(t *testing.T) { } }'*/ // curl http://localhost:9200/_all/_mapping - tcs := map[string]string{ - "7.8.0": `{ - "facebook": { - "mappings": { - "properties": { - "contact": { - "properties": { - "email": { - "type": "text", - "fields": { - "raw": { - "type": "keyword" - } - } - }, - "phone": { - "type": "text" - } - } - }, - "name": { - "type": "text", - "fields": { - "raw": { - "type": "keyword" - } - } - } - } - } - }, - "twitter": { - "mappings": { - "properties": { - "email": { - "type": "keyword" - }, - "phone": { - "type": "keyword" - } - } - } - } - }`, + tests := []struct { + name string + file string + want string + }{ + { + name: "7.8.0", + file: "../fixtures/indices_mappings/7.8.0.json", + want: ` +# HELP elasticsearch_indices_mappings_stats_fields Current number fields within cluster. +# TYPE elasticsearch_indices_mappings_stats_fields gauge +elasticsearch_indices_mappings_stats_fields{index="facebook"} 6 +elasticsearch_indices_mappings_stats_fields{index="twitter"} 2 + `, + }, + { + name: "counts", + file: "../fixtures/indices_mappings/counts.json", + want: ` +# HELP elasticsearch_indices_mappings_stats_fields Current number fields within cluster. +# TYPE elasticsearch_indices_mappings_stats_fields gauge +elasticsearch_indices_mappings_stats_fields{index="test-data-2023.01.20"} 40 + `, + }, } - for ver, out := range tcs { - for hn, handler := range map[string]http.Handler{ - "plain": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, out) - }), - } { - ts := httptest.NewServer(handler) - defer ts.Close() - u, err := url.Parse(ts.URL) - if err != nil { - t.Fatalf("Failed to parse URL: %s", err) - } - c := NewIndicesMappings(log.NewNopLogger(), http.DefaultClient, u) - imr, err := c.fetchAndDecodeIndicesMappings() + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f, err := os.Open(tt.file) if err != nil { - t.Fatalf("Failed to fetch or decode indices mappings: %s", err) - } - t.Logf("[%s/%s] All Indices Mappings Response: %+v", hn, ver, imr) - - response := *imr - if *response["facebook"].Mappings.Properties["contact"].Properties["phone"].Type != "text" { - t.Errorf("Marshalling error at facebook.contact.phone") + t.Fatal(err) } + defer f.Close() - if *response["facebook"].Mappings.Properties["contact"].Properties["email"].Fields["raw"].Type != "keyword" { - t.Errorf("Marshalling error at facebook.contact.email.raw") - } - - if *response["facebook"].Mappings.Properties["name"].Type != "text" { - t.Errorf("Marshalling error at facebook.name") - } - - if *response["facebook"].Mappings.Properties["name"].Fields["raw"].Type != "keyword" { - t.Errorf("Marshalling error at facebook.name.raw") - } + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + io.Copy(w, f) + })) + defer ts.Close() - if *response["twitter"].Mappings.Properties["email"].Type != "keyword" { - t.Errorf("Marshalling error at twitter.email") + u, err := url.Parse(ts.URL) + if err != nil { + t.Fatal(err) } - if *response["twitter"].Mappings.Properties["phone"].Type != "keyword" { - t.Errorf("Marshalling error at twitter.phone") + c := NewIndicesMappings(log.NewNopLogger(), http.DefaultClient, u) + if err != nil { + t.Fatal(err) } - } - } -} - -func TestIndexMappingFieldCount(t *testing.T) { - - testIndexNumFields := 40.0 - testIndexName := "test-data-2023.01.20" - - rawMapping := `{ - "test-data-2023.01.20": { - "mappings": { - "properties": { - "data": { - "type": "object", - "properties": { - "field1": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field10": { - "type": "long" - }, - "field2": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field3": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field4": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field5": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field6": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field7": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field8": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field9": { - "type": "long" - } - } - }, - "data2": { - "properties": { - "field1": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field2": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field3": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field4": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field5": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "nested_field6": { - "properties": { - "field1": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field2": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field3": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field4": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "field5": { - "type": "long" - } - } - } - } - } - } - } + if err := testutil.CollectAndCompare(c, strings.NewReader(tt.want)); err != nil { + t.Fatal(err) } - }` - - for _, handler := range map[string]http.Handler{ - "plain": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, rawMapping) - }), - } { - - ts := httptest.NewServer(handler) - defer ts.Close() - - u, err := url.Parse(ts.URL) - if err != nil { - t.Fatalf("Failed to parse URL: %s", err) - } - c := NewIndicesMappings(log.NewNopLogger(), http.DefaultClient, u) - indicesMappingsResponse, err := c.fetchAndDecodeIndicesMappings() - if err != nil { - t.Fatalf("Failed to fetch or decode indices mappings: %s", err) - } - - response := *indicesMappingsResponse - mapping := response[testIndexName] - totalFields := countFieldsRecursive(mapping.Mappings.Properties, 0) - if totalFields != testIndexNumFields { - t.Errorf("Number of actual fields in index doesn't match the count returned by the recursive countFieldsRecursive function") - } - + }) } - } diff --git a/fixtures/indices_mappings/7.8.0.json b/fixtures/indices_mappings/7.8.0.json new file mode 100644 index 00000000..eb96f35b --- /dev/null +++ b/fixtures/indices_mappings/7.8.0.json @@ -0,0 +1,43 @@ +{ + "facebook": { + "mappings": { + "properties": { + "contact": { + "properties": { + "email": { + "type": "text", + "fields": { + "raw": { + "type": "keyword" + } + } + }, + "phone": { + "type": "text" + } + } + }, + "name": { + "type": "text", + "fields": { + "raw": { + "type": "keyword" + } + } + } + } + } + }, + "twitter": { + "mappings": { + "properties": { + "email": { + "type": "keyword" + }, + "phone": { + "type": "keyword" + } + } + } + } +} diff --git a/fixtures/indices_mappings/counts.json b/fixtures/indices_mappings/counts.json new file mode 100644 index 00000000..4550a79f --- /dev/null +++ b/fixtures/indices_mappings/counts.json @@ -0,0 +1,183 @@ +{ + "test-data-2023.01.20": { + "mappings": { + "properties": { + "data": { + "type": "object", + "properties": { + "field1": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field10": { + "type": "long" + }, + "field2": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field3": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field4": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field5": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field6": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field7": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field8": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field9": { + "type": "long" + } + } + }, + "data2": { + "properties": { + "field1": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field2": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field3": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field4": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field5": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "nested_field6": { + "properties": { + "field1": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field2": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field3": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field4": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "field5": { + "type": "long" + } + } + } + } + } + } + } + } +} From 6b8b33f9d8e309be40f2416097d0ddf0c5281c30 Mon Sep 17 00:00:00 2001 From: prombot Date: Sat, 18 Nov 2023 17:49:07 +0000 Subject: [PATCH 07/11] Update common Prometheus files Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index babd8a0c..ffa6b309 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -22,7 +22,7 @@ jobs: - name: install Go uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 with: - go-version: 1.20.x + go-version: 1.21.x - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' From 861e7bafc2230f049768d616825af2613ae6c8ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 13:14:14 -0500 Subject: [PATCH 08/11] Bump github.com/aws/aws-sdk-go-v2 from 1.21.2 to 1.23.4 (#824) Bumps [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) from 1.21.2 to 1.23.4. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.21.2...v1.23.4) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 43b6745c..50f07abe 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/alecthomas/kingpin/v2 v2.3.2 - github.com/aws/aws-sdk-go-v2 v1.21.2 + github.com/aws/aws-sdk-go-v2 v1.23.4 github.com/aws/aws-sdk-go-v2/config v1.18.45 github.com/aws/aws-sdk-go-v2/credentials v1.13.43 github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 @@ -25,7 +25,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 // indirect - github.com/aws/smithy-go v1.15.0 // indirect + github.com/aws/smithy-go v1.18.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect diff --git a/go.sum b/go.sum index 8b84485d..863e5ef2 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,9 @@ github.com/alecthomas/kingpin/v2 v2.3.2 h1:H0aULhgmSzN8xQ3nX1uxtdlTHYoPLu5AhHxWr github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= -github.com/aws/aws-sdk-go-v2 v1.21.2 h1:+LXZ0sgo8quN9UOKXXzAWRT3FWd4NxeXWOZom9pE7GA= github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= +github.com/aws/aws-sdk-go-v2 v1.23.4 h1:2P20ZjH0ouSAu/6yZep8oCmTReathLuEu6dwoqEgjts= +github.com/aws/aws-sdk-go-v2 v1.23.4/go.mod h1:t3szzKfP0NeRU27uBFczDivYJjsmSnqI8kIvKyWb9ds= github.com/aws/aws-sdk-go-v2/config v1.18.45 h1:Aka9bI7n8ysuwPeFdm77nfbyHCAKQ3z9ghB3S/38zes= github.com/aws/aws-sdk-go-v2/config v1.18.45/go.mod h1:ZwDUgFnQgsazQTnWfeLWk5GjeqTQTL8lMkoE1UXzxdE= github.com/aws/aws-sdk-go-v2/credentials v1.13.43 h1:LU8vo40zBlo3R7bAvBVy/ku4nxGEyZe9N8MqAeFTzF8= @@ -24,8 +25,9 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 h1:HFiiRkf1SdaAmV3/BHOFZ9Dj github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3/go.mod h1:a7bHA82fyUXOm+ZSWKU6PIoBxrjSprdLoM8xPYvzYVg= github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 h1:0BkLfgeDjfZnZ+MhB3ONb01u9pwFYTCZVhlsSSBvlbU= github.com/aws/aws-sdk-go-v2/service/sts v1.23.2/go.mod h1:Eows6e1uQEsc4ZaHANmsPRzAKcVDrcmjjWiih2+HUUQ= -github.com/aws/smithy-go v1.15.0 h1:PS/durmlzvAFpQHDs4wi4sNNP9ExsqZh6IlfdHXgKK8= github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.18.1 h1:pOdBTUfXNazOlxLrgeYalVnuTpKreACHtc62xLwIB3c= +github.com/aws/smithy-go v1.18.1/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= From 4d262b16eb16ffb7d1a516748c34068725df24a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 13:23:56 -0500 Subject: [PATCH 09/11] Bump github.com/aws/aws-sdk-go-v2/config from 1.18.45 to 1.25.10 (#823) Bumps [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2) from 1.18.45 to 1.25.10. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/config/v1.18.45...config/v1.25.10) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/config dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 21 +++++++++++---------- go.sum | 48 ++++++++++++++++++++++-------------------------- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index 50f07abe..3191adee 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ go 1.19 require ( github.com/alecthomas/kingpin/v2 v2.3.2 github.com/aws/aws-sdk-go-v2 v1.23.4 - github.com/aws/aws-sdk-go-v2/config v1.18.45 - github.com/aws/aws-sdk-go-v2/credentials v1.13.43 - github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 + github.com/aws/aws-sdk-go-v2/config v1.25.10 + github.com/aws/aws-sdk-go-v2/credentials v1.16.8 + github.com/aws/aws-sdk-go-v2/service/sts v1.26.1 github.com/blang/semver/v4 v4.0.0 github.com/go-kit/log v0.2.1 github.com/imdario/mergo v0.3.13 @@ -18,13 +18,14 @@ require ( require ( github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.8 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.7 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.7 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.7 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.18.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.1 // indirect github.com/aws/smithy-go v1.18.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect diff --git a/go.sum b/go.sum index 863e5ef2..6d8b2ce1 100644 --- a/go.sum +++ b/go.sum @@ -2,30 +2,30 @@ github.com/alecthomas/kingpin/v2 v2.3.2 h1:H0aULhgmSzN8xQ3nX1uxtdlTHYoPLu5AhHxWr github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= -github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= github.com/aws/aws-sdk-go-v2 v1.23.4 h1:2P20ZjH0ouSAu/6yZep8oCmTReathLuEu6dwoqEgjts= github.com/aws/aws-sdk-go-v2 v1.23.4/go.mod h1:t3szzKfP0NeRU27uBFczDivYJjsmSnqI8kIvKyWb9ds= -github.com/aws/aws-sdk-go-v2/config v1.18.45 h1:Aka9bI7n8ysuwPeFdm77nfbyHCAKQ3z9ghB3S/38zes= -github.com/aws/aws-sdk-go-v2/config v1.18.45/go.mod h1:ZwDUgFnQgsazQTnWfeLWk5GjeqTQTL8lMkoE1UXzxdE= -github.com/aws/aws-sdk-go-v2/credentials v1.13.43 h1:LU8vo40zBlo3R7bAvBVy/ku4nxGEyZe9N8MqAeFTzF8= -github.com/aws/aws-sdk-go-v2/credentials v1.13.43/go.mod h1:zWJBz1Yf1ZtX5NGax9ZdNjhhI4rgjfgsyk6vTY1yfVg= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 h1:PIktER+hwIG286DqXyvVENjgLTAwGgoeriLDD5C+YlQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13/go.mod h1:f/Ib/qYjhV2/qdsf79H3QP/eRE4AkVyEf6sk7XfZ1tg= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 h1:nFBQlGtkbPzp/NjZLuFxRqmT91rLJkgvsEQs68h962Y= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43/go.mod h1:auo+PiyLl0n1l8A0e8RIeR8tOzYPfZZH/JNlrJ8igTQ= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 h1:JRVhO25+r3ar2mKGP7E0LDl8K9/G36gjlqca5iQbaqc= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37/go.mod h1:Qe+2KtKml+FEsQF/DHmDV+xjtche/hwoF75EG4UlHW8= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 h1:hze8YsjSh8Wl1rYa1CJpRmXP21BvOBuc76YhW0HsuQ4= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45/go.mod h1:lD5M20o09/LCuQ2mE62Mb/iSdSlCNuj6H5ci7tW7OsE= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 h1:WWZA/I2K4ptBS1kg0kV1JbBtG/umed0vwHRrmcr9z7k= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37/go.mod h1:vBmDnwWXWxNPFRMmG2m/3MKOe+xEcMDo1tanpaWCcck= -github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 h1:JuPGc7IkOP4AaqcZSIcyqLpFSqBWK32rM9+a1g6u73k= -github.com/aws/aws-sdk-go-v2/service/sso v1.15.2/go.mod h1:gsL4keucRCgW+xA85ALBpRFfdSLH4kHOVSnLMSuBECo= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 h1:HFiiRkf1SdaAmV3/BHOFZ9DjFynPHj8G/UIO1lQS+fk= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3/go.mod h1:a7bHA82fyUXOm+ZSWKU6PIoBxrjSprdLoM8xPYvzYVg= -github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 h1:0BkLfgeDjfZnZ+MhB3ONb01u9pwFYTCZVhlsSSBvlbU= -github.com/aws/aws-sdk-go-v2/service/sts v1.23.2/go.mod h1:Eows6e1uQEsc4ZaHANmsPRzAKcVDrcmjjWiih2+HUUQ= -github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/aws-sdk-go-v2/config v1.25.10 h1:qw/e8emDtNufTkrAU86DlQ18DruMyyM7ttW6Lgwp4v0= +github.com/aws/aws-sdk-go-v2/config v1.25.10/go.mod h1:203YiAtb6XyoGxXMPsUVwEcuxCiTQY/r8P27IDjfvMc= +github.com/aws/aws-sdk-go-v2/credentials v1.16.8 h1:phw9nRLy/77bPk6Mfu2SHCOnHwfVB7WWrOa5rZIY2Fc= +github.com/aws/aws-sdk-go-v2/credentials v1.16.8/go.mod h1:MrS4SOin6adbO6wgWhdifyPiq+TX7fPPwyA/ZLC1F5M= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.8 h1:tQZLSPC2Zj2CqZHonLmWEvCsbpMX5tQvaYJWHadcPek= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.8/go.mod h1:5+YpvTHDFffykWr5qAGjqwoh8oVYZOddL3sSrEN7lws= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.7 h1:eMqD7ku6WGdmcWWXPYun9m6yk6feSULLhJlAtN6rYG4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.7/go.mod h1:0oBIfcDV6LScxEW0VgOqxT3e4aqKRp+SYhB9wAd5E3Q= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.7 h1:+XYhWhgWs5F3Zx8oa49CXzNvfXrItaDjZB/M172fcHQ= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.7/go.mod h1:L6tcSRyCGxcKfDWUrmv2jv8G1cLDU7d0FUpEFpG9bVE= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 h1:uR9lXYjdPX0xY+NhvaJ4dD8rpSRz5VY81ccIIoNG+lw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.3 h1:e3PCNeEaev/ZF01cQyNZgmYE9oYYePIMJs2mWSKG514= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.3/go.mod h1:gIeeNyaL8tIEqZrzAnTeyhHcE0yysCtcaP+N9kxLZ+E= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.7 h1:dU+ZyhvqMB/T/TxjGagHMCdyUiqaThRIaMu3YvKiSQI= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.7/go.mod h1:SGORuNqoXyWfTvTp/gBGJfv8jRvW/+nha0XhnIXVI+o= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.1 h1:V40g2daNO3l1J94JYwqfkyvQMYXi5I25fs3fNQW8iDs= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.1/go.mod h1:0ZWQJP/mBOUxkCvZKybZNz1XmdUKSBxoF0dzgfxtvDs= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.1 h1:uQrj7SpUNC3r55vc1CDh3qV9wJC66lz546xM9dhSo5s= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.1/go.mod h1:oyaTk5xEAOuPXX1kCD7HmIeuLqdj3Bk5yGkqGXtGi14= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.1 h1:K33V7L0XDdb23FMOZySr8bon1jou5SHn1fiv7NJ1SUg= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.1/go.mod h1:YtXUl/sfnS06VksYhr855hTQf2HphfT1Xv/EwuzbPjg= github.com/aws/smithy-go v1.18.1 h1:pOdBTUfXNazOlxLrgeYalVnuTpKreACHtc62xLwIB3c= github.com/aws/smithy-go v1.18.1/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -51,12 +51,9 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -113,7 +110,6 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From a6e3814f5d9bc0be5854fdb9c51f50e0bb7d0e1e Mon Sep 17 00:00:00 2001 From: Joe Adams Date: Fri, 1 Dec 2023 22:09:35 -0500 Subject: [PATCH 10/11] Upgrade direct dependencies Signed-off-by: Joe Adams --- go.mod | 28 ++++++++++++++-------------- go.sum | 58 ++++++++++++++++++++++++++++------------------------------ 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/go.mod b/go.mod index 3191adee..ed4b0c3d 100644 --- a/go.mod +++ b/go.mod @@ -3,29 +3,29 @@ module github.com/prometheus-community/elasticsearch_exporter go 1.19 require ( - github.com/alecthomas/kingpin/v2 v2.3.2 - github.com/aws/aws-sdk-go-v2 v1.23.4 - github.com/aws/aws-sdk-go-v2/config v1.25.10 - github.com/aws/aws-sdk-go-v2/credentials v1.16.8 - github.com/aws/aws-sdk-go-v2/service/sts v1.26.1 + github.com/alecthomas/kingpin/v2 v2.4.0 + github.com/aws/aws-sdk-go-v2 v1.23.5 + github.com/aws/aws-sdk-go-v2/config v1.25.11 + github.com/aws/aws-sdk-go-v2/credentials v1.16.9 + github.com/aws/aws-sdk-go-v2/service/sts v1.26.2 github.com/blang/semver/v4 v4.0.0 github.com/go-kit/log v0.2.1 github.com/imdario/mergo v0.3.13 github.com/prometheus/client_golang v1.17.0 - github.com/prometheus/common v0.44.0 + github.com/prometheus/common v0.45.0 github.com/prometheus/exporter-toolkit v0.10.0 ) require ( github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.8 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.7 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.7 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.9 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.8 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.8 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.7 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.18.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.18.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.2 // indirect github.com/aws/smithy-go v1.18.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -35,14 +35,14 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/kr/text v0.2.0 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect github.com/prometheus/procfs v0.11.1 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect golang.org/x/crypto v0.14.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect + golang.org/x/oauth2 v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/go.sum b/go.sum index 6d8b2ce1..486576c8 100644 --- a/go.sum +++ b/go.sum @@ -1,31 +1,31 @@ -github.com/alecthomas/kingpin/v2 v2.3.2 h1:H0aULhgmSzN8xQ3nX1uxtdlTHYoPLu5AhHxWrKI6ocU= -github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= +github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= +github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= -github.com/aws/aws-sdk-go-v2 v1.23.4 h1:2P20ZjH0ouSAu/6yZep8oCmTReathLuEu6dwoqEgjts= -github.com/aws/aws-sdk-go-v2 v1.23.4/go.mod h1:t3szzKfP0NeRU27uBFczDivYJjsmSnqI8kIvKyWb9ds= -github.com/aws/aws-sdk-go-v2/config v1.25.10 h1:qw/e8emDtNufTkrAU86DlQ18DruMyyM7ttW6Lgwp4v0= -github.com/aws/aws-sdk-go-v2/config v1.25.10/go.mod h1:203YiAtb6XyoGxXMPsUVwEcuxCiTQY/r8P27IDjfvMc= -github.com/aws/aws-sdk-go-v2/credentials v1.16.8 h1:phw9nRLy/77bPk6Mfu2SHCOnHwfVB7WWrOa5rZIY2Fc= -github.com/aws/aws-sdk-go-v2/credentials v1.16.8/go.mod h1:MrS4SOin6adbO6wgWhdifyPiq+TX7fPPwyA/ZLC1F5M= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.8 h1:tQZLSPC2Zj2CqZHonLmWEvCsbpMX5tQvaYJWHadcPek= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.8/go.mod h1:5+YpvTHDFffykWr5qAGjqwoh8oVYZOddL3sSrEN7lws= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.7 h1:eMqD7ku6WGdmcWWXPYun9m6yk6feSULLhJlAtN6rYG4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.7/go.mod h1:0oBIfcDV6LScxEW0VgOqxT3e4aqKRp+SYhB9wAd5E3Q= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.7 h1:+XYhWhgWs5F3Zx8oa49CXzNvfXrItaDjZB/M172fcHQ= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.7/go.mod h1:L6tcSRyCGxcKfDWUrmv2jv8G1cLDU7d0FUpEFpG9bVE= +github.com/aws/aws-sdk-go-v2 v1.23.5 h1:xK6C4udTyDMd82RFvNkDQxtAd00xlzFUtX4fF2nMZyg= +github.com/aws/aws-sdk-go-v2 v1.23.5/go.mod h1:t3szzKfP0NeRU27uBFczDivYJjsmSnqI8kIvKyWb9ds= +github.com/aws/aws-sdk-go-v2/config v1.25.11 h1:RWzp7jhPRliIcACefGkKp03L0Yofmd2p8M25kbiyvno= +github.com/aws/aws-sdk-go-v2/config v1.25.11/go.mod h1:BVUs0chMdygHsQtvaMyEOpW2GIW+ubrxJLgIz/JU29s= +github.com/aws/aws-sdk-go-v2/credentials v1.16.9 h1:LQo3MUIOzod9JdUK+wxmSdgzLVYUbII3jXn3S/HJZU0= +github.com/aws/aws-sdk-go-v2/credentials v1.16.9/go.mod h1:R7mDuIJoCjH6TxGUc/cylE7Lp/o0bhKVoxdBThsjqCM= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.9 h1:FZVFahMyZle6WcogZCOxo6D/lkDA2lqKIn4/ueUmVXw= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.9/go.mod h1:kjq7REMIkxdtcEC9/4BVXjOsNY5isz6jQbEgk6osRTU= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.8 h1:8GVZIR0y6JRIUNSYI1xAMF4HDfV8H/bOsZ/8AD/uY5Q= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.8/go.mod h1:rwBfu0SoUkBUZndVgPZKAD9Y2JigaZtRP68unRiYToQ= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.8 h1:ZE2ds/qeBkhk3yqYvS3CDCFNvd9ir5hMjlVStLZWrvM= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.8/go.mod h1:/lAPPymDYL023+TS6DJmjuL42nxix2AvEvfjqOBRODk= github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 h1:uR9lXYjdPX0xY+NhvaJ4dD8rpSRz5VY81ccIIoNG+lw= github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.3 h1:e3PCNeEaev/ZF01cQyNZgmYE9oYYePIMJs2mWSKG514= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.3/go.mod h1:gIeeNyaL8tIEqZrzAnTeyhHcE0yysCtcaP+N9kxLZ+E= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.7 h1:dU+ZyhvqMB/T/TxjGagHMCdyUiqaThRIaMu3YvKiSQI= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.7/go.mod h1:SGORuNqoXyWfTvTp/gBGJfv8jRvW/+nha0XhnIXVI+o= -github.com/aws/aws-sdk-go-v2/service/sso v1.18.1 h1:V40g2daNO3l1J94JYwqfkyvQMYXi5I25fs3fNQW8iDs= -github.com/aws/aws-sdk-go-v2/service/sso v1.18.1/go.mod h1:0ZWQJP/mBOUxkCvZKybZNz1XmdUKSBxoF0dzgfxtvDs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.1 h1:uQrj7SpUNC3r55vc1CDh3qV9wJC66lz546xM9dhSo5s= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.1/go.mod h1:oyaTk5xEAOuPXX1kCD7HmIeuLqdj3Bk5yGkqGXtGi14= -github.com/aws/aws-sdk-go-v2/service/sts v1.26.1 h1:K33V7L0XDdb23FMOZySr8bon1jou5SHn1fiv7NJ1SUg= -github.com/aws/aws-sdk-go-v2/service/sts v1.26.1/go.mod h1:YtXUl/sfnS06VksYhr855hTQf2HphfT1Xv/EwuzbPjg= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.8 h1:EamsKe+ZjkOQjDdHd86/JCEucjFKQ9T0atWKO4s2Lgs= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.8/go.mod h1:Q0vV3/csTpbkfKLI5Sb56cJQTCTtJ0ixdb7P+Wedqiw= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.2 h1:xJPydhNm0Hiqct5TVKEuHG7weC0+sOs4MUnd7A5n5F4= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.2/go.mod h1:zxk6y1X2KXThESWMS5CrKRvISD8mbIMab6nZrCGxDG0= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.2 h1:8dU9zqA77C5egbU6yd4hFLaiIdPv3rU+6cp7sz5FjCU= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.2/go.mod h1:7Lt5mjQ8x5rVdKqg+sKKDeuwoszDJIIPmkd8BVsEdS0= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.2 h1:fFrLsy08wEbAisqW3KDl/cPHrF43GmV79zXB9EwJiZw= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.2/go.mod h1:7Ld9eTqocTvJqqJ5K/orbSDwmGcpRdlDiLjz2DO+SL8= github.com/aws/smithy-go v1.18.1 h1:pOdBTUfXNazOlxLrgeYalVnuTpKreACHtc62xLwIB3c= github.com/aws/smithy-go v1.18.1/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -45,7 +45,6 @@ github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= @@ -59,8 +58,8 @@ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -69,8 +68,8 @@ github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1 github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/exporter-toolkit v0.10.0 h1:yOAzZTi4M22ZzVxD+fhy1URTuNRj/36uQJJ5S8IPza8= github.com/prometheus/exporter-toolkit v0.10.0/go.mod h1:+sVFzuvV5JDyw+Ih6p3zFxZNVnKQa3x5qPmDSiPu4ZY= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= @@ -87,9 +86,8 @@ golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= From 763c5f8fe2e150257181597d6f855762a209071d Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Mon, 4 Dec 2023 01:18:57 +0100 Subject: [PATCH 11/11] Update Go (#828) * Update Go to 1.21. * Update minimum Go to 1.20. * Remove obsolete Go flag overrides. Signed-off-by: SuperQ --- .circleci/config.yml | 2 +- .promu.yml | 3 +-- go.mod | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dbe6ca37..39f2ed1c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ executors: # This must match .promu.yml. golang: docker: - - image: cimg/go:1.20 + - image: cimg/go:1.21 jobs: test: executor: golang diff --git a/.promu.yml b/.promu.yml index 027bf9e6..8eabce03 100644 --- a/.promu.yml +++ b/.promu.yml @@ -1,12 +1,11 @@ go: # This must match .circle/config.yml. - version: 1.20 + version: 1.21 repository: path: github.com/prometheus-community/elasticsearch_exporter build: binaries: - name: elasticsearch_exporter - flags: -a -tags netgo ldflags: | -s -X github.com/prometheus/common/version.Version={{.Version}} diff --git a/go.mod b/go.mod index ed4b0c3d..d08158cb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/prometheus-community/elasticsearch_exporter -go 1.19 +go 1.20 require ( github.com/alecthomas/kingpin/v2 v2.4.0