diff --git a/pkg/aerospike/config.go b/pkg/aerospike/config.go index 00c123b..e54b8f4 100644 --- a/pkg/aerospike/config.go +++ b/pkg/aerospike/config.go @@ -64,7 +64,7 @@ var ( TLSTag: "tls", TLSHostnameMetaKey: "tls-hostname", NamespaceMetaKey: "", - NamespaceMetaKeyPrefix: "", + NamespaceMetaKeyPrefix: "aerospike-monitoring-", MonitoringSet: "monitoring", LatencyKeyPrefix: "monitoring_latency_", DurabilityKeyPrefix: "monitoring_durability_", diff --git a/pkg/aerospike/discovery.go b/pkg/aerospike/discovery.go index ff6540d..8ba82c4 100644 --- a/pkg/aerospike/discovery.go +++ b/pkg/aerospike/discovery.go @@ -96,8 +96,10 @@ func (conf AerospikeProbeConfig) getNamespacesFromEntry(logger log.Logger, entry if !ready { continue } - ns := strings.Split(metaKey, "-")[2] // MetaKey is like : "aerospike-monitoring-closeststore" - namespaces[ns] = struct{}{} + ns := metaKey[len(conf.AerospikeEndpointConfig.NamespaceMetaKeyPrefix):] // MetaKey is like : "aerospike-monitoring-closeststore" + if len(ns) > 0 { + namespaces[ns] = struct{}{} + } } // DEPRECATED way to get namespaces in case of fallback required or empty namespaces with the new method