Ottomata has uploaded a new change for review. https://gerrit.wikimedia.org/r/99678
Change subject: Fixing bug where JsonLogster would only report metrics for last line in file ...................................................................... Fixing bug where JsonLogster would only report metrics for last line in file Change-Id: I5f3c2d07e55395f80716c1fdf0b1375f2624a8be --- M logster/parsers/JsonLogster.py 1 file changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/debs/logster refs/changes/78/99678/1 diff --git a/logster/parsers/JsonLogster.py b/logster/parsers/JsonLogster.py index a228f64..582aae1 100644 --- a/logster/parsers/JsonLogster.py +++ b/logster/parsers/JsonLogster.py @@ -90,7 +90,11 @@ object's state variables. Takes a single argument, the line to be parsed.''' json_data = json.loads(line) - self.metrics = self.flatten_object(json.loads(line), self.key_separator, self.key_filter) + # Using update() in order to work with multiple lines. + # Since lines are parsed in order as they appear in the file, + # if there are multiple entries for the same key, this will + # end up using the latest value for that key. + self.metrics.update(self.flatten_object(json.loads(line), self.key_separator, self.key_filter)) def get_state(self, duration): '''Run any necessary calculations on the data collected from the logs -- To view, visit https://gerrit.wikimedia.org/r/99678 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5f3c2d07e55395f80716c1fdf0b1375f2624a8be Gerrit-PatchSet: 1 Gerrit-Project: operations/debs/logster Gerrit-Branch: master Gerrit-Owner: Ottomata <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits