Skip to content

Commit

Permalink
tagged series support for ceres
Browse files Browse the repository at this point in the history
  • Loading branch information
DanCech committed Sep 5, 2017
1 parent e4b6ae4 commit 2d8149d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion webapp/graphite/finders/ceres.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ def __init__(self, directory=None):

def find_nodes(self, query):

variants = extract_variants(query.pattern)
# translate query pattern if it is tagged
if ';' in query.pattern and not query.pattern.startswith('_tagged.'):
hash = sha256(query.pattern).hexdigest()
variants = ['.'.join(['_tagged', hash[0:3], hash[3:6], query.pattern.replace('.', '-')])]
else:
variants = extract_variants(query.pattern)

for variant in variants:
for fs_path in glob(self.tree.getFilesystemPath(variant)):
Expand All @@ -34,6 +39,9 @@ def find_nodes(self, query):
real_metric_path = get_real_metric_path(
fs_path, metric_path)
reader = CeresReader(ceres_node, real_metric_path)
# if we're finding by tag, return the proper metric path
if ';' in query.pattern and not query.pattern.startswith('_tagged.'):
metric_path = query.pattern
yield LeafNode(metric_path, reader)

elif os.path.isdir(fs_path):
Expand Down

0 comments on commit 2d8149d

Please sign in to comment.