本文整理汇总了Python中graphite.storage.Store.get_finders方法的典型用法代码示例。如果您正苦于以下问题:Python Store.get_finders方法的具体用法?Python Store.get_finders怎么用?Python Store.get_finders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphite.storage.Store
的用法示例。
在下文中一共展示了Store.get_finders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fetch
# 需要导入模块: from graphite.storage import Store [as 别名]
# 或者: from graphite.storage.Store import get_finders [as 别名]
def test_fetch(self):
disabled_finder = get_finders('tests.test_storage.DisabledFinder')[0]
legacy_finder = get_finders('tests.test_storage.LegacyFinder')[0]
test_finder = get_finders('tests.test_storage.TestFinder')[0]
remote_finder = get_finders('tests.test_storage.RemoteFinder')[0]
store = Store(
finders=[disabled_finder, legacy_finder, test_finder, remote_finder],
tagdb=get_tagdb('graphite.tags.localdatabase.LocalDatabaseTagDB')
)
# tagb is properly initialized
self.assertIsInstance(store.tagdb, LocalDatabaseTagDB)
# get all enabled finders
finders = store.get_finders()
self.assertEqual(list(finders), [legacy_finder, test_finder, remote_finder])
# get only local finders
finders = store.get_finders(local=True)
self.assertEqual(list(finders), [legacy_finder, test_finder])
# fetch with empty patterns
result = store.fetch([], 1, 2, 3, {})
self.assertEqual(result, [])
# fetch
result = store.fetch(['a.**'], 1, 2, 3, {})
self.assertEqual(len(result), 3)
result.sort(key=lambda node: node['name'])
self.assertEqual(result[0]['name'], 'a.b.c.d')
self.assertEqual(result[0]['pathExpression'], 'a.**')
self.assertEqual(result[1]['name'], 'a.b.c.d')
self.assertEqual(result[1]['pathExpression'], 'a.**')
self.assertEqual(result[2]['name'], 'a.b.c.e')
self.assertEqual(result[2]['pathExpression'], 'a.**')