Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the parsing of metaKey to resolve namespaces #38

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/aerospike/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var (
TLSTag: "tls",
TLSHostnameMetaKey: "tls-hostname",
NamespaceMetaKey: "",
NamespaceMetaKeyPrefix: "",
NamespaceMetaKeyPrefix: "aerospike-monitoring-",
MonitoringSet: "monitoring",
LatencyKeyPrefix: "monitoring_latency_",
DurabilityKeyPrefix: "monitoring_durability_",
Expand Down
6 changes: 4 additions & 2 deletions pkg/aerospike/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading