)]}'
{"monasca_notification/processors/alarm_processor.py":[{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"686c99745cde8923d3900da29f93d824999e6a30","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"log \u003d logging.getLogger(__name__)"},{"line_number":29,"context_line":"mstatsd \u003d monasca_statsd.MonascaStatsd()"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"class AlarmProcessor(BaseProcessor):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8c0949_91a2fe98","line":29,"updated":"2014-10-29 23:06:24.000000000","message":"Is there a reason this is globally defined?","commit_id":"2eafa0e7e6ef821442e8bb6d84b1bdff1678624b"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"686c99745cde8923d3900da29f93d824999e6a30","unresolved":false,"context_lines":[{"line_number":91,"context_line":"        \"\"\""},{"line_number":92,"context_line":"        cur \u003d self.mysql.cursor()"},{"line_number":93,"context_line":"        pname \u003d multiprocessing.current_process().name"},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"        while True:"},{"line_number":96,"context_line":"            raw_alarm \u003d self.alarm_queue.get()"},{"line_number":97,"context_line":"            partition \u003d raw_alarm[0]"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8c0949_b1f45a88","line":94,"updated":"2014-10-29 23:06:24.000000000","message":"Is it not possible to define the counters as I did before? For the counters that are resused it is nice to define it only once, also it looks a bit cleaner.","commit_id":"2eafa0e7e6ef821442e8bb6d84b1bdff1678624b"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"686c99745cde8923d3900da29f93d824999e6a30","unresolved":false,"context_lines":[{"line_number":115,"context_line":"                continue"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"            try:"},{"line_number":118,"context_line":"                @mstatsd.timed(\u0027monasca.config_db_time_%s\u0027 % pname,"},{"line_number":119,"context_line":"                               dimensions\u003dBaseProcessor.dimensions)"},{"line_number":120,"context_line":"                def time_db():"},{"line_number":121,"context_line":"                    cur.execute(\"\"\"SELECT name, type, address"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8c0949_f1eee2b3","line":118,"updated":"2014-10-29 23:06:24.000000000","message":"Does monasca-statsd not support with? I think it makes a cleaner usage.","commit_id":"2eafa0e7e6ef821442e8bb6d84b1bdff1678624b"}],"monasca_notification/processors/notification_processor.py":[{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"ad4e2dcfe008c38c9591d23bbf36980fa3d72a7d","unresolved":false,"context_lines":[{"line_number":112,"context_line":"                        sent.notification_timestamp \u003d time.time()"},{"line_number":113,"context_line":"                        sent_notifications.append(sent)"},{"line_number":114,"context_line":"                        counter \u003d self.monascastatsd.get_counter(name\u003dcounters[notification.type])"},{"line_number":115,"context_line":"                        counter +\u003d 1"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"            if len(sent_notifications) \u003d\u003d 0:  # All notifications failed"},{"line_number":118,"context_line":"                self._add_to_queue("}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_16565e2a","line":115,"updated":"2014-11-14 17:22:28.000000000","message":"Do we have to get this counter each time you increment it? Why not get it outside the while?","commit_id":"4e032b44db271d62e40d60124ee5fa61c01a2b12"},{"author":{"_account_id":12108,"name":"Gary Hessler","email":"gary.hessler@hp.com","username":"garyh"},"change_message_id":"e35cee905856dbc66d1541bc2478fb96c563e9a1","unresolved":false,"context_lines":[{"line_number":112,"context_line":"                        sent.notification_timestamp \u003d time.time()"},{"line_number":113,"context_line":"                        sent_notifications.append(sent)"},{"line_number":114,"context_line":"                        counter \u003d self.monascastatsd.get_counter(name\u003dcounters[notification.type])"},{"line_number":115,"context_line":"                        counter +\u003d 1"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"            if len(sent_notifications) \u003d\u003d 0:  # All notifications failed"},{"line_number":118,"context_line":"                self._add_to_queue("}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_bf4875cd","line":115,"in_reply_to":"5a890539_16565e2a","updated":"2014-11-19 19:11:50.000000000","message":"A name must be provided for the counter when it is created.  This is because in order to use the \u0027counter +\u003d 1\u0027 semantics, the name must be provided on instantiation of the counter.  Since the name of the counter is based on the loop variable, it can\u0027t be created outside of the loop.  This is not the case for the timer however.  I will move that outside the loop.","commit_id":"4e032b44db271d62e40d60124ee5fa61c01a2b12"},{"author":{"_account_id":11094,"name":"Tim Kuhlman","email":"timothy.kuhlman@canonical.com","username":"kuhlmant"},"change_message_id":"373d7ab83a1d4263953d762ccf49ff80d4d8dd39","unresolved":false,"context_lines":[{"line_number":112,"context_line":"                        sent.notification_timestamp \u003d time.time()"},{"line_number":113,"context_line":"                        sent_notifications.append(sent)"},{"line_number":114,"context_line":"                        counter \u003d self.monascastatsd.get_counter(name\u003dcounters[notification.type])"},{"line_number":115,"context_line":"                        counter +\u003d 1"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"            if len(sent_notifications) \u003d\u003d 0:  # All notifications failed"},{"line_number":118,"context_line":"                self._add_to_queue("}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_2530f455","line":115,"in_reply_to":"5a890539_bf4875cd","updated":"2014-11-19 20:02:15.000000000","message":"What you said makes sense but there is only a small number of notification types but a huge number of notifications and you are running through initialization each time. Better would be a dictionary of counters with the type as key which is made once then here it would just be counters[notification.type] +\u003d 1","commit_id":"4e032b44db271d62e40d60124ee5fa61c01a2b12"}]}
