)]}'
{"gnocchi/storage/opentsdb.py":[{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"c584d928678b1e0a3609f9c8d1448ff946999d34","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                                      \u0027 Please install it and try again.\u0027)"},{"line_number":78,"context_line":"        self.client \u003d opentsdb_cl.Client(conf.storage.opentsdb_host,"},{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_2a199779","line":80,"updated":"2014-10-21 14:04:25.000000000","message":"Dina, I tried to use this _to_epoch method to write data to openTSDB but it wasn\u0027t successful. The following code is very ugly but it works:\n\n    def _to_epoch(self, dt):\n        try:\n            date \u003d datetime.strptime(dt[0:-1], \u0027%Y-%m-%dT%H:%M:%S\u0027)\n        except Exception:\n            date \u003d datetime.strptime(dt, \u0027%Y-%m-%d %H:%M:%S.%f\u0027)\n        epoch \u003d datetime(1970, 1, 1)\n        td \u003d date - epoch\n        ts \u003d td.seconds * 1000 + td.days * 86400000\n        return ts\n\nI\u0027ve used this code in publisher. As it turned out there are two datetime formats which are used in notifications. Maybe it\u0027s not used here. jfyi","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"bb5a9a05a4b7776fdbdbecdcb458c898cb8363e3","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                                      \u0027 Please install it and try again.\u0027)"},{"line_number":78,"context_line":"        self.client \u003d opentsdb_cl.Client(conf.storage.opentsdb_host,"},{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_6556322c","line":80,"in_reply_to":"9aa7fdbe_2a199779","updated":"2014-10-23 10:15:20.000000000","message":"hm, Nadya, really interesting... What were the problems you met?","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"a54fd2d604da847afdefd9748102dca987624f3e","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                                      \u0027 Please install it and try again.\u0027)"},{"line_number":78,"context_line":"        self.client \u003d opentsdb_cl.Client(conf.storage.opentsdb_host,"},{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_b34f806a","line":80,"in_reply_to":"9aa7fdbe_6556322c","updated":"2014-10-23 11:05:33.000000000","message":"Dina, I\u0027ve rechecked this. My problem was that \u0027dt\u0027 is actually a string and not datetime object.  If it\u0027s not your case everything is fine.","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"b1c9fd775ee28e225fd96d5a1af81b7838fb4775","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                                      \u0027 Please install it and try again.\u0027)"},{"line_number":78,"context_line":"        self.client \u003d opentsdb_cl.Client(conf.storage.opentsdb_host,"},{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_6e744f36","line":80,"in_reply_to":"9aa7fdbe_b34f806a","updated":"2014-10-27 15:10:36.000000000","message":"ok, cool","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3e157634ba0a150e586cb2d7f4b7e78ee0fa8ae8","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        self.client \u003d opentsdb_cl.Client(conf.storage.opentsdb_host,"},{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def create_entity(self, entity, archives):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_4390af95","line":81,"updated":"2014-10-20 14:08:00.000000000","message":"@staticmethod","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"bb5a9a05a4b7776fdbdbecdcb458c898cb8363e3","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        self.client \u003d opentsdb_cl.Client(conf.storage.opentsdb_host,"},{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def create_entity(self, entity, archives):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_455dae46","line":81,"in_reply_to":"9aa7fdbe_4390af95","updated":"2014-10-23 10:15:20.000000000","message":"ok, will do","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3e157634ba0a150e586cb2d7f4b7e78ee0fa8ae8","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def create_entity(self, entity, archives):"},{"line_number":85,"context_line":"        \"\"\"Create an entity."}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_c3f3bf08","line":82,"updated":"2014-10-20 14:08:00.000000000","message":"I am pretty sure this is not the right way to do this :) There\u0027s a proper method to convert a datetime to epoch.","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"7230a5286a3f337222dd371aafa1a50343c53fe8","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def create_entity(self, entity, archives):"},{"line_number":85,"context_line":"        \"\"\"Create an entity."}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_be2d8000","line":82,"in_reply_to":"9aa7fdbe_2560aa00","updated":"2014-10-23 14:53:23.000000000","message":"I think the one using the time module is clearner as it does not refer to any \"date\" directly.","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"b1c9fd775ee28e225fd96d5a1af81b7838fb4775","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def create_entity(self, entity, archives):"},{"line_number":85,"context_line":"        \"\"\"Create an entity."}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_8943e3ad","line":82,"in_reply_to":"9aa7fdbe_be2d8000","updated":"2014-10-27 15:10:36.000000000","message":"a-ha, will try to use :) thanks!","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"7ddc3f5fca77601b0086500ae931df2736d88499","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def create_entity(self, entity, archives):"},{"line_number":85,"context_line":"        \"\"\"Create an entity."}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_e94bfd84","line":82,"in_reply_to":"9aa7fdbe_c3f3bf08","updated":"2014-10-22 11:38:16.000000000","message":"Weirdly it seems to be the stackoverflow approved way: http://stackoverflow.com/a/11743262\n\n(not that SO is an authority)\n\nThere are some other solutions, some which preserve microseconds, on the same page.","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"bb5a9a05a4b7776fdbdbecdcb458c898cb8363e3","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                                         conf.storage.opentsdb_port)"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    def _to_epoch(self, dt):"},{"line_number":82,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def create_entity(self, entity, archives):"},{"line_number":85,"context_line":"        \"\"\"Create an entity."}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_2560aa00","line":82,"in_reply_to":"9aa7fdbe_e94bfd84","updated":"2014-10-23 10:15:20.000000000","message":"Julien, actually if you\u0027ll propose the better variant I\u0027ll be simply happy :)","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":7729,"name":"Ilya Tyaptin","email":"ityaptin@mirantis.com","username":"ityaptin"},"change_message_id":"87e39dd42ac31061bbb0efb6a1342cf550c45601","unresolved":false,"context_lines":[{"line_number":102,"context_line":"                         \u0027value\u0027: 0,"},{"line_number":103,"context_line":"                         \u0027tags\u0027: {\u0027entity\u0027: entity,"},{"line_number":104,"context_line":"                                  \u0027granularity_retention\u0027: \u0027%s_%s\u0027 % ("},{"line_number":105,"context_line":"                                      archive[0], archive[1])}})"},{"line_number":106,"context_line":"        self.client.put_meter(data)"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    def _get_archives(self, entity):"}],"source_content_type":"text/x-python","patch_set":6,"id":"7a8c0949_b23191a4","line":105,"updated":"2014-10-31 14:08:02.000000000","message":"archive is dict now and we need to use arhive[\u0027granularity\u0027], archive[\u0027points\u0027] instead int indexes.","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3e157634ba0a150e586cb2d7f4b7e78ee0fa8ae8","unresolved":false,"context_lines":[{"line_number":124,"context_line":"    def delete_entity(self, entity):"},{"line_number":125,"context_line":"        \"\"\"Delete an entity."},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        Does not work for the OpenTSDB - we may implement table"},{"line_number":128,"context_line":"        dropping directly for the underlaying HBase, but that\u0027s discussible."},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"        :param entity: The entity key."}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_8337f7af","line":127,"updated":"2014-10-20 14:08:00.000000000","message":"Then raise NotImplemented","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"bb5a9a05a4b7776fdbdbecdcb458c898cb8363e3","unresolved":false,"context_lines":[{"line_number":124,"context_line":"    def delete_entity(self, entity):"},{"line_number":125,"context_line":"        \"\"\"Delete an entity."},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        Does not work for the OpenTSDB - we may implement table"},{"line_number":128,"context_line":"        dropping directly for the underlaying HBase, but that\u0027s discussible."},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"        :param entity: The entity key."}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_c538bef1","line":127,"in_reply_to":"9aa7fdbe_8337f7af","updated":"2014-10-23 10:15:20.000000000","message":"ok, will do","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"c584d928678b1e0a3609f9c8d1448ff946999d34","unresolved":false,"context_lines":[{"line_number":137,"context_line":"        :param entity: The entity measured."},{"line_number":138,"context_line":"        :param measures: The actual measures."},{"line_number":139,"context_line":"        \"\"\""},{"line_number":140,"context_line":"        data \u003d []"},{"line_number":141,"context_line":"        for measure in measures:"},{"line_number":142,"context_line":"            data.append({\u0027metric\u0027: entity,"},{"line_number":143,"context_line":"                         \u0027timestamp\u0027: self._to_epoch(measure.timestamp),"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_0a5693d2","line":140,"updated":"2014-10-21 14:04:25.000000000","message":"We are not interested in project_id or counter_unit because of gnocchi \u0027db-schema\u0027? \njfyi, I did the following:\n\n    def opentsdb_message_from_counter(self, sample):\n        data \u003d []\n        msg \u003d {\n            \u0027metric\u0027: sample.name,\n            \u0027value\u0027: sample.volume,\n            \u0027timestamp\u0027: self._to_epoch(sample.timestamp),\n            \u0027tags\u0027 : {\u0027counter_type\u0027: sample.type,\n                    \u0027counter_unit\u0027: sample.unit,\n                    \u0027user_id\u0027: sample.user_id,\n                    \u0027project_id\u0027: sample.project_id,\n                    \u0027resource_id\u0027: sample.resource_id,\n                    },\n            }\n        data.append(msg)\n        return data","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"bb5a9a05a4b7776fdbdbecdcb458c898cb8363e3","unresolved":false,"context_lines":[{"line_number":137,"context_line":"        :param entity: The entity measured."},{"line_number":138,"context_line":"        :param measures: The actual measures."},{"line_number":139,"context_line":"        \"\"\""},{"line_number":140,"context_line":"        data \u003d []"},{"line_number":141,"context_line":"        for measure in measures:"},{"line_number":142,"context_line":"            data.append({\u0027metric\u0027: entity,"},{"line_number":143,"context_line":"                         \u0027timestamp\u0027: self._to_epoch(measure.timestamp),"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_250eea3b","line":140,"in_reply_to":"9aa7fdbe_0a5693d2","updated":"2014-10-23 10:15:20.000000000","message":"but that seems to be the variant only for one sample, here we can receive a batch of it. As for the project_id, units and etc. - it seems to be built into the \u0027entity\u0027 term, not measure one. Measure \u003d\u003d timestamp + value + entity and that\u0027s it, actually","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3e157634ba0a150e586cb2d7f4b7e78ee0fa8ae8","unresolved":false,"context_lines":[{"line_number":142,"context_line":"            data.append({\u0027metric\u0027: entity,"},{"line_number":143,"context_line":"                         \u0027timestamp\u0027: self._to_epoch(measure.timestamp),"},{"line_number":144,"context_line":"                         \u0027value\u0027: measure.value,"},{"line_number":145,"context_line":"                         \u0027tags\u0027: {\u0027resource\u0027: \u0027resource_id\u0027}})"},{"line_number":146,"context_line":"        self.client.put_meter(data)"},{"line_number":147,"context_line":""},{"line_number":148,"context_line":"    def get_measures(self, entity, from_timestamp\u003dNone, to_timestamp\u003dNone,"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_0372277c","line":145,"updated":"2014-10-20 14:08:00.000000000","message":"Nitpick: you could use a list comprehension:\n\ndata \u003d [{\u0027metric\u0027: …} for measure in measures]","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"bb5a9a05a4b7776fdbdbecdcb458c898cb8363e3","unresolved":false,"context_lines":[{"line_number":142,"context_line":"            data.append({\u0027metric\u0027: entity,"},{"line_number":143,"context_line":"                         \u0027timestamp\u0027: self._to_epoch(measure.timestamp),"},{"line_number":144,"context_line":"                         \u0027value\u0027: measure.value,"},{"line_number":145,"context_line":"                         \u0027tags\u0027: {\u0027resource\u0027: \u0027resource_id\u0027}})"},{"line_number":146,"context_line":"        self.client.put_meter(data)"},{"line_number":147,"context_line":""},{"line_number":148,"context_line":"    def get_measures(self, entity, from_timestamp\u003dNone, to_timestamp\u003dNone,"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_053f26d7","line":145,"in_reply_to":"9aa7fdbe_0372277c","updated":"2014-10-23 10:15:20.000000000","message":"well, ok, i\u0027ll add this and it it\u0027ll looks better will leave :)","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3e157634ba0a150e586cb2d7f4b7e78ee0fa8ae8","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"        aggregation \u003d self.NATIVE_AGGREGATES[aggregation]"},{"line_number":165,"context_line":"        if aggregation is None:"},{"line_number":166,"context_line":"            raise OpenTSDBClientError("},{"line_number":167,"context_line":"                \u0027No %s aggregation function is supported for the OpenTSDB. \u0027"},{"line_number":168,"context_line":"                \u0027Please use one from the list: %s\u0027 %"},{"line_number":169,"context_line":"                (aggregation,"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_832c574c","line":166,"updated":"2014-10-20 14:08:00.000000000","message":"I think it would be better to raise a special exception that inherits from gnocchi.NotImplementedError here.","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"bb5a9a05a4b7776fdbdbecdcb458c898cb8363e3","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"        aggregation \u003d self.NATIVE_AGGREGATES[aggregation]"},{"line_number":165,"context_line":"        if aggregation is None:"},{"line_number":166,"context_line":"            raise OpenTSDBClientError("},{"line_number":167,"context_line":"                \u0027No %s aggregation function is supported for the OpenTSDB. \u0027"},{"line_number":168,"context_line":"                \u0027Please use one from the list: %s\u0027 %"},{"line_number":169,"context_line":"                (aggregation,"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_85015608","line":166,"in_reply_to":"9aa7fdbe_832c574c","updated":"2014-10-23 10:15:20.000000000","message":"a-ha, ok, will do","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3e157634ba0a150e586cb2d7f4b7e78ee0fa8ae8","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                 [k for k in self.NATIVE_AGGREGATES.keys()"},{"line_number":171,"context_line":"                  if self.NATIVE_AGGREGATES[k] is not None]))"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        def compose_query(archive):"},{"line_number":174,"context_line":"            \"\"\"Returns query to get the measures with needed archive."},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"            :param archive: tuple of (\u003cgranularity\u003e, \u003cretention\u003e) to be used"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_de1472f7","line":173,"updated":"2014-10-20 14:08:00.000000000","message":"There\u0027s no need to have a closure, which is costly to build each time, just don\u0027t do that. :)","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"bb5a9a05a4b7776fdbdbecdcb458c898cb8363e3","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                 [k for k in self.NATIVE_AGGREGATES.keys()"},{"line_number":171,"context_line":"                  if self.NATIVE_AGGREGATES[k] is not None]))"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        def compose_query(archive):"},{"line_number":174,"context_line":"            \"\"\"Returns query to get the measures with needed archive."},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"            :param archive: tuple of (\u003cgranularity\u003e, \u003cretention\u003e) to be used"}],"source_content_type":"text/x-python","patch_set":6,"id":"9aa7fdbe_e8075716","line":173,"in_reply_to":"9aa7fdbe_de1472f7","updated":"2014-10-23 10:15:20.000000000","message":"will move outside :)","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"},{"author":{"_account_id":10987,"name":"Igor Degtiarov","username":"tovstun","inactive":true},"change_message_id":"b3ba0510f0b31ca7efd488000966d664a9f91d5a","unresolved":false,"context_lines":[{"line_number":46,"context_line":"    cfg.IntOpt(\u0027opentsdb_flush_interval\u0027,"},{"line_number":47,"context_line":"               default\u003d1000,"},{"line_number":48,"context_line":"               help\u003d\u0027How often, in milliseconds, to flush the data point \u0027"},{"line_number":49,"context_line":"                    \u0027storage write buffer. Should be more or equal the \u0027"},{"line_number":50,"context_line":"                    \u0027according configuration option set in the OpenTSDB.\u0027"},{"line_number":51,"context_line":"               ),"},{"line_number":52,"context_line":"    cfg.IntOpt(\u0027send_queue_max_size\u0027,"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_29cf882b","line":49,"updated":"2014-12-11 15:20:12.000000000","message":"Seems that it would be better s/equal the/equal to the/","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"9be7858f48d199e24d5dd5b80ec02f0cc2079ee2","unresolved":false,"context_lines":[{"line_number":46,"context_line":"    cfg.IntOpt(\u0027opentsdb_flush_interval\u0027,"},{"line_number":47,"context_line":"               default\u003d1000,"},{"line_number":48,"context_line":"               help\u003d\u0027How often, in milliseconds, to flush the data point \u0027"},{"line_number":49,"context_line":"                    \u0027storage write buffer. Should be more or equal the \u0027"},{"line_number":50,"context_line":"                    \u0027according configuration option set in the OpenTSDB.\u0027"},{"line_number":51,"context_line":"               ),"},{"line_number":52,"context_line":"    cfg.IntOpt(\u0027send_queue_max_size\u0027,"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_56e6cbe8","line":49,"in_reply_to":"3a961159_29cf882b","updated":"2014-12-15 16:36:29.000000000","message":"hm, not sure, I\u0027m using \u0027more or equal\u0027 phrase, I don\u0027t thing \u0027to\u0027 is sisal used after it - but I\u0027m not native speaker, that\u0027s why not sure","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":10987,"name":"Igor Degtiarov","username":"tovstun","inactive":true},"change_message_id":"b3ba0510f0b31ca7efd488000966d664a9f91d5a","unresolved":false,"context_lines":[{"line_number":51,"context_line":"               ),"},{"line_number":52,"context_line":"    cfg.IntOpt(\u0027send_queue_max_size\u0027,"},{"line_number":53,"context_line":"               default\u003d5,"},{"line_number":54,"context_line":"               help\u003d\u0027Batch size to be used foe meters sending. This is \u0027"},{"line_number":55,"context_line":"                    \u0027needed, as python-opentsdbclient supports the \u0027"},{"line_number":56,"context_line":"                    \u0027opportunity of message batching, and default batch size \u0027"},{"line_number":57,"context_line":"                    \u0027is 1000 for it - that is too big value for testing at \u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_89415cab","line":54,"updated":"2014-12-11 15:20:12.000000000","message":"s/foe/for","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"a5f3513c486b3d4188942d8751f75a8586243d00","unresolved":false,"context_lines":[{"line_number":86,"context_line":"    # \u0027min\u0027, \u0027mimmin\u0027, \u0027max\u0027, \u0027mimmax\u0027, \u0027dev\u0027, \u0027sum\u0027, \u0027avg\u0027, \u0027zimsum\u0027"},{"line_number":87,"context_line":"    # so there is no analog for the median, first and last"},{"line_number":88,"context_line":"    # for more info go here:"},{"line_number":89,"context_line":"    # http://opentsdb.net/docs/build/html/user_guide/query/aggregators.html"},{"line_number":90,"context_line":"    NATIVE_AGGREGATES \u003d dict("},{"line_number":91,"context_line":"        mean\u003d\u0027avg\u0027,"},{"line_number":92,"context_line":"        median\u003dNone,"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_4434b949","line":89,"updated":"2014-12-11 16:11:00.000000000","message":"Interesting, maybe we should enhance Carbonara with things like zimsum etc, and make sure what the API does if first/last are not supported like here.","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3a590a4db5a12a1ea1eba52c18f9d3de063825aa","unresolved":false,"context_lines":[{"line_number":86,"context_line":"    # \u0027min\u0027, \u0027mimmin\u0027, \u0027max\u0027, \u0027mimmax\u0027, \u0027dev\u0027, \u0027sum\u0027, \u0027avg\u0027, \u0027zimsum\u0027"},{"line_number":87,"context_line":"    # so there is no analog for the median, first and last"},{"line_number":88,"context_line":"    # for more info go here:"},{"line_number":89,"context_line":"    # http://opentsdb.net/docs/build/html/user_guide/query/aggregators.html"},{"line_number":90,"context_line":"    NATIVE_AGGREGATES \u003d dict("},{"line_number":91,"context_line":"        mean\u003d\u0027avg\u0027,"},{"line_number":92,"context_line":"        median\u003dNone,"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_a38630d9","line":89,"in_reply_to":"3a961159_4434b949","updated":"2014-12-11 16:35:19.000000000","message":"good point, yeah","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"0f42d7652d631bca0de10842034b6f4a7118f4f0","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    def _to_epoch(dt):"},{"line_number":114,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def create_metric(self, metric, back_window, archives):"},{"line_number":117,"context_line":"        \"\"\"Create an metric."},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"        For all entities archives are stored in \u0027archives\u0027 metric with current"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_dfc1f980","line":116,"updated":"2014-12-15 13:32:44.000000000","message":"an-\u003ea","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"0f42d7652d631bca0de10842034b6f4a7118f4f0","unresolved":false,"context_lines":[{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def create_metric(self, metric, back_window, archives):"},{"line_number":117,"context_line":"        \"\"\"Create an metric."},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"        For all entities archives are stored in \u0027archives\u0027 metric with current"},{"line_number":120,"context_line":"        time from epoch as a timestamp and metric as a tag."},{"line_number":121,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_7fb3a509","line":118,"updated":"2014-12-15 13:32:44.000000000","message":"The following should be rewritten because of \"entity -\u003e metric\" renaming, I guess","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"b482dea1bcab332c0c78d2a4024f2c75a993d5fc","unresolved":false,"context_lines":[{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def create_metric(self, metric, back_window, archives):"},{"line_number":117,"context_line":"        \"\"\"Create an metric."},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"        For all entities archives are stored in \u0027archives\u0027 metric with current"},{"line_number":120,"context_line":"        time from epoch as a timestamp and metric as a tag."},{"line_number":121,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_2a98fa1a","line":118,"in_reply_to":"3a961159_7fb3a509","updated":"2014-12-15 15:15:43.000000000","message":"yep, thanks","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":7729,"name":"Ilya Tyaptin","email":"ityaptin@mirantis.com","username":"ityaptin"},"change_message_id":"491913704dc3ad0544e8038ffe712b7575ab5cef","unresolved":false,"context_lines":[{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        :param metric: The metric key."},{"line_number":123,"context_line":"        :param back_window: number of maximum granularity windows to support"},{"line_number":124,"context_line":"                            writing data for"},{"line_number":125,"context_line":"        :param archives: The archive(s) configuration to use."},{"line_number":126,"context_line":"                         A list of (seconds, points) that indicates how many"},{"line_number":127,"context_line":"                         points to keep every seconds interval in archives."}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_ea8ef277","line":124,"updated":"2014-12-15 15:08:56.000000000","message":"Maybe needed here a dot?","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"a5f3513c486b3d4188942d8751f75a8586243d00","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        # add_measures -\u003e let\u0027s leave this code for now as POC, but in future"},{"line_number":219,"context_line":"        # we need background process of downsampling with periodic job, not"},{"line_number":220,"context_line":"        # just-in-time downsampling"},{"line_number":221,"context_line":"        time.sleep(self.flush_interval)"},{"line_number":222,"context_line":"        threads \u003d []"},{"line_number":223,"context_line":"        for archive in archives:"},{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_80cf6a28","line":221,"updated":"2014-12-11 16:11:00.000000000","message":"I don\u0027t get why this is needed?","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":7729,"name":"Ilya Tyaptin","email":"ityaptin@mirantis.com","username":"ityaptin"},"change_message_id":"491913704dc3ad0544e8038ffe712b7575ab5cef","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        # add_measures -\u003e let\u0027s leave this code for now as POC, but in future"},{"line_number":219,"context_line":"        # we need background process of downsampling with periodic job, not"},{"line_number":220,"context_line":"        # just-in-time downsampling"},{"line_number":221,"context_line":"        time.sleep(self.flush_interval)"},{"line_number":222,"context_line":"        threads \u003d []"},{"line_number":223,"context_line":"        for archive in archives:"},{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_ea743237","line":221,"in_reply_to":"3a961159_63ce0830","updated":"2014-12-15 15:08:56.000000000","message":"I think is better to move  time.sleep(self.flush_interval) to function \"self._write_downsampled_data\", because now we sleep in main thread and 1. Many requests to api reduce we requesting time. 2. The more we write in the flush_time, the more data will be in one openstdb batch, but now we sleep at every request and send to openstdb small batches.","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3a590a4db5a12a1ea1eba52c18f9d3de063825aa","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        # add_measures -\u003e let\u0027s leave this code for now as POC, but in future"},{"line_number":219,"context_line":"        # we need background process of downsampling with periodic job, not"},{"line_number":220,"context_line":"        # just-in-time downsampling"},{"line_number":221,"context_line":"        time.sleep(self.flush_interval)"},{"line_number":222,"context_line":"        threads \u003d []"},{"line_number":223,"context_line":"        for archive in archives:"},{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_63ce0830","line":221,"in_reply_to":"3a961159_80cf6a28","updated":"2014-12-11 16:35:19.000000000","message":"because otherwise original data won\u0027t be written yet - or we\u0027ll need to set flush time for OpenTSDB \u003d0, that\u0027s not really good for its performance. OpenTSDB has kind of built-in batching mechanism, and it\u0027s batching datapoint to be written using time interval to work on as well.","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"a5f3513c486b3d4188942d8751f75a8586243d00","unresolved":false,"context_lines":[{"line_number":223,"context_line":"        for archive in archives:"},{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"},{"line_number":225,"context_line":"                if supported:"},{"line_number":226,"context_line":"                    t \u003d threading.Thread("},{"line_number":227,"context_line":"                        target\u003dself._write_downsampled_data,"},{"line_number":228,"context_line":"                        args\u003d(metric, supported, archive,"},{"line_number":229,"context_line":"                              earliest_ts - int(archive[\u0027timespan\u0027]),"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_c4c26933","line":226,"updated":"2014-12-11 16:11:00.000000000","message":"I think we now use futures rather than that, maybe it\u0027d be a good idea to do the same.","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"948ab15168d324158b7ff7dc9af95d88ab50da0e","unresolved":false,"context_lines":[{"line_number":223,"context_line":"        for archive in archives:"},{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"},{"line_number":225,"context_line":"                if supported:"},{"line_number":226,"context_line":"                    t \u003d threading.Thread("},{"line_number":227,"context_line":"                        target\u003dself._write_downsampled_data,"},{"line_number":228,"context_line":"                        args\u003d(metric, supported, archive,"},{"line_number":229,"context_line":"                              earliest_ts - int(archive[\u0027timespan\u0027]),"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_60fdc16d","line":226,"in_reply_to":"3a961159_0a525e34","updated":"2014-12-15 15:51:57.000000000","message":"Heh, ok, got your point - you\u0027re about http://pythonhosted.org/futures/","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"af9b365a7d6f1c023611c98f0b34f68895272b92","unresolved":false,"context_lines":[{"line_number":223,"context_line":"        for archive in archives:"},{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"},{"line_number":225,"context_line":"                if supported:"},{"line_number":226,"context_line":"                    t \u003d threading.Thread("},{"line_number":227,"context_line":"                        target\u003dself._write_downsampled_data,"},{"line_number":228,"context_line":"                        args\u003d(metric, supported, archive,"},{"line_number":229,"context_line":"                              earliest_ts - int(archive[\u0027timespan\u0027]),"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_0a525e34","line":226,"in_reply_to":"3a961159_23e08095","updated":"2014-12-15 15:18:29.000000000","message":"Julien, as I see the carbonara code now you\u0027re using the same scheme with threads - can you please define what did you mean exactly here?","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3a590a4db5a12a1ea1eba52c18f9d3de063825aa","unresolved":false,"context_lines":[{"line_number":223,"context_line":"        for archive in archives:"},{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"},{"line_number":225,"context_line":"                if supported:"},{"line_number":226,"context_line":"                    t \u003d threading.Thread("},{"line_number":227,"context_line":"                        target\u003dself._write_downsampled_data,"},{"line_number":228,"context_line":"                        args\u003d(metric, supported, archive,"},{"line_number":229,"context_line":"                              earliest_ts - int(archive[\u0027timespan\u0027]),"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a961159_23e08095","line":226,"in_reply_to":"3a961159_c4c26933","updated":"2014-12-11 16:35:19.000000000","message":"hmm, let me check, I did not notice this. Thanks!","commit_id":"41d78649758940146bdf2a2ecf4a37fc4b5c0d0d"},{"author":{"_account_id":7729,"name":"Ilya Tyaptin","email":"ityaptin@mirantis.com","username":"ityaptin"},"change_message_id":"8258492e90ec199e5d4bc1ac844260e007b9ae3e","unresolved":false,"context_lines":[{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"},{"line_number":225,"context_line":"                if supported:"},{"line_number":226,"context_line":"                    self.executor.submit("},{"line_number":227,"context_line":"                        _write_downsampled_data, metric, supported, archive,"},{"line_number":228,"context_line":"                        earliest_ts - int(archive[\u0027timespan\u0027]), latest_ts)"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"    def _write_downsampled_data(self, metric, aggregation, archive, from_ts,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3a961159_00364852","line":227,"updated":"2014-12-18 14:26:31.000000000","message":"Maybe self._write_sample_data instead _write_sampled_data?","commit_id":"c8ae4633a0300922783d93482b5fe81bc213defe"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"145c7c4e88a6c3cc0e4750f1c9a91e2a6570101f","unresolved":false,"context_lines":[{"line_number":224,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"},{"line_number":225,"context_line":"                if supported:"},{"line_number":226,"context_line":"                    self.executor.submit("},{"line_number":227,"context_line":"                        _write_downsampled_data, metric, supported, archive,"},{"line_number":228,"context_line":"                        earliest_ts - int(archive[\u0027timespan\u0027]), latest_ts)"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"    def _write_downsampled_data(self, metric, aggregation, archive, from_ts,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3a961159_636396dd","line":227,"in_reply_to":"3a961159_00364852","updated":"2014-12-18 14:39:18.000000000","message":"yep","commit_id":"c8ae4633a0300922783d93482b5fe81bc213defe"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"97a764e1bbf8125fa61b52d966a6140f9bcaf30d","unresolved":false,"context_lines":[{"line_number":45,"context_line":"               ),"},{"line_number":46,"context_line":"    cfg.IntOpt(\u0027opentsdb_flush_interval\u0027,"},{"line_number":47,"context_line":"               default\u003d1,"},{"line_number":48,"context_line":"               help\u003d\u0027How often, in seconds, to flush the data point \u0027"},{"line_number":49,"context_line":"                    \u0027storage write buffer. Should be more or equal the \u0027"},{"line_number":50,"context_line":"                    \u0027according configuration option set in the OpenTSDB.\u0027"},{"line_number":51,"context_line":"               ),"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_4b392cf1","line":48,"updated":"2014-12-19 16:13:38.000000000","message":"equal to","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":45,"context_line":"               ),"},{"line_number":46,"context_line":"    cfg.IntOpt(\u0027opentsdb_flush_interval\u0027,"},{"line_number":47,"context_line":"               default\u003d1,"},{"line_number":48,"context_line":"               help\u003d\u0027How often, in seconds, to flush the data point \u0027"},{"line_number":49,"context_line":"                    \u0027storage write buffer. Should be more or equal the \u0027"},{"line_number":50,"context_line":"                    \u0027according configuration option set in the OpenTSDB.\u0027"},{"line_number":51,"context_line":"               ),"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_6fc89422","line":48,"in_reply_to":"3a961159_4b392cf1","updated":"2014-12-22 10:16:56.000000000","message":"ok","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"a37239042918ac97bd13675e3006c4c8e529f467","unresolved":false,"context_lines":[{"line_number":45,"context_line":"               ),"},{"line_number":46,"context_line":"    cfg.IntOpt(\u0027opentsdb_flush_interval\u0027,"},{"line_number":47,"context_line":"               default\u003d1,"},{"line_number":48,"context_line":"               help\u003d\u0027How often, in seconds, to flush the data point \u0027"},{"line_number":49,"context_line":"                    \u0027storage write buffer. Should be more or equal the \u0027"},{"line_number":50,"context_line":"                    \u0027according configuration option set in the OpenTSDB.\u0027"},{"line_number":51,"context_line":"               ),"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_3ee1582a","line":48,"in_reply_to":"3a961159_6fc89422","updated":"2014-12-22 13:20:33.000000000","message":"hm, btw it\u0027s not true actually - we can set gnocchi flush interval more than opentsdb one - we just need to be sure, raw data is written before writing down sampled one","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"97a764e1bbf8125fa61b52d966a6140f9bcaf30d","unresolved":false,"context_lines":[{"line_number":48,"context_line":"               help\u003d\u0027How often, in seconds, to flush the data point \u0027"},{"line_number":49,"context_line":"                    \u0027storage write buffer. Should be more or equal the \u0027"},{"line_number":50,"context_line":"                    \u0027according configuration option set in the OpenTSDB.\u0027"},{"line_number":51,"context_line":"               ),"},{"line_number":52,"context_line":"    cfg.IntOpt(\u0027send_queue_max_size\u0027,"},{"line_number":53,"context_line":"               default\u003d5,"},{"line_number":54,"context_line":"               help\u003d\u0027Batch size to be used for meters sending. This is \u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_4b104c59","line":51,"updated":"2014-12-19 16:13:38.000000000","message":"Dina, why did you choose such a difficult name for option :)? Why not \u0027batch_size\u0027 (\u0027opentsdb_batch_size\u0027)?","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":48,"context_line":"               help\u003d\u0027How often, in seconds, to flush the data point \u0027"},{"line_number":49,"context_line":"                    \u0027storage write buffer. Should be more or equal the \u0027"},{"line_number":50,"context_line":"                    \u0027according configuration option set in the OpenTSDB.\u0027"},{"line_number":51,"context_line":"               ),"},{"line_number":52,"context_line":"    cfg.IntOpt(\u0027send_queue_max_size\u0027,"},{"line_number":53,"context_line":"               default\u003d5,"},{"line_number":54,"context_line":"               help\u003d\u0027Batch size to be used for meters sending. This is \u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_4f4838b3","line":51,"in_reply_to":"3a961159_4b104c59","updated":"2014-12-22 10:16:56.000000000","message":"hehe, almost no reason here :) I will change the name :)","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"960b96171e2e5796ce2fed4029b74f21539cc435","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    @staticmethod"},{"line_number":119,"context_line":"    def _to_epoch(dt):"},{"line_number":120,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def create_metric(self, metric, back_window, archives):"},{"line_number":123,"context_line":"        \"\"\"Create a metric."},{"line_number":124,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_b68901cc","line":121,"updated":"2014-12-20 21:06:23.000000000","message":"archives \u003d\u003d archive_policy?","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"3d48bc20f5814fc04bfd5e5b0000ec96fc290c0b","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    @staticmethod"},{"line_number":119,"context_line":"    def _to_epoch(dt):"},{"line_number":120,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def create_metric(self, metric, back_window, archives):"},{"line_number":123,"context_line":"        \"\"\"Create a metric."},{"line_number":124,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_54435912","line":121,"in_reply_to":"3a961159_af9c3c0f","updated":"2014-12-22 21:24:00.000000000","message":"As it turned out, Metric has only one archive_policy. So archives -\u003e archive_policy. And \"for archive in archives:\" may be removed. (My new knowledge is only theoretical actually:))","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    @staticmethod"},{"line_number":119,"context_line":"    def _to_epoch(dt):"},{"line_number":120,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def create_metric(self, metric, back_window, archives):"},{"line_number":123,"context_line":"        \"\"\"Create a metric."},{"line_number":124,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_af9c3c0f","line":121,"in_reply_to":"3a961159_b68901cc","updated":"2014-12-22 10:16:56.000000000","message":"yep, old variant here left - did not notice it was changed in the parent classes","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"97a764e1bbf8125fa61b52d966a6140f9bcaf30d","unresolved":false,"context_lines":[{"line_number":119,"context_line":"    def _to_epoch(dt):"},{"line_number":120,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def create_metric(self, metric, back_window, archives):"},{"line_number":123,"context_line":"        \"\"\"Create a metric."},{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        For all metrics archives are stored in \u0027archives\u0027 metric with current"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_cec52a5d","line":122,"updated":"2014-12-19 16:13:38.000000000","message":"Hard to read. I suggest to join two sentences together like \"Creates a metric in db for all metrics archives from \u0027archives\u0027 with current time from epoch as a timestamp and \u0027metric\u0027 as a tag.\"\nAnd btw, existence of the both \u0027meter\u0027 and \u0027metric\u0027 confuses...","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":119,"context_line":"    def _to_epoch(dt):"},{"line_number":120,"context_line":"        return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def create_metric(self, metric, back_window, archives):"},{"line_number":123,"context_line":"        \"\"\"Create a metric."},{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        For all metrics archives are stored in \u0027archives\u0027 metric with current"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_0fd9d0f2","line":122,"in_reply_to":"3a961159_cec52a5d","updated":"2014-12-22 10:16:56.000000000","message":"will fix it","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"97a764e1bbf8125fa61b52d966a6140f9bcaf30d","unresolved":false,"context_lines":[{"line_number":144,"context_line":"                                  \u0027timespan\u0027: float(archive[\u0027timespan\u0027]),"},{"line_number":145,"context_line":"                                  \u0027granularity_points\u0027: \u0027%s_%s\u0027 % ("},{"line_number":146,"context_line":"                                      float(archive[\u0027granularity\u0027]),"},{"line_number":147,"context_line":"                                      archive[\u0027points\u0027])}})"},{"line_number":148,"context_line":"        # note(dbelova): by default OpenTSDB client batches meters to be"},{"line_number":149,"context_line":"        # sent (default batch size is 1000), so you definitely need to specify"},{"line_number":150,"context_line":"        # parameter send_queue_max_size of OpenTSDB client instance."}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_2ee4eedf","line":147,"updated":"2014-12-19 16:13:38.000000000","message":"looks like the note below is not needed","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":144,"context_line":"                                  \u0027timespan\u0027: float(archive[\u0027timespan\u0027]),"},{"line_number":145,"context_line":"                                  \u0027granularity_points\u0027: \u0027%s_%s\u0027 % ("},{"line_number":146,"context_line":"                                      float(archive[\u0027granularity\u0027]),"},{"line_number":147,"context_line":"                                      archive[\u0027points\u0027])}})"},{"line_number":148,"context_line":"        # note(dbelova): by default OpenTSDB client batches meters to be"},{"line_number":149,"context_line":"        # sent (default batch size is 1000), so you definitely need to specify"},{"line_number":150,"context_line":"        # parameter send_queue_max_size of OpenTSDB client instance."}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_3248af5b","line":147,"in_reply_to":"3a961159_2ee4eedf","updated":"2014-12-22 10:16:56.000000000","message":"ok, ill remove it - it was actually for the reviewers to let them know for sure, that OpenTSDB client does use batching. And if you\u0027re testing it on the devstack, it\u0027s kind of confusing not to see your data being written.","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"960b96171e2e5796ce2fed4029b74f21539cc435","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                             \u0027timespan\u0027: float(dp[\u0027tags\u0027][\u0027timespan\u0027])})"},{"line_number":171,"context_line":"        return archives"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"    def delete_metric(self, metric):"},{"line_number":174,"context_line":"        \"\"\"Delete an metric."},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"        Does not work for the OpenTSDB - we may implement table"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_b67741d3","line":173,"updated":"2014-12-20 21:06:23.000000000","message":"\u0027an\u0027","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                             \u0027timespan\u0027: float(dp[\u0027tags\u0027][\u0027timespan\u0027])})"},{"line_number":171,"context_line":"        return archives"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"    def delete_metric(self, metric):"},{"line_number":174,"context_line":"        \"\"\"Delete an metric."},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"        Does not work for the OpenTSDB - we may implement table"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_7275d796","line":173,"in_reply_to":"3a961159_b67741d3","updated":"2014-12-22 10:16:56.000000000","message":"will fix","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"960b96171e2e5796ce2fed4029b74f21539cc435","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        raise NotImplementedError(\u0027Metric deletion is not supported for \u0027"},{"line_number":182,"context_line":"                                  \u0027OpenTSDB backend.\u0027)"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def add_measures(self, metric, measures):"},{"line_number":185,"context_line":"        \"\"\"Add a measure to an metric."},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"        :param metric: The metric measured."}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_b6b0218c","line":184,"updated":"2014-12-20 21:06:23.000000000","message":"\u0027an\u0027","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":181,"context_line":"        raise NotImplementedError(\u0027Metric deletion is not supported for \u0027"},{"line_number":182,"context_line":"                                  \u0027OpenTSDB backend.\u0027)"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def add_measures(self, metric, measures):"},{"line_number":185,"context_line":"        \"\"\"Add a measure to an metric."},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"        :param metric: The metric measured."}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_927a4386","line":184,"in_reply_to":"3a961159_b6b0218c","updated":"2014-12-22 10:16:56.000000000","message":"will fix","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"960b96171e2e5796ce2fed4029b74f21539cc435","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        for measure in measures:"},{"line_number":206,"context_line":"            ts \u003d self._to_epoch(measure.timestamp)"},{"line_number":207,"context_line":"            data.append({\u0027metric\u0027: metric, \u0027timestamp\u0027: ts,"},{"line_number":208,"context_line":"                         \u0027value\u0027: measure.value,"},{"line_number":209,"context_line":"                         \u0027tags\u0027: {\u0027resource\u0027: \u0027resource_id\u0027}})"},{"line_number":210,"context_line":"            earliest_ts \u003d min(earliest_ts, ts)"},{"line_number":211,"context_line":"            latest_ts \u003d max(latest_ts, ts)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_56c29de9","line":208,"updated":"2014-12-20 21:06:23.000000000","message":"\u0027resource_id\u0027? Is it a temporary solution? Don\u0027t we have a link to real resource_id?","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"e3dfb9554e468e80a91b2b4e02a7bb1ab81ac52f","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        for measure in measures:"},{"line_number":206,"context_line":"            ts \u003d self._to_epoch(measure.timestamp)"},{"line_number":207,"context_line":"            data.append({\u0027metric\u0027: metric, \u0027timestamp\u0027: ts,"},{"line_number":208,"context_line":"                         \u0027value\u0027: measure.value,"},{"line_number":209,"context_line":"                         \u0027tags\u0027: {\u0027resource\u0027: \u0027resource_id\u0027}})"},{"line_number":210,"context_line":"            earliest_ts \u003d min(earliest_ts, ts)"},{"line_number":211,"context_line":"            latest_ts \u003d max(latest_ts, ts)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_5ed4641f","line":208,"in_reply_to":"3a961159_12ad73e9","updated":"2014-12-22 13:30:55.000000000","message":"ah, not so simple here, we do not pass any resources to the storage level, metric we pass is just id and that\u0027s it. I\u0027ll need to fix it on the dispatcher level first and allow to pass resource id to use it here (as I don\u0027t want to go to the indexer here, as said)","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        for measure in measures:"},{"line_number":206,"context_line":"            ts \u003d self._to_epoch(measure.timestamp)"},{"line_number":207,"context_line":"            data.append({\u0027metric\u0027: metric, \u0027timestamp\u0027: ts,"},{"line_number":208,"context_line":"                         \u0027value\u0027: measure.value,"},{"line_number":209,"context_line":"                         \u0027tags\u0027: {\u0027resource\u0027: \u0027resource_id\u0027}})"},{"line_number":210,"context_line":"            earliest_ts \u003d min(earliest_ts, ts)"},{"line_number":211,"context_line":"            latest_ts \u003d max(latest_ts, ts)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_12ad73e9","line":208,"in_reply_to":"3a961159_56c29de9","updated":"2014-12-22 10:16:56.000000000","message":"to grab it we need to go to the indexer (which is much slower than TS storage) and grab info about metric. But (!) I can write this data as a tag to archives and use it here. Good idea btw, will fix this moment","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"3d48bc20f5814fc04bfd5e5b0000ec96fc290c0b","unresolved":false,"context_lines":[{"line_number":218,"context_line":""},{"line_number":219,"context_line":"        # todo(dbelova): check somewhere before earliest TS"},{"line_number":220,"context_line":"        # due to the back_window"},{"line_number":221,"context_line":""},{"line_number":222,"context_line":"        for archive in archives:"},{"line_number":223,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"},{"line_number":224,"context_line":"                if supported:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_d4c1094f","line":221,"updated":"2014-12-22 21:24:00.000000000","message":"Only one archive","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"8e16e7db815db3feab648a62fb16b9e3c623aa72","unresolved":false,"context_lines":[{"line_number":218,"context_line":""},{"line_number":219,"context_line":"        # todo(dbelova): check somewhere before earliest TS"},{"line_number":220,"context_line":"        # due to the back_window"},{"line_number":221,"context_line":""},{"line_number":222,"context_line":"        for archive in archives:"},{"line_number":223,"context_line":"            for aggr, supported in six.iteritems(self.NATIVE_AGGREGATES):"},{"line_number":224,"context_line":"                if supported:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_b02d5b91","line":221,"in_reply_to":"3a961159_d4c1094f","updated":"2014-12-23 12:18:48.000000000","message":"we do have many definitions (actually archives) inside one archive policy - take a look here https://github.com/stackforge/gnocchi/blob/master/doc/source/rest.yaml#L37","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"3d48bc20f5814fc04bfd5e5b0000ec96fc290c0b","unresolved":false,"context_lines":[{"line_number":226,"context_line":"                        self._write_downsampled_data, metric, supported,"},{"line_number":227,"context_line":"                        archive, earliest_ts - int(archive[\u0027timespan\u0027]),"},{"line_number":228,"context_line":"                        latest_ts)"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"    def _write_downsampled_data(self, metric, aggregation, archive, from_ts,"},{"line_number":231,"context_line":"                                to_ts):"},{"line_number":232,"context_line":"        time.sleep(self.flush_interval)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_54b279e5","line":229,"updated":"2014-12-22 21:24:00.000000000","message":"What is the strategy about downsampling? I mean what should be done if policy is like \u0027aggregate by a month\u0027 but to_ts - from-ts is less then a month? Aggregate anyway and continuously rewrite entry in db?","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"8e16e7db815db3feab648a62fb16b9e3c623aa72","unresolved":false,"context_lines":[{"line_number":226,"context_line":"                        self._write_downsampled_data, metric, supported,"},{"line_number":227,"context_line":"                        archive, earliest_ts - int(archive[\u0027timespan\u0027]),"},{"line_number":228,"context_line":"                        latest_ts)"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"    def _write_downsampled_data(self, metric, aggregation, archive, from_ts,"},{"line_number":231,"context_line":"                                to_ts):"},{"line_number":232,"context_line":"        time.sleep(self.flush_interval)"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_f009a395","line":229,"in_reply_to":"3a961159_54b279e5","updated":"2014-12-23 12:18:48.000000000","message":"actually this will use opentsdb built-in downsampling mechanism - it\u0027s nice example-table here http://opentsdb.net/docs/build/html/user_guide/query/aggregators.html?highlight\u003ddownsampling - the last downsampling period (that\u0027s less than granularity) will be recalculated and rewritten, as you said","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"960b96171e2e5796ce2fed4029b74f21539cc435","unresolved":false,"context_lines":[{"line_number":234,"context_line":"        query \u003d self.compose_query(metric, archive[\u0027granularity\u0027],"},{"line_number":235,"context_line":"                                   from_ts, to_ts, aggregation)"},{"line_number":236,"context_line":"        downsampled \u003d self.rest_client.get_query(query)"},{"line_number":237,"context_line":"        dps \u003d self.rest_client.process_response(downsampled)[0][\u0027dps\u0027]"},{"line_number":238,"context_line":"        dps \u003d [{\u0027metric\u0027: \u0027%s_%s_%s\u0027 % (metric, archive[\u0027granularity\u0027],"},{"line_number":239,"context_line":"                                        aggregation),"},{"line_number":240,"context_line":"                \u0027timestamp\u0027: int(k), \u0027value\u0027: v,"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_766a39ee","line":237,"updated":"2014-12-20 21:06:23.000000000","message":"Dina, will not we get the same problem with delimiters? E.g. if metric contain \"_\" (some new one)","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"8e16e7db815db3feab648a62fb16b9e3c623aa72","unresolved":false,"context_lines":[{"line_number":234,"context_line":"        query \u003d self.compose_query(metric, archive[\u0027granularity\u0027],"},{"line_number":235,"context_line":"                                   from_ts, to_ts, aggregation)"},{"line_number":236,"context_line":"        downsampled \u003d self.rest_client.get_query(query)"},{"line_number":237,"context_line":"        dps \u003d self.rest_client.process_response(downsampled)[0][\u0027dps\u0027]"},{"line_number":238,"context_line":"        dps \u003d [{\u0027metric\u0027: \u0027%s_%s_%s\u0027 % (metric, archive[\u0027granularity\u0027],"},{"line_number":239,"context_line":"                                        aggregation),"},{"line_number":240,"context_line":"                \u0027timestamp\u0027: int(k), \u0027value\u0027: v,"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_f087e35e","line":237,"in_reply_to":"3a961159_32bb4f10","updated":"2014-12-23 12:18:48.000000000","message":"I\u0027ve decided not to change it right now dow to our yesterday discussion - it\u0027ll work faster if it\u0027ll be meter_name, not the tag","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":234,"context_line":"        query \u003d self.compose_query(metric, archive[\u0027granularity\u0027],"},{"line_number":235,"context_line":"                                   from_ts, to_ts, aggregation)"},{"line_number":236,"context_line":"        downsampled \u003d self.rest_client.get_query(query)"},{"line_number":237,"context_line":"        dps \u003d self.rest_client.process_response(downsampled)[0][\u0027dps\u0027]"},{"line_number":238,"context_line":"        dps \u003d [{\u0027metric\u0027: \u0027%s_%s_%s\u0027 % (metric, archive[\u0027granularity\u0027],"},{"line_number":239,"context_line":"                                        aggregation),"},{"line_number":240,"context_line":"                \u0027timestamp\u0027: int(k), \u0027value\u0027: v,"}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_32bb4f10","line":237,"in_reply_to":"3a961159_766a39ee","updated":"2014-12-22 10:16:56.000000000","message":"Nadya, yeah, we can grab problem like this here. Well, probably, I may write down sampled data to the same metric, but use tag \u003cgranularity\u003e_\u003cretention\u003e to define exact time series. I suppose this will look better here - what do you think?","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"97a764e1bbf8125fa61b52d966a6140f9bcaf30d","unresolved":false,"context_lines":[{"line_number":245,"context_line":"        self.socket_client.put_meter(data)"},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"    def get_measures(self, metric, from_timestamp\u003dNone, to_timestamp\u003dNone,"},{"line_number":248,"context_line":"                     aggregation\u003d\u0027avg\u0027):"},{"line_number":249,"context_line":"        \"\"\"Get measures for an metric."},{"line_number":250,"context_line":""},{"line_number":251,"context_line":"        :param metric: The metric measured."}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_ce90caef","line":248,"updated":"2014-12-19 16:13:38.000000000","message":"\u0027an\u0027","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"3238ad213f255030e2ee95014041d5d2baeb5325","unresolved":false,"context_lines":[{"line_number":245,"context_line":"        self.socket_client.put_meter(data)"},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"    def get_measures(self, metric, from_timestamp\u003dNone, to_timestamp\u003dNone,"},{"line_number":248,"context_line":"                     aggregation\u003d\u0027avg\u0027):"},{"line_number":249,"context_line":"        \"\"\"Get measures for an metric."},{"line_number":250,"context_line":""},{"line_number":251,"context_line":"        :param metric: The metric measured."}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_723877a0","line":248,"in_reply_to":"3a961159_ce90caef","updated":"2014-12-22 10:16:56.000000000","message":"will fix","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"3d48bc20f5814fc04bfd5e5b0000ec96fc290c0b","unresolved":false,"context_lines":[{"line_number":268,"context_line":"                 if self.NATIVE_AGGREGATES[k] is not None])"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"        datapoints \u003d []"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"        for archive in self._get_archives(metric):"},{"line_number":273,"context_line":"            # we grab data from downsampled one"},{"line_number":274,"context_line":"            query \u003d self.compose_query("}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_946a2118","line":271,"updated":"2014-12-22 21:24:00.000000000","message":"At first sight it looks like we don\u0027t need policy at all here. We may use work with row key (metric) like \u0027metricName_aggregation\u0027. But what should we do if we don\u0027t have enough granularity in db? E.g. we have one avg-aggregated month but user wants a week? As for me smth like NoSuchData should be thrown. And user should create a new metric with \u0027week\u0027-policy. What do you think?","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"8e16e7db815db3feab648a62fb16b9e3c623aa72","unresolved":false,"context_lines":[{"line_number":268,"context_line":"                 if self.NATIVE_AGGREGATES[k] is not None])"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"        datapoints \u003d []"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"        for archive in self._get_archives(metric):"},{"line_number":273,"context_line":"            # we grab data from downsampled one"},{"line_number":274,"context_line":"            query \u003d self.compose_query("}],"source_content_type":"text/x-python","patch_set":13,"id":"3a961159_1040ef05","line":271,"in_reply_to":"3a961159_946a2118","updated":"2014-12-23 12:18:48.000000000","message":"archive policy, as I mentioned above, allows to create policy with multiple definitions - https://github.com/stackforge/gnocchi/blob/master/doc/source/rest.yaml#L37\n\nThat\u0027s why I need to run through the archives (definitions) and grab all needed data.\n\nI do have error right now - left after old code-variant - I need to ensure I write archives data now for sure, all the definitions, not just policy name, for instance.\n\n I need to add NoSuchData thing you\u0027ve proposed anyway, this is just a comment here.","commit_id":"4c3590e65a8e3656d09e5a5022dbd0a456b27174"},{"author":{"_account_id":7729,"name":"Ilya Tyaptin","email":"ityaptin@mirantis.com","username":"ityaptin"},"change_message_id":"a7c146a84a93fc71ab31f503fd5c44149786d088","unresolved":false,"context_lines":[{"line_number":237,"context_line":""},{"line_number":238,"context_line":"    def _write_downsampled_data(self, metric, aggregation, definition, from_ts,"},{"line_number":239,"context_line":"                                to_ts):"},{"line_number":240,"context_line":"        data \u003d []"},{"line_number":241,"context_line":"        query \u003d self.compose_query(metric, definition[\u0027granularity\u0027],"},{"line_number":242,"context_line":"                                   from_ts, to_ts, aggregation)"},{"line_number":243,"context_line":"        downsampled \u003d self.rest_client.get_query(query)"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a961159_2d9e2655","line":240,"updated":"2014-12-29 14:30:29.000000000","message":"Why we create new \u0027data\u0027 list here? I think we should to send \u0027data\u0027 from \u0027add_measures\u0027 method. If I am not right we can send dps to socket_client.put_meter instead extended data.","commit_id":"71a79f8444a5334b88bb898cd0857c07d8645bd1"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"445c96f370181c81c648f7142a90d278684b6b91","unresolved":false,"context_lines":[{"line_number":237,"context_line":""},{"line_number":238,"context_line":"    def _write_downsampled_data(self, metric, aggregation, definition, from_ts,"},{"line_number":239,"context_line":"                                to_ts):"},{"line_number":240,"context_line":"        data \u003d []"},{"line_number":241,"context_line":"        query \u003d self.compose_query(metric, definition[\u0027granularity\u0027],"},{"line_number":242,"context_line":"                                   from_ts, to_ts, aggregation)"},{"line_number":243,"context_line":"        downsampled \u003d self.rest_client.get_query(query)"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a961159_0d524a68","line":240,"in_reply_to":"3a961159_2d9e2655","updated":"2014-12-29 14:41:51.000000000","message":"yep, you\u0027re right","commit_id":"71a79f8444a5334b88bb898cd0857c07d8645bd1"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"98afa96313b18fcd1001085f2641e73dd5dd66a1","unresolved":false,"context_lines":[{"line_number":81,"context_line":""},{"line_number":82,"context_line":"def _get_next_stable_point(timestamp, timespan):"},{"line_number":83,"context_line":"    try:"},{"line_number":84,"context_line":"        timestamp \u003d int(timestamp)"},{"line_number":85,"context_line":"        timespan \u003d int(timespan)"},{"line_number":86,"context_line":"    except TypeError:"},{"line_number":87,"context_line":"        LOG.error(\"Invalid type of timestamp or timespan\")"}],"source_content_type":"text/x-python","patch_set":20,"id":"3a961159_aa43c311","line":84,"updated":"2014-12-30 16:14:38.000000000","message":"I would say this should be one static method inside the class with the following structure - def _get_stable_point(timestamp, timespan, position\u003d\u0027next\u0027) - or smith like this","commit_id":"abbaa80d4c69be3323bd4be8be88cc1d8cb78a37"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"ac4803473d415044a8ae01623b791be23171c15f","unresolved":false,"context_lines":[{"line_number":135,"context_line":"    def _to_hex(metric):"},{"line_number":136,"context_line":"        return uuid.UUID(metric).hex"},{"line_number":137,"context_line":""},{"line_number":138,"context_line":"    def create_metric(self, metric, back_window, archive_policy):"},{"line_number":139,"context_line":"        \"\"\"Create a metric."},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"        Creates a metric in db for all metrics\u0027 archives from \u0027archive_policy\u0027"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a961159_1ab92116","line":138,"updated":"2015-01-15 10:11:13.000000000","message":"TODO: remove back_window param from here, now it\u0027s part of archive_policy","commit_id":"103e3802423896d83ffa4014b024995ff47f3c5d"},{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"56cdb034388ee5e59380f7872e841229d425b571","unresolved":false,"context_lines":[{"line_number":150,"context_line":"                               many points to keep every seconds interval."},{"line_number":151,"context_line":"        \"\"\""},{"line_number":152,"context_line":"        data \u003d []"},{"line_number":153,"context_line":"        for definition in archive_policy:"},{"line_number":154,"context_line":"            # we can store only one *numeric* value in the value data, so"},{"line_number":155,"context_line":"            # let\u0027s write to the value back_window param, but keep granularity"},{"line_number":156,"context_line":"            # and points in the tag"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a961159_5a872912","line":153,"updated":"2015-01-15 10:16:00.000000000","message":"TODO: for defenetion in archive_policy.definition","commit_id":"103e3802423896d83ffa4014b024995ff47f3c5d"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"396820b5048d36ea7776614c15299cc5bd606d00","unresolved":false,"context_lines":[{"line_number":111,"context_line":"    )"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def __init__(self, conf):"},{"line_number":114,"context_line":"        if opentsdb_cl is None or opentsdbclient is None:"},{"line_number":115,"context_line":"            raise OpenTSDBClientError(\u0027No python-opentsdbclient package found.\u0027"},{"line_number":116,"context_line":"                                      \u0027 Please install it and try again.\u0027)"},{"line_number":117,"context_line":"        host \u003d (conf.opentsdb_host, conf.opentsdb_port)"}],"source_content_type":"text/x-python","patch_set":28,"id":"9a80dd14_6b6b30b9","line":114,"updated":"2015-03-13 14:24:53.000000000","message":"Is this something that\u0027s actually likely to happen. Would an import error on statrtup not have the same value?","commit_id":"c03e9dc0f3513be1b7ddbddd5b9379be7479be80"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"cfba466b39f5f5780778877f4cd7c0fe7ac7a905","unresolved":false,"context_lines":[{"line_number":111,"context_line":"    )"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def __init__(self, conf):"},{"line_number":114,"context_line":"        if opentsdb_cl is None or opentsdbclient is None:"},{"line_number":115,"context_line":"            raise OpenTSDBClientError(\u0027No python-opentsdbclient package found.\u0027"},{"line_number":116,"context_line":"                                      \u0027 Please install it and try again.\u0027)"},{"line_number":117,"context_line":"        host \u003d (conf.opentsdb_host, conf.opentsdb_port)"}],"source_content_type":"text/x-python","patch_set":28,"id":"9a80dd14_97a9ab26","line":114,"in_reply_to":"9a80dd14_28f6998f","updated":"2015-03-18 14:05:50.000000000","message":"Generally speaking I think it best to fail as soon as possible, if that failure is the kind of failure that means the system will not work. If someone has configured their system to use openstsdb, if the necessary modules aren\u0027t present, it won\u0027t work, so it seems reasonable to die at module import.","commit_id":"c03e9dc0f3513be1b7ddbddd5b9379be7479be80"},{"author":{"_account_id":7729,"name":"Ilya Tyaptin","email":"ityaptin@mirantis.com","username":"ityaptin"},"change_message_id":"4c0cb66f647ddbdef8fb87e5ef8f2e8543f3bbf8","unresolved":false,"context_lines":[{"line_number":111,"context_line":"    )"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def __init__(self, conf):"},{"line_number":114,"context_line":"        if opentsdb_cl is None or opentsdbclient is None:"},{"line_number":115,"context_line":"            raise OpenTSDBClientError(\u0027No python-opentsdbclient package found.\u0027"},{"line_number":116,"context_line":"                                      \u0027 Please install it and try again.\u0027)"},{"line_number":117,"context_line":"        host \u003d (conf.opentsdb_host, conf.opentsdb_port)"}],"source_content_type":"text/x-python","patch_set":28,"id":"9a80dd14_28f6998f","line":114,"in_reply_to":"9a80dd14_6b6b30b9","updated":"2015-03-13 15:37:33.000000000","message":"Yes, opentsdb_cl and opentsdbclient will have None value after import error, we don\u0027t change they runtime. I\u0027m not sure how it will be better: raise ImportError while class is being initialized or raise it while in module initialization. If you think what second case is preferred, I\u0027ll change this moment.","commit_id":"c03e9dc0f3513be1b7ddbddd5b9379be7479be80"},{"author":{"_account_id":7729,"name":"Ilya Tyaptin","email":"ityaptin@mirantis.com","username":"ityaptin"},"change_message_id":"3993e852fc7ae3c6916bc33260b9014c8dfd5a09","unresolved":false,"context_lines":[{"line_number":20,"context_line":"import uuid"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"import futures"},{"line_number":23,"context_line":"try:"},{"line_number":24,"context_line":"    import opentsdbclient"},{"line_number":25,"context_line":"    import opentsdbclient.client as opentsdb_cl"},{"line_number":26,"context_line":"except ImportError:"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a6ced46_39953787","line":23,"updated":"2015-03-25 11:47:03.000000000","message":"It\u0027s needed because python-opentsdbclient is not installed in gate yet. In same time, we import gnocchi.storage.opentsdb in gnocchi/opts.py and gate job fails if we raise ImportException here.","commit_id":"d7825706d5e65a70342357dd946c9d5d32cbd454"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"3453e374f7e7b97a24fb2e5e997805050563e4a0","unresolved":false,"context_lines":[{"line_number":20,"context_line":"import uuid"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"import futures"},{"line_number":23,"context_line":"try:"},{"line_number":24,"context_line":"    import opentsdbclient"},{"line_number":25,"context_line":"    import opentsdbclient.client as opentsdb_cl"},{"line_number":26,"context_line":"except ImportError:"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a6ced46_b93e878a","line":23,"in_reply_to":"1a6ced46_39953787","updated":"2015-03-25 11:56:00.000000000","message":"Ah okay, that makes sense, for now. I suppose one options would be to break the options out into their own file?\n\nIn the longer term this behavior suggests that there is something completely broken about the way we are loading options (and perhaps other things) for optional drivers, but I reckon that can be a problem for a different day.","commit_id":"d7825706d5e65a70342357dd946c9d5d32cbd454"}],"setup.cfg":[{"author":{"_account_id":3012,"name":"Dina Belova","email":"dbelova@mirantis.com","username":"dbelova"},"change_message_id":"76c979d00806611eff78cd04075ba48f9a0843e3","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    null \u003d gnocchi.storage.null:NullStorage"},{"line_number":33,"context_line":"    swift \u003d gnocchi.storage.swift:SwiftStorage"},{"line_number":34,"context_line":"    file \u003d gnocchi.storage.file:FileStorage"},{"line_number":35,"context_line":"    opentsdb \u003d gnocchi.storage.opentsdb.driver:OpenTSDBStorage"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"gnocchi.indexer \u003d"},{"line_number":38,"context_line":"    null \u003d gnocchi.indexer.null:NullIndexer"}],"source_content_type":"text/x-ttcn-cfg","patch_set":6,"id":"9aa7fdbe_6eefefe9","line":35,"range":{"start_line":35,"start_character":40,"end_line":35,"end_character":46},"updated":"2014-10-23 11:58:41.000000000","message":"I need to remove driver here btw","commit_id":"d0bfbcd01a4bdee374162d14db31a4d76c6b64fa"}]}
