)]}'
{"agent.conf.template":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"33868d00d7aa58749fe5757c3d4da91ac4b2da38","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":"# Maximum number of messages to buffer when unable to communicate with the monasca-api"},{"line_number":21,"context_line":"max_buffer_size: 1000"},{"line_number":22,"context_line":"# Maximum number of messages to send when communication with the monasca-api is restored"},{"line_number":23,"context_line":"backlog_send_rate: 1000"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"[Main]"}],"source_content_type":"application/octet-stream","patch_set":5,"id":"baa201ad_a905f111","line":22,"updated":"2014-10-08 15:37:02.000000000","message":"I assume this is rate per some amount of time. The comment should specify what that amount of time is so the user has some idea of what will happen","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"7ab5799b6c5da96e89509572bef3ebc0512f783b","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":"# Maximum number of messages to buffer when unable to communicate with the monasca-api"},{"line_number":21,"context_line":"max_buffer_size: 1000"},{"line_number":22,"context_line":"# Maximum number of messages to send when communication with the monasca-api is restored"},{"line_number":23,"context_line":"backlog_send_rate: 1000"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"[Main]"}],"source_content_type":"application/octet-stream","patch_set":5,"id":"baa201ad_c802056f","line":22,"in_reply_to":"baa201ad_a905f111","updated":"2014-10-09 21:49:55.000000000","message":"Done","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"}],"monagent/forwarder/api/mon.py":[{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"5292656ae4071390ac1c772e567c845ae4cf3a70","unresolved":false,"context_lines":[{"line_number":42,"context_line":"        self.max_retries \u003d config[\u0027max_retries\u0027]"},{"line_number":43,"context_line":"        self.max_buffer_size \u003d config[\u0027max_buffer_size\u0027]"},{"line_number":44,"context_line":"        self.backlog_send_rate \u003d config[\u0027backlog_send_rate\u0027]"},{"line_number":45,"context_line":"        self.message_queue \u003d deque(maxlen \u003d self.max_buffer_size)"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"    def _post(self, measurements):"},{"line_number":48,"context_line":"        \"\"\"Does the actual http post"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_dc998720","line":45,"updated":"2014-10-02 22:40:28.000000000","message":"pep8, remove spaces around \u003d when in an arg","commit_id":"a8bff79d694c65834b3a5d2bdba31858b4985236"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"6fb01e38fbbc177baebdc5e1a194aa81cee864a7","unresolved":false,"context_lines":[{"line_number":42,"context_line":"        self.max_retries \u003d config[\u0027max_retries\u0027]"},{"line_number":43,"context_line":"        self.max_buffer_size \u003d config[\u0027max_buffer_size\u0027]"},{"line_number":44,"context_line":"        self.backlog_send_rate \u003d config[\u0027backlog_send_rate\u0027]"},{"line_number":45,"context_line":"        self.message_queue \u003d deque(maxlen \u003d self.max_buffer_size)"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"    def _post(self, measurements):"},{"line_number":48,"context_line":"        \"\"\"Does the actual http post"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_df3b399a","line":45,"in_reply_to":"baa201ad_dc998720","updated":"2014-10-02 23:00:30.000000000","message":"Done","commit_id":"a8bff79d694c65834b3a5d2bdba31858b4985236"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"5292656ae4071390ac1c772e567c845ae4cf3a70","unresolved":false,"context_lines":[{"line_number":61,"context_line":"            sent \u003d self._send_message(**kwargs)"},{"line_number":62,"context_line":"    "},{"line_number":63,"context_line":"            if sent:"},{"line_number":64,"context_line":"                if len(self.message_queue) \u003e 0:"},{"line_number":65,"context_line":"                    for index in range(0, len(self.message_queue)):"},{"line_number":66,"context_line":"                        if index \u003c self.backlog_send_rate:"},{"line_number":67,"context_line":"                            msg \u003d self.message_queue.pop()"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_bcef6386","line":64,"updated":"2014-10-02 22:40:28.000000000","message":"if sent and len(self.message_queue) \u003e 0:","commit_id":"a8bff79d694c65834b3a5d2bdba31858b4985236"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"6fb01e38fbbc177baebdc5e1a194aa81cee864a7","unresolved":false,"context_lines":[{"line_number":61,"context_line":"            sent \u003d self._send_message(**kwargs)"},{"line_number":62,"context_line":"    "},{"line_number":63,"context_line":"            if sent:"},{"line_number":64,"context_line":"                if len(self.message_queue) \u003e 0:"},{"line_number":65,"context_line":"                    for index in range(0, len(self.message_queue)):"},{"line_number":66,"context_line":"                        if index \u003c self.backlog_send_rate:"},{"line_number":67,"context_line":"                            msg \u003d self.message_queue.pop()"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_bf3835a1","line":64,"in_reply_to":"baa201ad_bcef6386","updated":"2014-10-02 23:00:30.000000000","message":"Done","commit_id":"a8bff79d694c65834b3a5d2bdba31858b4985236"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"5292656ae4071390ac1c772e567c845ae4cf3a70","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    def _send_message(self, **kwargs):"},{"line_number":110,"context_line":"        retry_count \u003d 0"},{"line_number":111,"context_line":"        sent \u003d False"},{"line_number":112,"context_line":"        while not sent and retry_count \u003c self.max_retries:"},{"line_number":113,"context_line":"            try:"},{"line_number":114,"context_line":"                response \u003d self.mon_client.metrics.create(**kwargs)"},{"line_number":115,"context_line":"                sent \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_bf4e756d","line":112,"updated":"2014-10-02 22:40:28.000000000","message":"Seems like this can be simplified to make it a bit easier to follow,\nfor i in range(1, self.max_retries + 1):\n            try:\n                self.mon_client.metrics.create(**kwargs)\n                return True\n            except exc.HTTPException as he:\n                if \u0027unauthorized\u0027 in str(he):\n                    log.info(\"Getting a new token and retrying {0} out of {1} times...\"\n                             .format(i, self.max_retries))\n                    # Get a new token and retry\n                    self.mon_client.replace_token(self.keystone.refresh_token())\n                else:\n                    log.error(\"Error sending message to mon-api: {0}\"\n                              .format(str(he.message)))","commit_id":"a8bff79d694c65834b3a5d2bdba31858b4985236"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"6fb01e38fbbc177baebdc5e1a194aa81cee864a7","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    def _send_message(self, **kwargs):"},{"line_number":110,"context_line":"        retry_count \u003d 0"},{"line_number":111,"context_line":"        sent \u003d False"},{"line_number":112,"context_line":"        while not sent and retry_count \u003c self.max_retries:"},{"line_number":113,"context_line":"            try:"},{"line_number":114,"context_line":"                response \u003d self.mon_client.metrics.create(**kwargs)"},{"line_number":115,"context_line":"                sent \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_3fcfe580","line":112,"in_reply_to":"baa201ad_bf4e756d","updated":"2014-10-02 23:00:30.000000000","message":"Done","commit_id":"a8bff79d694c65834b3a5d2bdba31858b4985236"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"5292656ae4071390ac1c772e567c845ae4cf3a70","unresolved":false,"context_lines":[{"line_number":122,"context_line":"                    self.mon_client.replace_token(self.keystone.refresh_token())"},{"line_number":123,"context_line":"                    continue"},{"line_number":124,"context_line":"                else:"},{"line_number":125,"context_line":"                    log.error(\"Error sending message to mon-api: {0}\""},{"line_number":126,"context_line":"                              .format(str(he.message)))"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"        return sent"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_df51790f","line":125,"updated":"2014-10-02 22:40:28.000000000","message":"It would be nice to log the retries here also.","commit_id":"a8bff79d694c65834b3a5d2bdba31858b4985236"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"6fb01e38fbbc177baebdc5e1a194aa81cee864a7","unresolved":false,"context_lines":[{"line_number":122,"context_line":"                    self.mon_client.replace_token(self.keystone.refresh_token())"},{"line_number":123,"context_line":"                    continue"},{"line_number":124,"context_line":"                else:"},{"line_number":125,"context_line":"                    log.error(\"Error sending message to mon-api: {0}\""},{"line_number":126,"context_line":"                              .format(str(he.message)))"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"        return sent"}],"source_content_type":"text/x-python","patch_set":1,"id":"baa201ad_ffb55dee","line":125,"in_reply_to":"baa201ad_df51790f","updated":"2014-10-02 23:00:30.000000000","message":"Done","commit_id":"a8bff79d694c65834b3a5d2bdba31858b4985236"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"ba4bc481f61959de9170b1d04636a7abb3bd4c42","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            return True"},{"line_number":111,"context_line":"        except exc.HTTPException as he:"},{"line_number":112,"context_line":"            if \u0027unauthorized\u0027 in str(he):"},{"line_number":113,"context_line":"                log.info(\"Invalid token detected. Getting a new token...\")"},{"line_number":114,"context_line":"                # Get a new token"},{"line_number":115,"context_line":"                self.mon_client.replace_token(self.keystone.refresh_token())"},{"line_number":116,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_54d0fcf5","line":113,"updated":"2014-10-03 14:50:58.000000000","message":"Looks like you removed the x try out of y total tries bit in both log messages.","commit_id":"60c9f8f786e2db920e50271221a269e9066c44e1"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"28566c2533183120e15d0e57bc514426ae390ca3","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            return True"},{"line_number":111,"context_line":"        except exc.HTTPException as he:"},{"line_number":112,"context_line":"            if \u0027unauthorized\u0027 in str(he):"},{"line_number":113,"context_line":"                log.info(\"Invalid token detected. Getting a new token...\")"},{"line_number":114,"context_line":"                # Get a new token"},{"line_number":115,"context_line":"                self.mon_client.replace_token(self.keystone.refresh_token())"},{"line_number":116,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"baa201ad_3456185d","line":113,"in_reply_to":"baa201ad_54d0fcf5","updated":"2014-10-03 14:52:46.000000000","message":"Uh nevermind about that, I was briefly mixed up on patch sets, I see the entire retry loop is gone now.","commit_id":"60c9f8f786e2db920e50271221a269e9066c44e1"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"5e1328722a6f40ffbd6f2bd8837718897152edf3","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"            sent \u003d self._send_message(**kwargs)"},{"line_number":61,"context_line":"    "},{"line_number":62,"context_line":"            if sent:"},{"line_number":63,"context_line":"                if len(self.message_queue) \u003e 0:"},{"line_number":64,"context_line":"                    messages_sent \u003d 0"},{"line_number":65,"context_line":"                    for index in range(0, len(self.message_queue)):"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_f6e55409","line":62,"updated":"2014-10-06 14:39:59.000000000","message":"You reverted a change from earlier and now have two nested ifs when one works again.","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"22e7d10f6ed2a30b5df57b496c35c2f85697671c","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"            sent \u003d self._send_message(**kwargs)"},{"line_number":61,"context_line":"    "},{"line_number":62,"context_line":"            if sent:"},{"line_number":63,"context_line":"                if len(self.message_queue) \u003e 0:"},{"line_number":64,"context_line":"                    messages_sent \u003d 0"},{"line_number":65,"context_line":"                    for index in range(0, len(self.message_queue)):"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_d103fa3f","line":62,"in_reply_to":"baa201ad_f6e55409","updated":"2014-10-06 15:19:35.000000000","message":"Yes, the combined if statement did not work.  It was re-queueing the message every time if the queue was empty, even if the message was sent successfully.  The else only applies to the \"if sent\" part.","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"33868d00d7aa58749fe5757c3d4da91ac4b2da38","unresolved":false,"context_lines":[{"line_number":65,"context_line":"                    for index in range(0, len(self.message_queue)):"},{"line_number":66,"context_line":"                        if index \u003c self.backlog_send_rate:"},{"line_number":67,"context_line":"                            msg \u003d self.message_queue.pop()"},{"line_number":68,"context_line":"                            sent \u003d self._send_message(**msg)"},{"line_number":69,"context_line":"                            if not sent:"},{"line_number":70,"context_line":"                                self._queue_message(msg)"},{"line_number":71,"context_line":"                                break"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_c998756c","line":68,"updated":"2014-10-08 15:37:02.000000000","message":"Unfortunately, this call could throw a requests.ConnectionError and in that case it will requeue the original message (which was sent) and not the one that actually failed","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"7ab5799b6c5da96e89509572bef3ebc0512f783b","unresolved":false,"context_lines":[{"line_number":65,"context_line":"                    for index in range(0, len(self.message_queue)):"},{"line_number":66,"context_line":"                        if index \u003c self.backlog_send_rate:"},{"line_number":67,"context_line":"                            msg \u003d self.message_queue.pop()"},{"line_number":68,"context_line":"                            sent \u003d self._send_message(**msg)"},{"line_number":69,"context_line":"                            if not sent:"},{"line_number":70,"context_line":"                                self._queue_message(msg)"},{"line_number":71,"context_line":"                                break"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_489b7572","line":68,"in_reply_to":"baa201ad_c998756c","updated":"2014-10-09 21:49:55.000000000","message":"Done","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"33868d00d7aa58749fe5757c3d4da91ac4b2da38","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            self.mon_client.metrics.create(**kwargs)"},{"line_number":114,"context_line":"            return True"},{"line_number":115,"context_line":"        except exc.HTTPException as he:"},{"line_number":116,"context_line":"            if \u0027unauthorized\u0027 in str(he):"},{"line_number":117,"context_line":"                log.info(\"Invalid token detected. Getting a new token...\")"},{"line_number":118,"context_line":"                # Get a new token"},{"line_number":119,"context_line":"                self.mon_client.replace_token(self.keystone.refresh_token())"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_db74b869","line":116,"updated":"2014-10-08 15:37:02.000000000","message":"I hate checking for strings in error message, but I don\u0027t know how to do it better","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"33868d00d7aa58749fe5757c3d4da91ac4b2da38","unresolved":false,"context_lines":[{"line_number":126,"context_line":"    def _queue_message(self, msg):"},{"line_number":127,"context_line":"        self.message_queue.append(msg)"},{"line_number":128,"context_line":"        queue_size \u003d len(self.message_queue)"},{"line_number":129,"context_line":"        if queue_size is 0 or queue_size % 100 \u003d\u003d 0:"},{"line_number":130,"context_line":"            log.warn(\"API is down or unreachable.  Queuing the messages to send later...\")"},{"line_number":131,"context_line":"            log.info(\"Current agent queue size: {0} of {1}\".format(len(self.message_queue),"},{"line_number":132,"context_line":"                                                                   self.max_buffer_size))"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_3b4f8435","line":129,"updated":"2014-10-08 15:37:02.000000000","message":"queue_size will never be 0 here. A message was just queued. I think you want a 1","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"7ab5799b6c5da96e89509572bef3ebc0512f783b","unresolved":false,"context_lines":[{"line_number":126,"context_line":"    def _queue_message(self, msg):"},{"line_number":127,"context_line":"        self.message_queue.append(msg)"},{"line_number":128,"context_line":"        queue_size \u003d len(self.message_queue)"},{"line_number":129,"context_line":"        if queue_size is 0 or queue_size % 100 \u003d\u003d 0:"},{"line_number":130,"context_line":"            log.warn(\"API is down or unreachable.  Queuing the messages to send later...\")"},{"line_number":131,"context_line":"            log.info(\"Current agent queue size: {0} of {1}\".format(len(self.message_queue),"},{"line_number":132,"context_line":"                                                                   self.max_buffer_size))"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_68875913","line":129,"in_reply_to":"baa201ad_3b4f8435","updated":"2014-10-09 21:49:55.000000000","message":"Done","commit_id":"84b4b08cb960fe33e213e6f20dc479a940bb665a"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"eb8d2ab57784ff314c580f82bbbacb0b83840fce","unresolved":false,"context_lines":[{"line_number":59,"context_line":"                # construct the mon client"},{"line_number":60,"context_line":"                self.mon_client \u003d self.get_client()"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"            sent \u003d self._send_message(**kwargs)"},{"line_number":63,"context_line":"    "},{"line_number":64,"context_line":"            if sent:"},{"line_number":65,"context_line":"                if len(self.message_queue) \u003e 0:"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_0099326e","line":62,"updated":"2014-10-10 14:04:52.000000000","message":"So, _send_message has a try/except block, but that block is only for HTTPException. If that exception occurs, then the method will return FALSE, otherwise TRUE. \n\nWhat about all the other potential exceptions that are possible?\n\nBasically, you have two form of error reporting going on. Exceptions can still be raised out of _send_message, as well as returning TRUE/FALSE in one case.\n\nWouldn\u0027t it be better to just use exceptions or return True/False?","commit_id":"cbe9bc7facfa177745a3737ed25a4802a934a3a7"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"91b6757fe672ae32998066fd7491a9525fc5f711","unresolved":false,"context_lines":[{"line_number":68,"context_line":"                        if index \u003c self.backlog_send_rate:"},{"line_number":69,"context_line":"                            msg \u003d self.message_queue.pop()"},{"line_number":70,"context_line":"                            try:"},{"line_number":71,"context_line":"                                sent \u003d self._send_message(**msg)"},{"line_number":72,"context_line":"                            except requests.ConnectionError as ce:"},{"line_number":73,"context_line":"                                log.debug(\"Error connecting to monasca-api: {0}.\""},{"line_number":74,"context_line":"                                          .format(str(ce.message)))"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_ab43fb6a","line":71,"updated":"2014-10-09 22:58:39.000000000","message":"I think if this throws an exception, sent will still be True since it never gets sent again. Thus, it will just loop through and dump all the queued messages up to backlog_send_rate. But, I\u0027m not sure. Can you try it?","commit_id":"cbe9bc7facfa177745a3737ed25a4802a934a3a7"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"eb8d2ab57784ff314c580f82bbbacb0b83840fce","unresolved":false,"context_lines":[{"line_number":68,"context_line":"                        if index \u003c self.backlog_send_rate:"},{"line_number":69,"context_line":"                            msg \u003d self.message_queue.pop()"},{"line_number":70,"context_line":"                            try:"},{"line_number":71,"context_line":"                                sent \u003d self._send_message(**msg)"},{"line_number":72,"context_line":"                            except requests.ConnectionError as ce:"},{"line_number":73,"context_line":"                                log.debug(\"Error connecting to monasca-api: {0}.\""},{"line_number":74,"context_line":"                                          .format(str(ce.message)))"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_20ec76c7","line":71,"in_reply_to":"baa201ad_ab43fb6a","updated":"2014-10-10 14:04:52.000000000","message":"Yes, I agree, is somethign other than an exc.HTTPException occurs sent will never be updated.\n\nThe except block handles ConnectionError only, and then continues on.","commit_id":"cbe9bc7facfa177745a3737ed25a4802a934a3a7"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"24bf53cabfda3eb17c8c995c58cb814571bc8ad1","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            if \u0027unauthorized\u0027 in str(he):"},{"line_number":115,"context_line":"                log.info(\"Invalid token detected. Getting a new token...\")"},{"line_number":116,"context_line":"                # Get a new token"},{"line_number":117,"context_line":"                self.mon_client.replace_token(self.keystone.refresh_token())"},{"line_number":118,"context_line":"            else:"},{"line_number":119,"context_line":"                log.debug(\"Error sending message to monasca-api. Error is {0}.\""},{"line_number":120,"context_line":"                          .format(str(he.message)))"}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_75e7e5e4","line":117,"updated":"2014-10-13 20:35:51.000000000","message":"The only potential issue I see with this code is that if the token is bad the message will get queued even if a valid token is retrieved in _send_message. To fix that you would need to make _send_message return a tri-state like, SUCCESS, FAILURE, RETRY","commit_id":"95b38bcd398ea32ffa2ddd56e57bf933a41f5dab"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"d89ba252769370b0dd4de2faf93236965bce272c","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            if \u0027unauthorized\u0027 in str(he):"},{"line_number":115,"context_line":"                log.info(\"Invalid token detected. Getting a new token...\")"},{"line_number":116,"context_line":"                # Get a new token"},{"line_number":117,"context_line":"                self.mon_client.replace_token(self.keystone.refresh_token())"},{"line_number":118,"context_line":"            else:"},{"line_number":119,"context_line":"                log.debug(\"Error sending message to monasca-api. Error is {0}.\""},{"line_number":120,"context_line":"                          .format(str(he.message)))"}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_d00dff36","line":117,"in_reply_to":"baa201ad_75e7e5e4","updated":"2014-10-13 20:50:23.000000000","message":"Yes, this is by design.  If the token has expired, we want the message to be queued and picked up when the next metric is processed.  This saves having to do a bunch of unnecessary retry logic. It also uses the queue for the purpose it was designed for, that is queuing and re-sending messages when the agent can\u0027t send metrics to the API for whatever reason.","commit_id":"95b38bcd398ea32ffa2ddd56e57bf933a41f5dab"}]}
