summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/elasticsearch/collect.go
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:15:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:15:20 +0000
commit87d772a7d708fec12f48cd8adc0dedff6e1025da (patch)
tree1fee344c64cc3f43074a01981e21126c8482a522 /src/go/collectors/go.d.plugin/modules/elasticsearch/collect.go
parentAdding upstream version 1.46.3. (diff)
downloadnetdata-upstream.tar.xz
netdata-upstream.zip
Adding upstream version 1.47.0.upstream/1.47.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/go/plugin/go.d/modules/elasticsearch/collect.go (renamed from src/go/collectors/go.d.plugin/modules/elasticsearch/collect.go)21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/elasticsearch/collect.go b/src/go/plugin/go.d/modules/elasticsearch/collect.go
index eb3ffb351..4f46f1088 100644
--- a/src/go/collectors/go.d.plugin/modules/elasticsearch/collect.go
+++ b/src/go/plugin/go.d/modules/elasticsearch/collect.go
@@ -13,8 +13,8 @@ import (
"strings"
"sync"
- "github.com/netdata/netdata/go/go.d.plugin/pkg/stm"
- "github.com/netdata/netdata/go/go.d.plugin/pkg/web"
+ "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/stm"
+ "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web"
)
const (
@@ -158,13 +158,15 @@ func (es *Elasticsearch) scrapeElasticsearch() *esMetrics {
}
func (es *Elasticsearch) scrapeNodesStats(ms *esMetrics) {
- req, _ := web.NewHTTPRequest(es.Request)
+ var p string
if es.ClusterMode {
- req.URL.Path = urlPathNodesStats
+ p = urlPathNodesStats
} else {
- req.URL.Path = urlPathLocalNodeStats
+ p = urlPathLocalNodeStats
}
+ req, _ := web.NewHTTPRequestWithPath(es.Request, p)
+
var stats esNodesStats
if err := es.doOKDecode(req, &stats); err != nil {
es.Warning(err)
@@ -175,8 +177,7 @@ func (es *Elasticsearch) scrapeNodesStats(ms *esMetrics) {
}
func (es *Elasticsearch) scrapeClusterHealth(ms *esMetrics) {
- req, _ := web.NewHTTPRequest(es.Request)
- req.URL.Path = urlPathClusterHealth
+ req, _ := web.NewHTTPRequestWithPath(es.Request, urlPathClusterHealth)
var health esClusterHealth
if err := es.doOKDecode(req, &health); err != nil {
@@ -188,8 +189,7 @@ func (es *Elasticsearch) scrapeClusterHealth(ms *esMetrics) {
}
func (es *Elasticsearch) scrapeClusterStats(ms *esMetrics) {
- req, _ := web.NewHTTPRequest(es.Request)
- req.URL.Path = urlPathClusterStats
+ req, _ := web.NewHTTPRequestWithPath(es.Request, urlPathClusterStats)
var stats esClusterStats
if err := es.doOKDecode(req, &stats); err != nil {
@@ -201,8 +201,7 @@ func (es *Elasticsearch) scrapeClusterStats(ms *esMetrics) {
}
func (es *Elasticsearch) scrapeLocalIndicesStats(ms *esMetrics) {
- req, _ := web.NewHTTPRequest(es.Request)
- req.URL.Path = urlPathIndicesStats
+ req, _ := web.NewHTTPRequestWithPath(es.Request, urlPathIndicesStats)
req.URL.RawQuery = "local=true&format=json"
var stats []esIndexStats