本文整理匯總了Python中graphite.storage.Store.find_all方法的典型用法代碼示例。如果您正苦於以下問題:Python Store.find_all方法的具體用法?Python Store.find_all怎麽用?Python Store.find_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類graphite.storage.Store
的用法示例。
在下文中一共展示了Store.find_all方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Source
# 需要導入模塊: from graphite.storage import Store [as 別名]
# 或者: from graphite.storage.Store import find_all [as 別名]
class Source(object):
"""The Source wraps up a graphite.Store and gives you Coal"""
def __init__(self, hostname=False, directory=DEFAULT_COAL_HOLE):
if hostname:
self.store = Store(remote_hosts=[hostname])
elif directory:
self.store = Store(directories=[directory])
else:
raise ValueError, "hostname or directory required"
def get_nodes(self, bucket='*', max_depth=9, depth=0):
for bucket in self.store.find_all(bucket):
if bucket.isLeaf():
yield Node(bucket)
else:
if depth < max_depth:
for node in self.get_nodes(bucket=bucket.metric_path + '.*', depth=depth + 1):
yield node
def get_hosts(self, glob=DEFAULT_HOST_GLOB):
return [host for host in self.store.find_all(glob)]