)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"05914e0134d2041f2f44717651622e69cf9c4cd6","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Catch permissions errors when writing StatsD packets"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Fixes Bug: #1183152"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Change-Id: I4b2c6e947241c987779a385fdff270d037470a57"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"baada198_d378552e","line":9,"updated":"2014-08-11 09:01:15.000000000","message":"s/Fixes/Closes/\n\nto my surpirse, \u0027Fixes\u0027 doesn\u0027t seem to generate the autolink to the bug report","commit_id":"7d479ee40d40e7791b2bca310363c195aab5888d"}],"swift/common/utils.py":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"44b2a4d7b05256fdb8267c77e0a57d2182ea3fec","unresolved":false,"context_lines":[{"line_number":971,"context_line":"            except IOError, err:"},{"line_number":972,"context_line":"                _junk, exc, _junk \u003d sys.exc_info()"},{"line_number":973,"context_line":"                if exc.errno \u003d\u003d errno.EPERM:"},{"line_number":974,"context_line":"                    pass  # how do we log this?"},{"line_number":975,"context_line":"                else:"},{"line_number":976,"context_line":"                    raise"},{"line_number":977,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_bd101259","line":974,"updated":"2014-08-11 08:11:16.000000000","message":"Looking at the code, the statsd client is attached to the logger, so why not pass in the logger object to the constructor (in get_logger method). So we can jump back and use the logger. \n\nI.e: on Line 1430:\n\n  statsd_client \u003d StatsdClient(statsd_host, statsd_port, base_prefix,\n                                              name, default_sample_rate,\n                                              sample_rate_factor, self)\n\nThen in StatsdClient:\n\n class StatsdClient(object):                                                      \n     def __init__(self, host, port, base_prefix\u003d\u0027\u0027, tail_prefix\u003d\u0027\u0027,               \n                  default_sample_rate\u003d1, sample_rate_factor\u003d1, logger\u003dNone):                   \n         self._host \u003d host                                                        \n         ...\n         self.logger \u003d logger\n\nThen we should be able to log:\n\n  self.logger.warn(\"Operation not permitted.\")","commit_id":"7d479ee40d40e7791b2bca310363c195aab5888d"},{"author":{"_account_id":2696,"name":"Darrell Bishop","email":"dbishop@nvidia.com","username":"darrellb"},"change_message_id":"879fd3fb5f6580e4f6558bfadb7157694f2b48d0","unresolved":false,"context_lines":[{"line_number":969,"context_line":"            try:"},{"line_number":970,"context_line":"                return sock.sendto(\u0027|\u0027.join(parts), self._target)"},{"line_number":971,"context_line":"            except IOError as err:"},{"line_number":972,"context_line":"                _junk, exc, _junk \u003d sys.exc_info()"},{"line_number":973,"context_line":"                if exc.errno \u003d\u003d errno.EPERM:"},{"line_number":974,"context_line":"                    print(\u0027Error sending UDP packet to %r\u0027 % (self._target, ),"},{"line_number":975,"context_line":"                          sys.stderr)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_a6d62f51","line":972,"updated":"2014-08-11 16:22:56.000000000","message":"Unless there\u0027s a relevant difference, can you just use err.errno?","commit_id":"c38a11c60eab2373e80fc77e57641faedfc454af"},{"author":{"_account_id":2696,"name":"Darrell Bishop","email":"dbishop@nvidia.com","username":"darrellb"},"change_message_id":"879fd3fb5f6580e4f6558bfadb7157694f2b48d0","unresolved":false,"context_lines":[{"line_number":970,"context_line":"                return sock.sendto(\u0027|\u0027.join(parts), self._target)"},{"line_number":971,"context_line":"            except IOError as err:"},{"line_number":972,"context_line":"                _junk, exc, _junk \u003d sys.exc_info()"},{"line_number":973,"context_line":"                if exc.errno \u003d\u003d errno.EPERM:"},{"line_number":974,"context_line":"                    print(\u0027Error sending UDP packet to %r\u0027 % (self._target, ),"},{"line_number":975,"context_line":"                          sys.stderr)"},{"line_number":976,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_a661cfd5","line":973,"updated":"2014-08-11 16:22:56.000000000","message":"Given the severity of allowing an exception to bubble up here, let\u0027s trap-and-log all IOErrors.","commit_id":"c38a11c60eab2373e80fc77e57641faedfc454af"},{"author":{"_account_id":2696,"name":"Darrell Bishop","email":"dbishop@nvidia.com","username":"darrellb"},"change_message_id":"879fd3fb5f6580e4f6558bfadb7157694f2b48d0","unresolved":false,"context_lines":[{"line_number":971,"context_line":"            except IOError as err:"},{"line_number":972,"context_line":"                _junk, exc, _junk \u003d sys.exc_info()"},{"line_number":973,"context_line":"                if exc.errno \u003d\u003d errno.EPERM:"},{"line_number":974,"context_line":"                    print(\u0027Error sending UDP packet to %r\u0027 % (self._target, ),"},{"line_number":975,"context_line":"                          sys.stderr)"},{"line_number":976,"context_line":"                else:"},{"line_number":977,"context_line":"                    raise"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_86c20b84","line":974,"updated":"2014-08-11 16:22:56.000000000","message":"Once you log any IOError, it\u0027d be good to get some part of the exception in the log message... like the str() or repr() of the exception instance?","commit_id":"c38a11c60eab2373e80fc77e57641faedfc454af"}],"test/unit/common/test_utils.py":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"44b2a4d7b05256fdb8267c77e0a57d2182ea3fec","unresolved":false,"context_lines":[{"line_number":3047,"context_line":"        mock_socket \u003d MockUdpSocket(sendto_errno\u003derrno.EPERM)"},{"line_number":3048,"context_line":"        statsd_client._open_socket \u003d lambda *_: mock_socket"},{"line_number":3049,"context_line":"        logger.increment(\u0027tunafish\u0027)"},{"line_number":3050,"context_line":"        # if we got to this point, no error was thrown"},{"line_number":3051,"context_line":""},{"line_number":3052,"context_line":"    def test_sample_rates(self):"},{"line_number":3053,"context_line":"        logger \u003d utils.get_logger({\u0027log_statsd_host\u0027: \u0027some.host.com\u0027})"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_e06e6196","line":3050,"updated":"2014-08-11 08:11:16.000000000","message":"There should also be a test for when an exception is raised. Seeing as you have specifically added this functionality to the code.","commit_id":"7d479ee40d40e7791b2bca310363c195aab5888d"},{"author":{"_account_id":2696,"name":"Darrell Bishop","email":"dbishop@nvidia.com","username":"darrellb"},"change_message_id":"879fd3fb5f6580e4f6558bfadb7157694f2b48d0","unresolved":false,"context_lines":[{"line_number":3046,"context_line":"        statsd_client \u003d logger.logger.statsd_client"},{"line_number":3047,"context_line":"        mock_socket \u003d MockUdpSocket(sendto_errno\u003derrno.EPERM)"},{"line_number":3048,"context_line":"        statsd_client._open_socket \u003d lambda *_: mock_socket"},{"line_number":3049,"context_line":"        logger.increment(\u0027tunafish\u0027)"},{"line_number":3050,"context_line":"        # if we got to this point, no error was thrown"},{"line_number":3051,"context_line":""},{"line_number":3052,"context_line":"    def test_sample_rates(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_c6fde3b3","line":3049,"updated":"2014-08-11 16:22:56.000000000","message":"It\u0027d be good to trap STDERR or wherever the log message went, just to prove we didn\u0027t silently eat the error (that\u0027d be bad).","commit_id":"c38a11c60eab2373e80fc77e57641faedfc454af"}]}
