)]}'
{"monasca_agent/common/metrics.py":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"7dfddc49e5d68f8a10e59b47015a49cce7740816","unresolved":false,"context_lines":[{"line_number":263,"context_line":"    def _rate(self, sample1, sample2):"},{"line_number":264,"context_line":"        rate_interval \u003d sample2[0] - sample1[0]"},{"line_number":265,"context_line":"        if rate_interval \u003d\u003d 0:"},{"line_number":266,"context_line":"            log.exception(\u0027Metric {0} has an interval of 0. New timestamp \u0027"},{"line_number":267,"context_line":"                          \u0027\u003d {1} and old timestamp \u003d {2}. Not flushing\u0027."},{"line_number":268,"context_line":"                          format(self.name, sample2[0], sample1[0]))"},{"line_number":269,"context_line":"            raise Infinity()"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_d46390af","line":266,"range":{"start_line":266,"start_character":16,"end_line":266,"end_character":25},"updated":"2016-06-30 16:26:42.000000000","message":"There hasn\u0027t been an exception raised yet. What will this do?","commit_id":"08e10b6280b45f00427827e2a5f9f8b35fb1a93d"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"50605612281b0dd5e03e8c044fdc3ecf2e3b76f5","unresolved":false,"context_lines":[{"line_number":263,"context_line":"    def _rate(self, sample1, sample2):"},{"line_number":264,"context_line":"        rate_interval \u003d sample2[0] - sample1[0]"},{"line_number":265,"context_line":"        if rate_interval \u003d\u003d 0:"},{"line_number":266,"context_line":"            log.exception(\u0027Metric {0} has an interval of 0. New timestamp \u0027"},{"line_number":267,"context_line":"                          \u0027\u003d {1} and old timestamp \u003d {2}. Not flushing\u0027."},{"line_number":268,"context_line":"                          format(self.name, sample2[0], sample1[0]))"},{"line_number":269,"context_line":"            raise Infinity()"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_62d9d7f4","line":266,"range":{"start_line":266,"start_character":16,"end_line":266,"end_character":25},"in_reply_to":"3aaa91ec_9c0d78ea","updated":"2016-07-01 17:20:08.000000000","message":"If you aren\u0027t logging an exception, wouldn\u0027t you want this to be log.error, or as originally coded as log.warn. \n\nI\u0027m not sure that this is an exception or an error, therefore would warn as originally coded still be more appropriate.","commit_id":"08e10b6280b45f00427827e2a5f9f8b35fb1a93d"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"5140b934a1cfaeec14df9e9e63e8bdd4a1ab31e4","unresolved":false,"context_lines":[{"line_number":263,"context_line":"    def _rate(self, sample1, sample2):"},{"line_number":264,"context_line":"        rate_interval \u003d sample2[0] - sample1[0]"},{"line_number":265,"context_line":"        if rate_interval \u003d\u003d 0:"},{"line_number":266,"context_line":"            log.exception(\u0027Metric {0} has an interval of 0. New timestamp \u0027"},{"line_number":267,"context_line":"                          \u0027\u003d {1} and old timestamp \u003d {2}. Not flushing\u0027."},{"line_number":268,"context_line":"                          format(self.name, sample2[0], sample1[0]))"},{"line_number":269,"context_line":"            raise Infinity()"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_9c0d78ea","line":266,"range":{"start_line":266,"start_character":16,"end_line":266,"end_character":25},"in_reply_to":"3aaa91ec_d46390af","updated":"2016-06-30 22:01:35.000000000","message":"Thank you for catching this. This will just return the error message and then with None after that. No trace at all...","commit_id":"08e10b6280b45f00427827e2a5f9f8b35fb1a93d"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"7dfddc49e5d68f8a10e59b47015a49cce7740816","unresolved":false,"context_lines":[{"line_number":271,"context_line":"        delta \u003d sample2[1] - sample1[1]"},{"line_number":272,"context_line":"        if delta \u003c 0:"},{"line_number":273,"context_line":"            log.info(\u0027Metric {0} has a rate \u003c 0. New value \u003d {1} and old \u0027"},{"line_number":274,"context_line":"                     \u0027value \u003d {2}Counter may have been Reset.\u0027."},{"line_number":275,"context_line":"                     format(self.name, sample2[1], sample1[1]))"},{"line_number":276,"context_line":"            raise UnknownValue()"},{"line_number":277,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_cab584ed","line":274,"range":{"start_line":274,"start_character":31,"end_line":274,"end_character":34},"updated":"2016-06-30 16:26:42.000000000","message":"Need a space between {2}C","commit_id":"08e10b6280b45f00427827e2a5f9f8b35fb1a93d"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"50605612281b0dd5e03e8c044fdc3ecf2e3b76f5","unresolved":false,"context_lines":[{"line_number":271,"context_line":"        delta \u003d sample2[1] - sample1[1]"},{"line_number":272,"context_line":"        if delta \u003c 0:"},{"line_number":273,"context_line":"            log.info(\u0027Metric {0} has a rate \u003c 0. New value \u003d {1} and old \u0027"},{"line_number":274,"context_line":"                     \u0027value \u003d {2}Counter may have been Reset.\u0027."},{"line_number":275,"context_line":"                     format(self.name, sample2[1], sample1[1]))"},{"line_number":276,"context_line":"            raise UnknownValue()"},{"line_number":277,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_42d65bc4","line":274,"range":{"start_line":274,"start_character":31,"end_line":274,"end_character":34},"in_reply_to":"3aaa91ec_cab584ed","updated":"2016-07-01 17:20:08.000000000","message":"Also, I\u0027m wondering if this log.info should be a log.warn.","commit_id":"08e10b6280b45f00427827e2a5f9f8b35fb1a93d"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"5d7f29c43c7b752283b4c7b9173fddd0da7e5d16","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        self.hostname \u003d hostname"},{"line_number":250,"context_line":"        self.device_name \u003d device_name"},{"line_number":251,"context_line":"        self.samples \u003d []"},{"line_number":252,"context_line":"        self.value \u003d None"},{"line_number":253,"context_line":""},{"line_number":254,"context_line":"    def sample(self, value, sample_rate, timestamp\u003dNone):"},{"line_number":255,"context_line":"        if not timestamp:"}],"source_content_type":"text/x-python","patch_set":4,"id":"3aaa91ec_aca3b8b0","line":252,"range":{"start_line":252,"start_character":8,"end_line":252,"end_character":25},"updated":"2016-07-01 21:51:54.000000000","message":"Why did you remove the value_meta handling? It should say something about this in your commit message","commit_id":"d844977cd334cb837bd7c0e4dbd991d607ed6253"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"7fccf77afc9a0e6c474d1af162d30a8a01973e36","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        self.hostname \u003d hostname"},{"line_number":250,"context_line":"        self.device_name \u003d device_name"},{"line_number":251,"context_line":"        self.samples \u003d []"},{"line_number":252,"context_line":"        self.value \u003d None"},{"line_number":253,"context_line":""},{"line_number":254,"context_line":"    def sample(self, value, sample_rate, timestamp\u003dNone):"},{"line_number":255,"context_line":"        if not timestamp:"}],"source_content_type":"text/x-python","patch_set":4,"id":"1aa78d24_2b4b392d","line":252,"range":{"start_line":252,"start_character":8,"end_line":252,"end_character":25},"in_reply_to":"3aaa91ec_aca3b8b0","updated":"2016-07-01 22:01:02.000000000","message":"Sorry that was by accident...","commit_id":"d844977cd334cb837bd7c0e4dbd991d607ed6253"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"5d7f29c43c7b752283b4c7b9173fddd0da7e5d16","unresolved":false,"context_lines":[{"line_number":263,"context_line":"                self.value \u003d self._rate(self.samples[-2], self.samples[-1])"},{"line_number":264,"context_line":"                self.samples \u003d self.samples[-1:]"},{"line_number":265,"context_line":"            except Exception:"},{"line_number":266,"context_line":"                log.exception(\"No flushing for Metric {0}.\".format(self.name))"},{"line_number":267,"context_line":"                raise Exception"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"    def _rate(self, sample1, sample2):"}],"source_content_type":"text/x-python","patch_set":4,"id":"3aaa91ec_2cab4820","line":266,"range":{"start_line":266,"start_character":16,"end_line":266,"end_character":78},"updated":"2016-07-01 21:51:54.000000000","message":"Shouldn\u0027t you also set self.value \u003d None here? Otherwise, it will still have the value it did for the previous sample.","commit_id":"d844977cd334cb837bd7c0e4dbd991d607ed6253"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"7fccf77afc9a0e6c474d1af162d30a8a01973e36","unresolved":false,"context_lines":[{"line_number":263,"context_line":"                self.value \u003d self._rate(self.samples[-2], self.samples[-1])"},{"line_number":264,"context_line":"                self.samples \u003d self.samples[-1:]"},{"line_number":265,"context_line":"            except Exception:"},{"line_number":266,"context_line":"                log.exception(\"No flushing for Metric {0}.\".format(self.name))"},{"line_number":267,"context_line":"                raise Exception"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"    def _rate(self, sample1, sample2):"}],"source_content_type":"text/x-python","patch_set":4,"id":"1aa78d24_8bbeadd2","line":266,"range":{"start_line":266,"start_character":16,"end_line":266,"end_character":78},"in_reply_to":"3aaa91ec_2cab4820","updated":"2016-07-01 22:01:02.000000000","message":"Done","commit_id":"d844977cd334cb837bd7c0e4dbd991d607ed6253"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"18ca425fb0430f9f1ac48555866d858c0b3eda65","unresolved":false,"context_lines":[{"line_number":270,"context_line":"            except Exception:"},{"line_number":271,"context_line":"                self.value \u003d None"},{"line_number":272,"context_line":"                log.exception(\"No flushing for Metric {0}.\".format(self.name))"},{"line_number":273,"context_line":"                raise Exception"},{"line_number":274,"context_line":""},{"line_number":275,"context_line":"    def _rate(self, sample1, sample2):"},{"line_number":276,"context_line":"        rate_interval \u003d sample2[0] - sample1[0]"}],"source_content_type":"text/x-python","patch_set":5,"id":"1aa78d24_7acb2e73","line":273,"updated":"2016-07-04 04:21:01.000000000","message":"I think you are actually raising new exception and lose all information from the old one. Either label the caught exception or simple write raise","commit_id":"4d14de519752b750cea80c8be0baba4d98d0a473"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"f20659b3229647f771c2be99f3f365aa51d66477","unresolved":false,"context_lines":[{"line_number":268,"context_line":"                self.samples \u003d self.samples[-1:]"},{"line_number":269,"context_line":"            except Exception as e:"},{"line_number":270,"context_line":"                self.value \u003d None"},{"line_number":271,"context_line":"                log.exception(\u0027No flushing for Metric {0}, returned {1}\u0027."},{"line_number":272,"context_line":"                              format(self.name, e))"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    def _rate(self, sample1, sample2):"}],"source_content_type":"text/x-python","patch_set":8,"id":"1aa78d24_a2d7d5bd","line":271,"range":{"start_line":271,"start_character":34,"end_line":271,"end_character":42},"updated":"2016-07-05 19:25:18.000000000","message":"This error message should change.  We\u0027re not flushing when we detect this error now.","commit_id":"860e06ea78a79fceb34ba7f963f6afd3c440d5c1"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"fadd14b8b33c8816e464537a2882d2b530d69c1f","unresolved":false,"context_lines":[{"line_number":268,"context_line":"                self.samples \u003d self.samples[-1:]"},{"line_number":269,"context_line":"            except Exception as e:"},{"line_number":270,"context_line":"                self.value \u003d None"},{"line_number":271,"context_line":"                log.exception(\u0027No flushing for Metric {0}, returned {1}\u0027."},{"line_number":272,"context_line":"                              format(self.name, e))"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    def _rate(self, sample1, sample2):"}],"source_content_type":"text/x-python","patch_set":8,"id":"1aa78d24_385f92e6","line":271,"range":{"start_line":271,"start_character":34,"end_line":271,"end_character":42},"in_reply_to":"1aa78d24_a2d7d5bd","updated":"2016-07-05 19:56:38.000000000","message":"Yep we are sampling now!","commit_id":"860e06ea78a79fceb34ba7f963f6afd3c440d5c1"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"634bf15469f5a738fdaca460b75b0d712d227f18","unresolved":false,"context_lines":[{"line_number":272,"context_line":"                              format(self.name, e))"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    def _rate(self, sample1, sample2):"},{"line_number":275,"context_line":"        rate_interval \u003d sample2[0] - sample1[0]"},{"line_number":276,"context_line":"        if rate_interval \u003d\u003d 0:"},{"line_number":277,"context_line":"            log.error(\u0027Metric {0} has an interval of 0. New timestamp \u003d {1} \u0027"},{"line_number":278,"context_line":"                      \u0027and old timestamp \u003d {2}.\u0027."}],"source_content_type":"text/x-python","patch_set":9,"id":"1aa78d24_6e026fb6","line":275,"range":{"start_line":275,"start_character":8,"end_line":275,"end_character":21},"updated":"2016-07-07 21:19:15.000000000","message":"this variable could just be called interval, or delta_t, rate_interval is just a bit obtuse.","commit_id":"b398407576589d58c184849451b0ebb8a431bf94"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"634bf15469f5a738fdaca460b75b0d712d227f18","unresolved":false,"context_lines":[{"line_number":277,"context_line":"            log.error(\u0027Metric {0} has an interval of 0. New timestamp \u003d {1} \u0027"},{"line_number":278,"context_line":"                      \u0027and old timestamp \u003d {2}.\u0027."},{"line_number":279,"context_line":"                      format(self.name, sample2[0], sample1[0]))"},{"line_number":280,"context_line":"            raise Infinity()"},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        delta \u003d sample2[1] - sample1[1]"},{"line_number":283,"context_line":"        if delta \u003c 0:"}],"source_content_type":"text/x-python","patch_set":9,"id":"1aa78d24_ce8603db","line":280,"range":{"start_line":280,"start_character":18,"end_line":280,"end_character":26},"updated":"2016-07-07 21:19:15.000000000","message":"I\u0027m not sure a would check for equality to 0, although, 0 is certainly a bad value to have when trying to calculate a rate. The subsequent division down below would result in an overflow.\n\nHowever, I\u0027m just wondering if you want to remove the test for equality to 0 and do the division anyway. For example, see how this was done in the new ovs plugin at, https://github.com/openstack/monasca-agent/blob/master/monasca_agent/collector/checks_d/ovs.py#L88 or libvirt plugin at, https://github.com/openstack/monasca-agent/blob/master/monasca_agent/collector/checks_d/libvirt.py#L711","commit_id":"b398407576589d58c184849451b0ebb8a431bf94"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"634bf15469f5a738fdaca460b75b0d712d227f18","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                      format(self.name, sample2[0], sample1[0]))"},{"line_number":280,"context_line":"            raise Infinity()"},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        delta \u003d sample2[1] - sample1[1]"},{"line_number":283,"context_line":"        if delta \u003c 0:"},{"line_number":284,"context_line":"            log.info(\u0027Metric {0} has a rate \u003c 0. New value \u003d {1} and old \u0027"},{"line_number":285,"context_line":"                     \u0027value \u003d {2}. Counter may have been Reset.\u0027."}],"source_content_type":"text/x-python","patch_set":9,"id":"1aa78d24_6ee42fac","line":282,"range":{"start_line":282,"start_character":8,"end_line":282,"end_character":13},"updated":"2016-07-07 21:19:15.000000000","message":"If you called the above delta_t, then this would be delta_v.","commit_id":"b398407576589d58c184849451b0ebb8a431bf94"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"634bf15469f5a738fdaca460b75b0d712d227f18","unresolved":false,"context_lines":[{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        delta \u003d sample2[1] - sample1[1]"},{"line_number":283,"context_line":"        if delta \u003c 0:"},{"line_number":284,"context_line":"            log.info(\u0027Metric {0} has a rate \u003c 0. New value \u003d {1} and old \u0027"},{"line_number":285,"context_line":"                     \u0027value \u003d {2}. Counter may have been Reset.\u0027."},{"line_number":286,"context_line":"                     format(self.name, sample2[1], sample1[1]))"},{"line_number":287,"context_line":"            raise UnknownValue()"}],"source_content_type":"text/x-python","patch_set":9,"id":"1aa78d24_ae61f713","line":284,"range":{"start_line":284,"start_character":16,"end_line":284,"end_character":20},"updated":"2016-07-07 21:19:15.000000000","message":"Not sure I would leave this as log.info, it seems like more of a log.warn to me. You got a delta value that was unexpected. However, it isn\u0027t necessarily an error, but it seems like it is more than an info level log message.","commit_id":"b398407576589d58c184849451b0ebb8a431bf94"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"66cf3ab7a51f796180fb2781d9860e52de1f8563","unresolved":false,"context_lines":[{"line_number":284,"context_line":"                      format(self.name, sample2[1], sample1[1]))"},{"line_number":285,"context_line":"            raise UnknownValue()"},{"line_number":286,"context_line":""},{"line_number":287,"context_line":"        return delta_v / float(delta_t)"},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"    def flush(self, timestamp):"},{"line_number":290,"context_line":"        if not self.value:"}],"source_content_type":"text/x-python","patch_set":11,"id":"fad55976_a66f4a91","line":287,"range":{"start_line":287,"start_character":8,"end_line":287,"end_character":14},"updated":"2016-07-15 22:46:57.000000000","message":"Hi Kaiyan, Others might have a different opinion, but I would have written this another way. I would have had the exception for ZeroDivisionError in _rate, and then always return a value. For example\n\n    def _rate(self, sample1, sample2):\n        delta_t \u003d sample2[0] - sample1[0]\n        delta_v \u003d sample2[1] - sample1[1]\n        rate \u003d None\n\n        if delta_v \u003c 0:\n            log.debug(\u0027Metric {0} has a rate \u003c 0. New value \u003d {1} and old \u0027\n                      \u0027value \u003d {2}. Counter may have been Reset.\u0027.\n                      format(self.name, sample2[1], sample1[1]))\n            return rate\n\n        try:\n            rate \u003d  delta_v / float(delta_t)\n        except ZeroDivisionError as e:\n            log.exception(...)\n\n        return rate","commit_id":"345c314c4d59a349308cc212fcbe7b8ea927e601"},{"author":{"_account_id":18179,"name":"Kaiyan Sheng","email":"kaiyan.sheng@hpe.com","username":"kaiyan-sheng"},"change_message_id":"5535876f7441ddfee1e7aacdbf17ddae650fb430","unresolved":false,"context_lines":[{"line_number":284,"context_line":"                      format(self.name, sample2[1], sample1[1]))"},{"line_number":285,"context_line":"            raise UnknownValue()"},{"line_number":286,"context_line":""},{"line_number":287,"context_line":"        return delta_v / float(delta_t)"},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"    def flush(self, timestamp):"},{"line_number":290,"context_line":"        if not self.value:"}],"source_content_type":"text/x-python","patch_set":11,"id":"dada55a8_b0d72cbe","line":287,"range":{"start_line":287,"start_character":8,"end_line":287,"end_character":14},"in_reply_to":"fad55976_a66f4a91","updated":"2016-07-19 22:25:41.000000000","message":"Thanks Roland!!! I decide to like your idea :-)","commit_id":"345c314c4d59a349308cc212fcbe7b8ea927e601"}]}
