Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sunilvirus committed Aug 21, 2024
2 parents b40dea9 + ba9d07b commit 9166b00
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 208 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.20-alpine AS builder
FROM golang:1.21-alpine AS builder

ARG VERSION=1.10.0
ARG VERSION=1.19.0

ADD . $GOPATH/src/github.com/aerospike/aerospike-prometheus-exporter
WORKDIR $GOPATH/src/github.com/aerospike/aerospike-prometheus-exporter
Expand Down
6 changes: 5 additions & 1 deletion configs/gauge_stats_list.toml
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,9 @@ namespace_gauge_stats =[
# System Info Gauge metrics list
#
system_info_gauge_stats = [
"",
"allocated",
"shmem_bytes",
"swap_cached_bytes",
"tcp_activeopens",
"tcp_currestab",
]
25 changes: 12 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/BurntSushi/toml v1.2.1
github.com/aerospike/aerospike-client-go/v6 v6.10.0
github.com/aerospike/aerospike-client-go/v7 v7.6.1
github.com/gobwas/glob v0.2.3
github.com/hashicorp/go-version v1.6.0
github.com/prometheus/client_golang v1.14.0
Expand All @@ -23,25 +23,24 @@ require (
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/onsi/gomega v1.27.10 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/yuin/gopher-lua v1.1.0 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect
google.golang.org/grpc v1.63.3 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
158 changes: 31 additions & 127 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/BurntSushi/toml"

aslog "github.com/aerospike/aerospike-client-go/v6/logger"
aslog "github.com/aerospike/aerospike-client-go/v7/logger"
log "github.com/sirupsen/logrus"
)

Expand Down
8 changes: 5 additions & 3 deletions internal/pkg/dataprovider/aero_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"strings"
"time"

aero "github.com/aerospike/aerospike-client-go/v6"
"github.com/aerospike/aerospike-client-go/v6/types"
aero "github.com/aerospike/aerospike-client-go/v7"
"github.com/aerospike/aerospike-client-go/v7/types"
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/commons"
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/config"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -157,7 +157,9 @@ func fetchRequestInfoFromAerospike(infoKeys []string) (map[string]string, error)
// Info request
rawMetrics, err = asConnection.RequestInfo(infoKeys...)
if err != nil {
logrus.Debug("Error while requestInfo ( infoKeys...) : ", err)
logrus.Debug("Error while requestInfo ( infoKeys...), closing connection : Error is: ", err, " and infoKeys: ", infoKeys)
asConnection.Close()
//TODO: do we need to assign nil to asConnection? i.e. asConnection = nil
continue
}

Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/dataprovider/data_provider.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dataprovider

import (
aero "github.com/aerospike/aerospike-client-go/v6"
aero "github.com/aerospike/aerospike-client-go/v7"
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/config"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/dataprovider/fake_data_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/pkg/dataprovider/mock_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"strings"

aero "github.com/aerospike/aerospike-client-go/v6"
aero "github.com/aerospike/aerospike-client-go/v7"
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/commons"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/statprocessors/sp_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/config"
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/dataprovider"

aero "github.com/aerospike/aerospike-client-go/v6"
aero "github.com/aerospike/aerospike-client-go/v7"
log "github.com/sirupsen/logrus"
)

Expand Down
62 changes: 5 additions & 57 deletions internal/pkg/statprocessors/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ func isGauge(pContextType commons.ContextType, pStat string) bool {
return config.GaugeStatHandler.XdrStats[pStat]
}

// any sysinfo_ check if it exists in gauge_stats_list.toml
if strings.Contains(strings.ToLower(string(pContextType)), "sysinfo_") {
return config.GaugeStatHandler.SysInfoStats[pStat]
}

return false
}

Expand Down Expand Up @@ -171,63 +176,6 @@ func GetMetricType(pContext commons.ContextType, pRawMetricName string) commons.
return commons.MetricTypeCounter
}

// // Filter metrics
// // Runs the raw metrics through allowlist first and the resulting metrics through blocklist
// func GetFilteredMetrics(rawMetrics map[string]commons.MetricType, allowlist []string, allowlistEnabled bool, blocklist []string) map[string]commons.MetricType {
// filteredMetrics := filterAllowedMetrics(rawMetrics, allowlist, allowlistEnabled)
// filterBlockedMetrics(filteredMetrics, blocklist)

// return filteredMetrics
// }

// // Filter metrics based on configured allowlist.
// func filterAllowedMetrics(rawMetrics map[string]commons.MetricType, allowlist []string, allowlistEnabled bool) map[string]commons.MetricType {
// if !allowlistEnabled {
// return rawMetrics
// }

// filteredMetrics := make(map[string]commons.MetricType)

// for _, stat := range allowlist {
// if GlobbingPattern.MatchString(stat) {
// ge := glob.MustCompile(stat)

// for k, v := range rawMetrics {
// if ge.Match(k) {
// filteredMetrics[k] = v
// }
// }
// } else {
// if val, ok := rawMetrics[stat]; ok {
// filteredMetrics[stat] = val
// }
// }
// }

// return filteredMetrics
// }

// // Filter metrics based on configured blocklist.
// func filterBlockedMetrics(filteredMetrics map[string]commons.MetricType, blocklist []string) {
// if len(blocklist) == 0 {
// return
// }

// for _, stat := range blocklist {
// if GlobbingPattern.MatchString(stat) {
// ge := glob.MustCompile(stat)

// for k := range filteredMetrics {
// if ge.Match(k) {
// delete(filteredMetrics, k)
// }
// }
// } else {
// delete(filteredMetrics, stat)
// }
// }
// }

func BuildVersionGreaterThanOrEqual(rawMetrics map[string]string, ref string) (bool, error) {
if len(rawMetrics["build"]) == 0 {
return false, fmt.Errorf("couldn't get build version")
Expand Down

0 comments on commit 9166b00

Please sign in to comment.