sysmon: Make a copy of dict before modifying it.
I was wondering why the age metric does not exist yet. Now I know.
And knowing is half the battle.
BUG=None
TEST=None
Change-Id: I9d75ad204c970bc5d314acf724d89f55fc1a2607
Reviewed-on: https://chromium-review.googlesource.com/707678
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/scripts/sysmon/puppet_metrics.py b/scripts/sysmon/puppet_metrics.py
index 1d864e2..f55efb8 100644
--- a/scripts/sysmon/puppet_metrics.py
+++ b/scripts/sysmon/puppet_metrics.py
@@ -87,7 +87,7 @@
@property
def times(self):
"""Return mapping of time information."""
- times = self._data.get('time', {})
+ times = self._data.get('time', {}).copy()
times.pop('last_run', None)
total = times.pop('total', None)
times['other'] = max(0, total - sum(times.itervalues()))