)]}'
{"ceilometer/dispatcher/database.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"7256aec1049418d8541a057ecba81dc79db97424","unresolved":false,"context_lines":[{"line_number":51,"context_line":"        connection_scheme \u003d urlparse.urlparse(metering_conn_url).scheme"},{"line_number":52,"context_line":"        # NOTE(liusheng): currently, only mongodb backend support batch"},{"line_number":53,"context_line":"        # recording."},{"line_number":54,"context_line":"        if connection_scheme \u003d\u003d \u0027mongodb\u0027:"},{"line_number":55,"context_line":"            self.meter_batch_recording \u003d True"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def _get_db_conn(self, purpose, ignore_exception\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7aa08908_e5e366a2","line":54,"updated":"2016-06-08 09:36:52.000000000","message":"This is… hackish.\n\nLet each driver declare itself as being able to handle batch recording with e.g. a class attribute.","commit_id":"7199185c2a6eeae682de140905938469c193214b"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"cd2ac59927dc1b08c98d6a261abbbe2616afad1d","unresolved":false,"context_lines":[{"line_number":51,"context_line":"        connection_scheme \u003d urlparse.urlparse(metering_conn_url).scheme"},{"line_number":52,"context_line":"        # NOTE(liusheng): currently, only mongodb backend support batch"},{"line_number":53,"context_line":"        # recording."},{"line_number":54,"context_line":"        if connection_scheme \u003d\u003d \u0027mongodb\u0027:"},{"line_number":55,"context_line":"            self.meter_batch_recording \u003d True"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def _get_db_conn(self, purpose, ignore_exception\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7aa08908_ba7b3cbd","line":54,"in_reply_to":"7aa08908_e5e366a2","updated":"2016-06-14 07:04:41.000000000","message":"thanks, looks like I am stupid :P","commit_id":"7199185c2a6eeae682de140905938469c193214b"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"7256aec1049418d8541a057ecba81dc79db97424","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            if meter.get(\u0027timestamp\u0027):"},{"line_number":98,"context_line":"                ts \u003d timeutils.parse_isotime(meter[\u0027timestamp\u0027])"},{"line_number":99,"context_line":"                meter[\u0027timestamp\u0027] \u003d timeutils.normalize_time(ts)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"            if not self.meter_batch_recording:"},{"line_number":102,"context_line":"                try:"},{"line_number":103,"context_line":"                    self.meter_conn.record_metering_data(meter)"},{"line_number":104,"context_line":"                except Exception as err:"},{"line_number":105,"context_line":"                    LOG.error(_LE(\u0027Failed to record metering data: %s.\u0027), err)"},{"line_number":106,"context_line":"                    # raise the exception to propagate it up in the chain."},{"line_number":107,"context_line":"                    raise"},{"line_number":108,"context_line":"        if self.meter_batch_recording:"},{"line_number":109,"context_line":"            try:"},{"line_number":110,"context_line":"                self.meter_conn.record_metering_data(data)"},{"line_number":111,"context_line":"            except Exception as err:"},{"line_number":112,"context_line":"                LOG.error(_LE(\u0027Failed to record %(len)s: %(err)s.\u0027),"},{"line_number":113,"context_line":"                          {\u0027len\u0027: len(data), \u0027err\u0027: err})"},{"line_number":114,"context_line":"                raise"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def record_events(self, events):"},{"line_number":117,"context_line":"        if not isinstance(events, list):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7aa08908_c57c6ab7","line":114,"range":{"start_line":100,"start_character":0,"end_line":114,"end_character":21},"updated":"2016-06-08 09:36:52.000000000","message":"No need for all of that. Just call record_metering_data_batch(data) and define:\n\ndef record_metering_data_batch(meters):\n    for m in meter:\n        self.record_metering_data(m)\n\n\nYou can then override this methods in the MongoDB driver.","commit_id":"7199185c2a6eeae682de140905938469c193214b"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"cd2ac59927dc1b08c98d6a261abbbe2616afad1d","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            if meter.get(\u0027timestamp\u0027):"},{"line_number":98,"context_line":"                ts \u003d timeutils.parse_isotime(meter[\u0027timestamp\u0027])"},{"line_number":99,"context_line":"                meter[\u0027timestamp\u0027] \u003d timeutils.normalize_time(ts)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"            if not self.meter_batch_recording:"},{"line_number":102,"context_line":"                try:"},{"line_number":103,"context_line":"                    self.meter_conn.record_metering_data(meter)"},{"line_number":104,"context_line":"                except Exception as err:"},{"line_number":105,"context_line":"                    LOG.error(_LE(\u0027Failed to record metering data: %s.\u0027), err)"},{"line_number":106,"context_line":"                    # raise the exception to propagate it up in the chain."},{"line_number":107,"context_line":"                    raise"},{"line_number":108,"context_line":"        if self.meter_batch_recording:"},{"line_number":109,"context_line":"            try:"},{"line_number":110,"context_line":"                self.meter_conn.record_metering_data(data)"},{"line_number":111,"context_line":"            except Exception as err:"},{"line_number":112,"context_line":"                LOG.error(_LE(\u0027Failed to record %(len)s: %(err)s.\u0027),"},{"line_number":113,"context_line":"                          {\u0027len\u0027: len(data), \u0027err\u0027: err})"},{"line_number":114,"context_line":"                raise"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def record_events(self, events):"},{"line_number":117,"context_line":"        if not isinstance(events, list):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7aa08908_5694ac35","line":114,"range":{"start_line":100,"start_character":0,"end_line":114,"end_character":21},"in_reply_to":"7aa08908_c57c6ab7","updated":"2016-06-14 07:04:41.000000000","message":"Hmm, thanks for your comments, I didn\u0027t completely get your idea. but here I want to keep the debug log statement of every sample for both batch and single recording.","commit_id":"7199185c2a6eeae682de140905938469c193214b"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"96be5c4599c8c1e037116f4a0fa3eb1a2d5c9338","unresolved":false,"context_lines":[{"line_number":98,"context_line":"                    LOG.error(_LE(\u0027Failed to record metering data: %s.\u0027), err)"},{"line_number":99,"context_line":"                    # raise the exception to propagate it up in the chain."},{"line_number":100,"context_line":"                    raise"},{"line_number":101,"context_line":"        if self.meter_batch_recording:"},{"line_number":102,"context_line":"            try:"},{"line_number":103,"context_line":"                self.meter_conn.record_metering_data(data)"},{"line_number":104,"context_line":"            except Exception as err:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3aaa91ec_6ff53082","line":101,"range":{"start_line":101,"start_character":37,"end_line":101,"end_character":38},"updated":"2016-06-22 03:10:18.000000000","message":"what\u0027s jd\u0027s point is that let\u0027s define the following in the ceilometer.storage.base:\n\n\ndef record_metering_data_batch(meters):\n    for m in meter:\n        self.record_metering_data(m)\n\nAnd re-implement this in mongoDB driver. In that case, we can call record_metering_data_batch() here in a uniform way. No need to do a \"if not self.meter_batch_recording:\" checking.\n\n\nI kind of support jd\u0027s idea.","commit_id":"02919ff6016b0c337d25fc489ac8dd5a7046480c"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"609402b1feb42d19d159f619ba6488ba9a565ddb","unresolved":false,"context_lines":[{"line_number":98,"context_line":"                    LOG.error(_LE(\u0027Failed to record metering data: %s.\u0027), err)"},{"line_number":99,"context_line":"                    # raise the exception to propagate it up in the chain."},{"line_number":100,"context_line":"                    raise"},{"line_number":101,"context_line":"        if self.meter_batch_recording:"},{"line_number":102,"context_line":"            try:"},{"line_number":103,"context_line":"                self.meter_conn.record_metering_data(data)"},{"line_number":104,"context_line":"            except Exception as err:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3aaa91ec_c65ebf44","line":101,"range":{"start_line":101,"start_character":37,"end_line":101,"end_character":38},"in_reply_to":"3aaa91ec_6ff53082","updated":"2016-06-22 09:48:42.000000000","message":"got it, thanks for explanation, will do it.","commit_id":"02919ff6016b0c337d25fc489ac8dd5a7046480c"}],"ceilometer/storage/base.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"e429ed73a0fb5816097ff79d00cabcb7d12f560c","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    STORAGE_CAPABILITIES \u003d {"},{"line_number":130,"context_line":"        \u0027storage\u0027: {\u0027production_ready\u0027: False},"},{"line_number":131,"context_line":"    }"},{"line_number":132,"context_line":"    SUPPORT_BATCH_RECORDING \u003d False"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    def __init__(self, url):"},{"line_number":135,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":7,"id":"3aaa91ec_e27c8474","line":132,"updated":"2016-06-22 10:22:58.000000000","message":"not needed","commit_id":"1ba889c19b33708595fff4ac6a766699f1a49888"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"c8459ecad4e729ba566ef88166d41850c4949aa9","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    STORAGE_CAPABILITIES \u003d {"},{"line_number":130,"context_line":"        \u0027storage\u0027: {\u0027production_ready\u0027: False},"},{"line_number":131,"context_line":"    }"},{"line_number":132,"context_line":"    SUPPORT_BATCH_RECORDING \u003d False"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    def __init__(self, url):"},{"line_number":135,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":7,"id":"3aaa91ec_ceffe632","line":132,"in_reply_to":"3aaa91ec_e27c8474","updated":"2016-06-22 14:30:15.000000000","message":"Done","commit_id":"1ba889c19b33708595fff4ac6a766699f1a49888"}],"ceilometer/storage/impl_mongodb.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"e429ed73a0fb5816097ff79d00cabcb7d12f560c","unresolved":false,"context_lines":[{"line_number":252,"context_line":"        # call conn.record_metering_data. May all the Ceilometer"},{"line_number":253,"context_line":"        # native storage backends can support batch recording in future, and"},{"line_number":254,"context_line":"        # then we need to refactor the scenario tests."},{"line_number":255,"context_line":"        if isinstance(data, dict):"},{"line_number":256,"context_line":"            data \u003d [data]"},{"line_number":257,"context_line":"        self.record_metering_data_batch(data)"},{"line_number":258,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3aaa91ec_823ca094","line":255,"range":{"start_line":255,"start_character":7,"end_line":255,"end_character":34},"updated":"2016-06-22 10:22:58.000000000","message":"this should not exist. Data is *always* a dict, or it\u0027s a bug.","commit_id":"1ba889c19b33708595fff4ac6a766699f1a49888"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"c8459ecad4e729ba566ef88166d41850c4949aa9","unresolved":false,"context_lines":[{"line_number":252,"context_line":"        # call conn.record_metering_data. May all the Ceilometer"},{"line_number":253,"context_line":"        # native storage backends can support batch recording in future, and"},{"line_number":254,"context_line":"        # then we need to refactor the scenario tests."},{"line_number":255,"context_line":"        if isinstance(data, dict):"},{"line_number":256,"context_line":"            data \u003d [data]"},{"line_number":257,"context_line":"        self.record_metering_data_batch(data)"},{"line_number":258,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3aaa91ec_4e9ad615","line":255,"range":{"start_line":255,"start_character":7,"end_line":255,"end_character":34},"in_reply_to":"3aaa91ec_823ca094","updated":"2016-06-22 14:30:15.000000000","message":"Done","commit_id":"1ba889c19b33708595fff4ac6a766699f1a49888"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"fabcfd04cf399a44706dff4e267009ab119dd4fe","unresolved":false,"context_lines":[{"line_number":246,"context_line":"        self.conn.close()"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"    def record_metering_data(self, data):"},{"line_number":249,"context_line":"        # TODO(liusheng): this is a workaround that is because there are"},{"line_number":250,"context_line":"        # storage scenario tests which directly invoke this method and pass a"},{"line_number":251,"context_line":"        # sample dict with all the storage backends and"},{"line_number":252,"context_line":"        # call conn.record_metering_data. May all the Ceilometer"}],"source_content_type":"text/x-python","patch_set":8,"id":"3aaa91ec_447d8b6d","line":249,"updated":"2016-06-22 17:32:03.000000000","message":"This is not entirely a workaround as you have to implement this method according to the base driver anyway…","commit_id":"898bef519d3e09957d00a7a8045bb3c221516f44"},{"author":{"_account_id":8290,"name":"liusheng","email":"liusheng2048@gmail.com","username":"LiuSheng"},"change_message_id":"efc680a44c6f67bef54bff6cecc896a9ff02943b","unresolved":false,"context_lines":[{"line_number":246,"context_line":"        self.conn.close()"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"    def record_metering_data(self, data):"},{"line_number":249,"context_line":"        # TODO(liusheng): this is a workaround that is because there are"},{"line_number":250,"context_line":"        # storage scenario tests which directly invoke this method and pass a"},{"line_number":251,"context_line":"        # sample dict with all the storage backends and"},{"line_number":252,"context_line":"        # call conn.record_metering_data. May all the Ceilometer"}],"source_content_type":"text/x-python","patch_set":8,"id":"3aaa91ec_9682f792","line":249,"in_reply_to":"3aaa91ec_447d8b6d","updated":"2016-06-23 01:03:43.000000000","message":"yes, I am not sure the others backends can support batch recording now, I will refactor the tests in another patch after the backends implementation being done. thanks for your review :)","commit_id":"898bef519d3e09957d00a7a8045bb3c221516f44"}]}
