mirror of
https://github.com/facebook/sapling.git
synced 2024-12-28 07:33:10 +03:00
metrics: treat slash '/' as metric delimiter
Summary: Slash is probably the standard metric delimiter nowadays. Since we don't have that many metrics I think that it makes sense to look at slash as the standard metric delimiter going forward. This diff updates parsing of metric names to treat both '_' and '/' as delimiters. Reviewed By: quark-zju Differential Revision: D23577876 fbshipit-source-id: 03997b1285df9c52d6e2837b5af5372deb69b133
This commit is contained in:
parent
4ad9091598
commit
ead17552cf
@ -425,9 +425,10 @@ def dispatch(req):
|
||||
# Re-arrange metrics so "a_b_c", "a_b_d", "a_c" becomes
|
||||
# {'a': {'b': {'c': ..., 'd': ...}, 'c': ...}
|
||||
metrics = {}
|
||||
splitre = re.compile("_|/")
|
||||
for key, value in ui.metrics.stats.items():
|
||||
cur = metrics
|
||||
names = key.split("_")
|
||||
names = splitre.split(key)
|
||||
for name in names[:-1]:
|
||||
cur = cur.setdefault(name, {})
|
||||
cur[names[-1]] = value
|
||||
|
Loading…
Reference in New Issue
Block a user