Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
DMP-3004: added notes, fix the err checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Vazhenin committed Dec 28, 2019
1 parent 2714d78 commit ec56f34
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ func (nc nsCollector) describe(ch chan<- *prometheus.Desc) {
}

func (nc nsCollector) parseStorage(s string, d string) (string, error) {
// the function remove the storage prefix metrics for each device:
// d is storage-engine.device[ix]
// s is all storage metrics that has been scraped
// storage-engine.device[ix].age -> age
// https://www.aerospike.com/docs/reference/metrics/#storage-engine.device[ix].age
buf := bytes.Buffer{}
for _, l := range strings.Split(s, ";") {
for _, v := range strings.Split(l, ":") {
Expand Down Expand Up @@ -334,6 +339,11 @@ func (nc nsCollector) collect(conn *as.Connection) ([]prometheus.Metric, error)

for mountName, metricName := range nsInfoStorageDevices {
nsInfoStorage, err = nc.parseStorage(nsInfoStorage, metricName)

if err != nil {
return nil, err
}

metrics = append(
metrics,
infoCollect(cmetrics(nc), nsInfoStorage, ns, mountName)...,
Expand Down

0 comments on commit ec56f34

Please sign in to comment.