Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunil Sayyaparaju authored and Sunil Sayyaparaju committed Apr 10, 2024
2 parents 6674596 + 6a8c7c4 commit cde03d8
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 44 deletions.
10 changes: 10 additions & 0 deletions configs/gauge_stats_list.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,21 @@ namespace_gauge_stats =[
"storage-engine.device.shadow_write_q",
"storage-engine.device.used_bytes",
"storage-engine.device.write_q",
"storage-engine.device.age",
"storage-engine.file.defrag_q",
"storage-engine.file.free_wblocks",
"storage-engine.file.shadow_write_q",
"storage-engine.file.used_bytes",
"storage-engine.file.write_q",
"storage-engine.file.age",
"storage-engine.stripe.defrag_q",
"storage-engine.stripe.free_wblocks",
"storage-engine.stripe.shadow_write_q",
"storage-engine.stripe.used_bytes",
"storage-engine.stripe.write_q",
"storage-engine.stripe.age",
"storage-engine.stripe.backing_write_q",
"migrate_fresh_partitions",
"tombstones",
"truncate_lut",
"unavailable_partitions",
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ require (
github.com/yuin/gopher-lua v1.1.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.13.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
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -144,15 +144,15 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
Expand Down
26 changes: 26 additions & 0 deletions internal/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ type Config struct {
OtelPushInterval uint8 `toml:"push_interval"`
OtelServerStatFetchInterval uint8 `toml:"server_stat_fetch_interval"`
} `toml:"OpenTelemetry"`

IsKubernetes bool
KubernetesPodName string
} `toml:"Agent"`

Aerospike struct {
Expand Down Expand Up @@ -200,6 +203,27 @@ func (c *Config) FetchCloudInfo(md toml.MetaData) {
}
}

func (c *Config) FetchKubernetesInfo(md toml.MetaData) {
// use kubectl to fetch required Kubernetes context and find the required Kubenetes environment variables
envKubeServiceHost := os.Getenv("KUBERNETES_SERVICE_HOST")

Cfg.Agent.IsKubernetes = false

if envKubeServiceHost != "" && len(strings.TrimSpace(envKubeServiceHost)) > 0 {
Cfg.Agent.IsKubernetes = true
log.Info("Exporter is running in Kubernetes")

// get host-name
var err error
Cfg.Agent.KubernetesPodName, err = os.Hostname()
if err != nil {
log.Errorln(err)
return
}

}
}

// Initialize exporter configuration
func InitConfig(configFile string) {
// to print everything out regarding reading the config in app init
Expand All @@ -225,6 +249,8 @@ func InitConfig(configFile string) {

Cfg.ValidateAndUpdate(md)
Cfg.FetchCloudInfo(md)

Cfg.FetchKubernetesInfo(md)
}

// Set log file path
Expand Down
4 changes: 4 additions & 0 deletions internal/pkg/executors/otel_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func sendNodeUp(meter metric.Meter, ctx context.Context, commonLabels []attribut
metric.WithDescription("Aerospike node active status"),
)

if config.Cfg.Agent.IsKubernetes {
statprocessors.Service = config.Cfg.Agent.KubernetesPodName
}

labels := []attribute.KeyValue{
attribute.String("cluster_name", statprocessors.ClusterName),
attribute.String("service", statprocessors.Service),
Expand Down
4 changes: 4 additions & 0 deletions internal/pkg/executors/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func (o *PrometheusImpl) Collect(ch chan<- prometheus.Metric) {
return
}

// if kubernetes then send host-name/pod-name else send server-ip as-isnh
if config.Cfg.Agent.IsKubernetes {
statprocessors.Service = config.Cfg.Agent.KubernetesPodName
}
ch <- prometheus.MustNewConstMetric(nodeActiveDesc, prometheus.GaugeValue, 1.0, statprocessors.ClusterName, statprocessors.Service, statprocessors.Build)

for _, wm := range refreshed_metrics {
Expand Down
6 changes: 2 additions & 4 deletions internal/pkg/statprocessors/sp_host_systeminfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ func getNetworkInfo() []AerospikeStat {
arrReceiveStats, arrTransferStats := dataprovider.GetSystemProvider().GetNetDevStats()

// netdev receive
clusterName := ClusterName
service := Service
for _, stats := range arrReceiveStats {
deviceName := stats["device_name"]
statName := "receive_bytes_total"
Expand All @@ -132,7 +130,7 @@ func getNetworkInfo() []AerospikeStat {
continue
}

labelValues := []string{clusterName, service, deviceName}
labelValues := []string{ClusterName, Service, deviceName}

allowed := isMetricAllowed(commons.CTX_SYSINFO_NETWORK_STATS, statName)
sysMetric := NewAerospikeStat(commons.CTX_SYSINFO_NETWORK_STATS, statName, allowed)
Expand All @@ -154,7 +152,7 @@ func getNetworkInfo() []AerospikeStat {
continue
}

labelValues := []string{clusterName, service, deviceName}
labelValues := []string{ClusterName, Service, deviceName}
allowed := isMetricAllowed(commons.CTX_SYSINFO_NETWORK_STATS, statName)
sysMetric := NewAerospikeStat(commons.CTX_SYSINFO_NETWORK_STATS, statName, allowed)
sysMetric.Labels = networkLabels
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/statprocessors/sp_latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"

commons "github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/commons"
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/config"
config "github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/config"

log "github.com/sirupsen/logrus"
)
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/statprocessors/sp_namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (nw *NamespaceStatsProcessor) refreshIndexPressure(singleInfoKey string, in
nsName := values[0]

labels := []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE, commons.METRIC_LABEL_NS}
labelValues := []string{rawMetrics[Infokey_ClusterName], rawMetrics[Infokey_Service], nsName}
labelValues := []string{ClusterName, Service, nsName}

// Server index-pressure output: test:0:0;bar_device:0:0;materials:0:0
// ignore first element - namespace
Expand Down Expand Up @@ -182,7 +182,7 @@ func (nw *NamespaceStatsProcessor) refreshNamespaceStats(singleInfoKey string, i
// default: aerospike_namespace_<stat-name>
constructedStatname = stat
labels = []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE, commons.METRIC_LABEL_NS}
labelValues = []string{rawMetrics[Infokey_ClusterName], rawMetrics[Infokey_Service], nsName}
labelValues = []string{ClusterName, Service, nsName}

if isArrayType {
constructedStatname, labels, labelValues = nw.handleArrayStats(nsName, stat, pv, stats, deviceType, rawMetrics)
Expand Down Expand Up @@ -287,7 +287,7 @@ func (nw *NamespaceStatsProcessor) handleArrayStats(nsName string, statToProcess
compositeStatName := deviceType + "_" + statType + "_" + statName
deviceOrFileName := allNamespaceStats[deviceType+"."+statType+"["+statIndex+"]"]
labels := []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE, commons.METRIC_LABEL_NS, statType + "_index", statType}
labelValues := []string{rawMetrics[Infokey_ClusterName], rawMetrics[Infokey_Service], nsName, statIndex, deviceOrFileName}
labelValues := []string{ClusterName, Service, nsName, statIndex, deviceOrFileName}

return compositeStatName, labels, labelValues

Expand Down
11 changes: 4 additions & 7 deletions internal/pkg/statprocessors/sp_node_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,14 @@ func (sw *NodeStatsProcessor) Refresh(infoKeys []string, rawMetrics map[string]s
log.Tracef("node-configs:%s", nodeConfigs)
log.Tracef("node-stats:%s", nodeStats)

clusterName := rawMetrics[Infokey_ClusterName]
service := rawMetrics[Infokey_Service]

// we are sending configs and stats in same refresh call, as both are being sent to prom, instead of doing prom-push in 2 functions
// handle configs
var allMetricsToSend = []AerospikeStat{}

lCfgMetricsToSend := sw.handleRefresh(nodeConfigs, clusterName, service)
lCfgMetricsToSend := sw.handleRefresh(nodeConfigs)

// handle stats
lStatMetricsToSend := sw.handleRefresh(nodeStats, clusterName, service)
lStatMetricsToSend := sw.handleRefresh(nodeStats)

// merge both array into single
allMetricsToSend = append(allMetricsToSend, lCfgMetricsToSend...)
Expand All @@ -61,7 +58,7 @@ func (sw *NodeStatsProcessor) Refresh(infoKeys []string, rawMetrics map[string]s
return allMetricsToSend, nil
}

func (sw *NodeStatsProcessor) handleRefresh(nodeRawMetrics string, clusterName string, service string) []AerospikeStat {
func (sw *NodeStatsProcessor) handleRefresh(nodeRawMetrics string) []AerospikeStat {

stats := commons.ParseStats(nodeRawMetrics, ";")

Expand All @@ -81,7 +78,7 @@ func (sw *NodeStatsProcessor) handleRefresh(nodeRawMetrics string, clusterName s
}

labels := []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE}
labelValues := []string{clusterName, service}
labelValues := []string{ClusterName, Service}

// pushToPrometheus(asMetric, pv, labels, labelsValues)
asMetric.updateValues(pv, labels, labelValues)
Expand Down
5 changes: 1 addition & 4 deletions internal/pkg/statprocessors/sp_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ func (sw *SetsStatsProcessor) Refresh(infoKeys []string, rawMetrics map[string]s
var allMetricsToSend = []AerospikeStat{}

for i := range setStats {
clusterName := rawMetrics[Infokey_ClusterName]
service := rawMetrics[Infokey_Service]

stats := commons.ParseStats(setStats[i], ":")
for stat, value := range stats {
pv, err := commons.TryConvert(value)
Expand All @@ -59,7 +56,7 @@ func (sw *SetsStatsProcessor) Refresh(infoKeys []string, rawMetrics map[string]s
}

labels := []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE, commons.METRIC_LABEL_NS, commons.METRIC_LABEL_SET}
labelValues := []string{clusterName, service, stats["ns"], stats["set"]}
labelValues := []string{ClusterName, Service, stats["ns"], stats["set"]}

// pushToPrometheus(asMetric, pv, labels, labelsValues, ch)
asMetric.updateValues(pv, labels, labelValues)
Expand Down
5 changes: 1 addition & 4 deletions internal/pkg/statprocessors/sp_sindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ func (siw *SindexStatsProcessor) Refresh(infoKeys []string, rawMetrics map[strin
sindexName := sindexInfoKeySplit[1]
log.Tracef("sindex-stats:%s:%s:%s", nsName, sindexName, rawMetrics[sindex])

clusterName := rawMetrics[Infokey_ClusterName]
service := rawMetrics[Infokey_Service]

stats := commons.ParseStats(rawMetrics[sindex], ";")
for stat, value := range stats {
pv, err := commons.TryConvert(value)
Expand All @@ -90,7 +87,7 @@ func (siw *SindexStatsProcessor) Refresh(infoKeys []string, rawMetrics map[strin
}

labels := []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE, commons.METRIC_LABEL_NS, commons.METRIC_LABEL_SINDEX}
labelValues := []string{clusterName, service, nsName, sindexName}
labelValues := []string{ClusterName, Service, nsName, sindexName}

asMetric.updateValues(pv, labels, labelValues)
allMetricsToSend = append(allMetricsToSend, asMetric)
Expand Down
10 changes: 5 additions & 5 deletions internal/pkg/statprocessors/sp_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,21 @@ func (uw *UserStatsProcessor) refreshUserStats(infoKeys []string, rawMetrics map
readInfoStats := []string{"read_quota", "read_single_record_tps", "read_scan_query_rps", "limitless_read_scan_query"}
writeInfoStats := []string{"write_quota", "write_single_record_tps", "write_scan_query_rps", "limitless_write_scan_query"}

asMetric, labels, labelValues := internalCreateLocalAerospikeStat(rawMetrics, "conns_in_use", user.User)
asMetric, labels, labelValues := internalCreateLocalAerospikeStat("conns_in_use", user.User)
asMetric.updateValues(float64(user.ConnsInUse), labels, labelValues)
allMetricsToSend = append(allMetricsToSend, asMetric)

if len(user.ReadInfo) >= 4 && len(user.WriteInfo) >= 4 {

for idxReadinfo := 0; idxReadinfo < len(user.ReadInfo); idxReadinfo++ {
riAeroMetric, riLabels, riLabelValues := internalCreateLocalAerospikeStat(rawMetrics, readInfoStats[idxReadinfo], user.User)
riAeroMetric, riLabels, riLabelValues := internalCreateLocalAerospikeStat(readInfoStats[idxReadinfo], user.User)
riAeroMetric.updateValues(float64(user.ReadInfo[idxReadinfo]), riLabels, riLabelValues)

allMetricsToSend = append(allMetricsToSend, riAeroMetric)

}
for idxWriteinfo := 0; idxWriteinfo < len(user.WriteInfo); idxWriteinfo++ {
wiAeroMetric, wiLabels, wiLabelValues := internalCreateLocalAerospikeStat(rawMetrics, writeInfoStats[idxWriteinfo], user.User)
wiAeroMetric, wiLabels, wiLabelValues := internalCreateLocalAerospikeStat(writeInfoStats[idxWriteinfo], user.User)
wiAeroMetric.updateValues(float64(user.WriteInfo[idxWriteinfo]), wiLabels, wiLabelValues)
allMetricsToSend = append(allMetricsToSend, wiAeroMetric)

Expand All @@ -147,9 +147,9 @@ func (uw *UserStatsProcessor) refreshUserStats(infoKeys []string, rawMetrics map
return allMetricsToSend, nil
}

func internalCreateLocalAerospikeStat(rawMetrics map[string]string, pStatName string, username string) (AerospikeStat, []string, []string) {
func internalCreateLocalAerospikeStat(pStatName string, username string) (AerospikeStat, []string, []string) {
labels := []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE, commons.METRIC_LABEL_USER}
labelValues := []string{rawMetrics[Infokey_ClusterName], rawMetrics[Infokey_Service], username}
labelValues := []string{ClusterName, Service, username}
allowed := isMetricAllowed(commons.CTX_USERS, pStatName)
asMetric := NewAerospikeStat(commons.CTX_USERS, pStatName, allowed)

Expand Down
11 changes: 4 additions & 7 deletions internal/pkg/statprocessors/sp_xdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,14 @@ func (xw *XdrStatsProcessor) Refresh(infoKeys []string, rawMetrics map[string]st
xw.xdrMetrics = make(map[string]AerospikeStat)
}

clusterName := rawMetrics[Infokey_ClusterName]
service := rawMetrics[Infokey_Service]

var allMetricsToSend = []AerospikeStat{}

for _, key := range infoKeys {

xdrRawMetrics := rawMetrics[key]
// find and construct metric name
dcName, ns, metricPrefix := xw.constructMetricNamePrefix(key)
tmpXdrMetricsToSend := xw.handleRefresh(key, xdrRawMetrics, clusterName, service, dcName, ns, metricPrefix)
tmpXdrMetricsToSend := xw.handleRefresh(key, xdrRawMetrics, dcName, ns, metricPrefix)

allMetricsToSend = append(allMetricsToSend, tmpXdrMetricsToSend...)
}
Expand Down Expand Up @@ -108,7 +105,7 @@ func (xw *XdrStatsProcessor) constructMetricNamePrefix(infoKeyToProcess string)
}

func (xw *XdrStatsProcessor) handleRefresh(infoKeyToProcess string, xdrRawMetrics string,
clusterName string, service string, dcName string, ns string, metricPrefix string) []AerospikeStat {
dcName string, ns string, metricPrefix string) []AerospikeStat {
log.Tracef("xdr-%s:%s", infoKeyToProcess, xdrRawMetrics)

stats := commons.ParseStats(xdrRawMetrics, ";")
Expand All @@ -129,12 +126,12 @@ func (xw *XdrStatsProcessor) handleRefresh(infoKeyToProcess string, xdrRawMetric
}

labels := []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE, commons.METRIC_LABEL_DC_NAME}
labelValues := []string{clusterName, service, dcName}
labelValues := []string{ClusterName, Service, dcName}

// if namespace exists, add it to the label and label-values array
if len(ns) > 0 {
labels = []string{commons.METRIC_LABEL_CLUSTER_NAME, commons.METRIC_LABEL_SERVICE, commons.METRIC_LABEL_DC_NAME, commons.METRIC_LABEL_NS}
labelValues = []string{clusterName, service, dcName, ns}
labelValues = []string{ClusterName, Service, dcName, ns}
}

// pushToPrometheus(asMetric, pv, labels, labelsValues, ch)
Expand Down
4 changes: 4 additions & 0 deletions internal/pkg/statprocessors/statsrefresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package statprocessors

import (
commons "github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/commons"
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/config"
"github.com/aerospike/aerospike-prometheus-exporter/internal/pkg/dataprovider"
log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -68,6 +69,9 @@ func Refresh() ([]AerospikeStat, error) {

// set global values
ClusterName, Service, Build = rawMetrics[Infokey_ClusterName], rawMetrics[Infokey_Service], rawMetrics[Infokey_Build]
if config.Cfg.Agent.IsKubernetes {
Service = config.Cfg.Agent.KubernetesPodName
}

// sanitize the utf8 strings before sending them to watchers
for k, v := range rawMetrics {
Expand Down

0 comments on commit cde03d8

Please sign in to comment.