diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:20 +0000 |
commit | 87d772a7d708fec12f48cd8adc0dedff6e1025da (patch) | |
tree | 1fee344c64cc3f43074a01981e21126c8482a522 /src/go/collectors/go.d.plugin/modules/couchdb/collect.go | |
parent | Adding upstream version 1.46.3. (diff) | |
download | netdata-87d772a7d708fec12f48cd8adc0dedff6e1025da.tar.xz netdata-87d772a7d708fec12f48cd8adc0dedff6e1025da.zip |
Adding upstream version 1.47.0.upstream/1.47.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/go/plugin/go.d/modules/couchdb/collect.go (renamed from src/go/collectors/go.d.plugin/modules/couchdb/collect.go) | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/couchdb/collect.go b/src/go/plugin/go.d/modules/couchdb/collect.go index 5c722fd0c..21b38fb3a 100644 --- a/src/go/collectors/go.d.plugin/modules/couchdb/collect.go +++ b/src/go/plugin/go.d/modules/couchdb/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 ( @@ -120,8 +120,7 @@ func (cdb *CouchDB) scrapeCouchDB() *cdbMetrics { } func (cdb *CouchDB) scrapeNodeStats(ms *cdbMetrics) { - req, _ := web.NewHTTPRequest(cdb.Request) - req.URL.Path = fmt.Sprintf(urlPathOverviewStats, cdb.Config.Node) + req, _ := web.NewHTTPRequestWithPath(cdb.Request, fmt.Sprintf(urlPathOverviewStats, cdb.Config.Node)) var stats cdbNodeStats if err := cdb.doOKDecode(req, &stats); err != nil { @@ -132,8 +131,7 @@ func (cdb *CouchDB) scrapeNodeStats(ms *cdbMetrics) { } func (cdb *CouchDB) scrapeSystemStats(ms *cdbMetrics) { - req, _ := web.NewHTTPRequest(cdb.Request) - req.URL.Path = fmt.Sprintf(urlPathSystemStats, cdb.Config.Node) + req, _ := web.NewHTTPRequestWithPath(cdb.Request, fmt.Sprintf(urlPathSystemStats, cdb.Config.Node)) var stats cdbNodeSystem if err := cdb.doOKDecode(req, &stats); err != nil { @@ -144,8 +142,7 @@ func (cdb *CouchDB) scrapeSystemStats(ms *cdbMetrics) { } func (cdb *CouchDB) scrapeActiveTasks(ms *cdbMetrics) { - req, _ := web.NewHTTPRequest(cdb.Request) - req.URL.Path = urlPathActiveTasks + req, _ := web.NewHTTPRequestWithPath(cdb.Request, urlPathActiveTasks) var stats []cdbActiveTask if err := cdb.doOKDecode(req, &stats); err != nil { @@ -156,8 +153,7 @@ func (cdb *CouchDB) scrapeActiveTasks(ms *cdbMetrics) { } func (cdb *CouchDB) scrapeDBStats(ms *cdbMetrics) { - req, _ := web.NewHTTPRequest(cdb.Request) - req.URL.Path = urlPathDatabases + req, _ := web.NewHTTPRequestWithPath(cdb.Request, urlPathDatabases) req.Method = http.MethodPost req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") @@ -182,18 +178,18 @@ func (cdb *CouchDB) scrapeDBStats(ms *cdbMetrics) { } func findMaxMQSize(MessageQueues map[string]interface{}) int64 { - var max float64 + var maxSize float64 for _, mq := range MessageQueues { switch mqSize := mq.(type) { case float64: - max = math.Max(max, mqSize) + maxSize = math.Max(maxSize, mqSize) case map[string]interface{}: if v, ok := mqSize["count"].(float64); ok { - max = math.Max(max, v) + maxSize = math.Max(maxSize, v) } } } - return int64(max) + return int64(maxSize) } func (cdb *CouchDB) pingCouchDB() error { |