// GetQueriedNamespaces returns all matched metrics namespaces for query 'ns' which can contain // an asterisk or tuple (refer to query support) func (mc *metricCatalog) GetQueriedNamespaces(ns core.Namespace) ([]core.Namespace, error) { mc.mutex.Lock() defer mc.mutex.Unlock() // get metric key (might contain wildcard(s)) wkey := ns.Key() return mc.matchedNamespaces(wkey) }
// Remove removes a metricType from the catalog and from matching map func (mc *metricCatalog) Remove(ns core.Namespace) { mc.mutex.Lock() defer mc.mutex.Unlock() mc.tree.Remove(ns.Strings()) // remove all items from map mKey mapped for this 'ns' key := ns.Key() mc.removeMatchedKey(key) }
// MatchQuery matches given 'ns' which could contain an asterisk or a tuple and add them to matching map under key 'ns' // The matched metrics namespaces are also returned (as a []core.Namespace) func (mc *metricCatalog) MatchQuery(ns core.Namespace) ([]core.Namespace, error) { mc.mutex.Lock() defer mc.mutex.Unlock() // get metric key (might contain wildcard(s)) wkey := ns.Key() // adding matched namespaces to map mc.addItemToMatchingMap(wkey) return mc.matchedNamespaces(wkey) }