graphite-dev team mailing list archive
-
graphite-dev team
-
Mailing list archive
-
Message #00893
Re: [Question #157047]: How to get listing of all available paths
Question #157047 on Graphite changed:
https://answers.launchpad.net/graphite/+question/157047
Status: Answered => Solved
Andrew Feller confirmed that the question is solved:
Would y'all consider the following path to
/opt/graphite/webapp/graphite/metrics/views.py:
111,119d110
< elif format == 'depth':
< result = {
< 'results': sorted(depth_nodes(store, matches))
< }
< response = HttpResponse(json.dumps(result), mimetype='text/json')
< response['Pragma'] = 'no-cache'
< response['Cache-Control'] = 'no-cache'
< return response
<
128,140d118
< def depth_nodes(store, nodes):
< "Provide depth listing of leaf nodes"
< results = set()
< for n in nodes:
< if n.isLeaf():
< results.add(n.metric_path)
<
< else:
< results.update(depth_nodes(store, store.find( n.metric_path + '.*')))
<
< return results
<
<
This simply returns a listing of all leaf nodes within the matching
nodes. Sorry but this is my first time writing Python, so please clean
up as needed.
--
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.