)]}'
{"nova/objects/monitor_metric.py":[{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"e8d6e76d2c741caf67a745615fff5a5c4409db07","unresolved":false,"context_lines":[{"line_number":21,"context_line":"# NOTE(jwcroppe): Used to determine which fields whose value we need to adjust"},{"line_number":22,"context_line":"# (read: divide by 100.0) before sending information to the RPC notifier since"},{"line_number":23,"context_line":"# these values were expected to be within the range [0, 1]."},{"line_number":24,"context_line":"FIELDS_REQUIRING_CONVERSION \u003d [fields.MonitorMetricType.CPU_USER_PERCENT,"},{"line_number":25,"context_line":"                               fields.MonitorMetricType.CPU_KERNEL_PERCENT,"},{"line_number":26,"context_line":"                               fields.MonitorMetricType.CPU_IDLE_PERCENT,"},{"line_number":27,"context_line":"                               fields.MonitorMetricType.CPU_IOWAIT_PERCENT,"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_22a73cab","line":24,"updated":"2015-11-11 22:19:09.000000000","message":"Is this related to the bug at hand?","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"416c75a7e8aec77726a44b46e11137c63970a7b4","unresolved":false,"context_lines":[{"line_number":21,"context_line":"# NOTE(jwcroppe): Used to determine which fields whose value we need to adjust"},{"line_number":22,"context_line":"# (read: divide by 100.0) before sending information to the RPC notifier since"},{"line_number":23,"context_line":"# these values were expected to be within the range [0, 1]."},{"line_number":24,"context_line":"FIELDS_REQUIRING_CONVERSION \u003d [fields.MonitorMetricType.CPU_USER_PERCENT,"},{"line_number":25,"context_line":"                               fields.MonitorMetricType.CPU_KERNEL_PERCENT,"},{"line_number":26,"context_line":"                               fields.MonitorMetricType.CPU_IDLE_PERCENT,"},{"line_number":27,"context_line":"                               fields.MonitorMetricType.CPU_IOWAIT_PERCENT,"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_11e6cd43","line":24,"in_reply_to":"da85f559_22a73cab","updated":"2015-11-12 19:21:30.000000000","message":"@Ryan,\nYes. All these following percent fields are coming as zeroes.","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"e8d6e76d2c741caf67a745615fff5a5c4409db07","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    fields \u003d {"},{"line_number":39,"context_line":"        \u0027name\u0027: fields.MonitorMetricTypeField(nullable\u003dFalse),"},{"line_number":40,"context_line":"        \u0027value\u0027: fields.FloatField(nullable\u003dFalse),"},{"line_number":41,"context_line":"        \u0027numa_membw_values\u0027: fields.DictOfIntegersField(nullable\u003dTrue),"},{"line_number":42,"context_line":"        \u0027timestamp\u0027: fields.DateTimeField(nullable\u003dFalse),"},{"line_number":43,"context_line":"        # This will be the stevedore extension full class name"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_e29e1462","line":40,"updated":"2015-11-11 22:19:09.000000000","message":"Because you\u0027re changing a field, you need to bump the version of MonitorMetric. Since you\u0027re changing a type, you should also add a compat section to obj_make_compatible() below that will convert it correctly.","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"59e047bedc7ae935af6599fbc2a1e423dfc9311e","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    fields \u003d {"},{"line_number":39,"context_line":"        \u0027name\u0027: fields.MonitorMetricTypeField(nullable\u003dFalse),"},{"line_number":40,"context_line":"        \u0027value\u0027: fields.FloatField(nullable\u003dFalse),"},{"line_number":41,"context_line":"        \u0027numa_membw_values\u0027: fields.DictOfIntegersField(nullable\u003dTrue),"},{"line_number":42,"context_line":"        \u0027timestamp\u0027: fields.DateTimeField(nullable\u003dFalse),"},{"line_number":43,"context_line":"        # This will be the stevedore extension full class name"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_5702b63f","line":40,"in_reply_to":"da85f559_0f63c11b","updated":"2015-11-15 02:38:59.000000000","message":"Please see this commit, which \"fixed\" the percentage fields:\n\nhttps://github.com/openstack/nova/commit/87e1d8fab2b5888e711f07001025600fe709aaa7","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"be8e2541919be91aeac2d0f9daa2f46d37c11224","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    fields \u003d {"},{"line_number":39,"context_line":"        \u0027name\u0027: fields.MonitorMetricTypeField(nullable\u003dFalse),"},{"line_number":40,"context_line":"        \u0027value\u0027: fields.FloatField(nullable\u003dFalse),"},{"line_number":41,"context_line":"        \u0027numa_membw_values\u0027: fields.DictOfIntegersField(nullable\u003dTrue),"},{"line_number":42,"context_line":"        \u0027timestamp\u0027: fields.DateTimeField(nullable\u003dFalse),"},{"line_number":43,"context_line":"        # This will be the stevedore extension full class name"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_809fc04f","line":40,"in_reply_to":"da85f559_1161ecd3","updated":"2015-11-12 21:23:59.000000000","message":"I\u0027m not sure how you would handle the compatibility logic. If I send a v1.2 version of the object to something that understands only v1.1, you\u0027ll have to convert from the float to an int. You can maybe do that by doing int(value * 100), but that may just introduce more bugs. Dan Smith will probably be the one that knows the best way to handle this.","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"94fe141b888e3118260c07d1195e853a6bd711fe","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    fields \u003d {"},{"line_number":39,"context_line":"        \u0027name\u0027: fields.MonitorMetricTypeField(nullable\u003dFalse),"},{"line_number":40,"context_line":"        \u0027value\u0027: fields.FloatField(nullable\u003dFalse),"},{"line_number":41,"context_line":"        \u0027numa_membw_values\u0027: fields.DictOfIntegersField(nullable\u003dTrue),"},{"line_number":42,"context_line":"        \u0027timestamp\u0027: fields.DateTimeField(nullable\u003dFalse),"},{"line_number":43,"context_line":"        # This will be the stevedore extension full class name"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_ee98e66c","line":40,"in_reply_to":"da85f559_5702b63f","updated":"2015-11-16 18:49:42.000000000","message":"@Jay,\nI was aware of this commit[1]. This commit fixed writing the value as [0,1] onto the DB, but read at scheduler was still broken.\n\nI reported the bug, while working on master branch as of 11/09/2015 [2]\nYou may reproduce on your devstack with the config change for nova, I mentioned in the bug[3] and by adding appropriate print statements in MetricsFilter.\n\nAfter debugging further, I saw the normalized percentage values [0,1] were getting typecasted to Integer and forcefully truncated as zeroes due the above mentioned code.\n\nI hope this clarifies. Let me know, if I am missing something.\n\nRegards,\nSuro\n[1] - https://github.com/openstack/nova/commit/87e1d8fab2b5888e711f07001025600fe709aaa7\n[2] - https://bugs.launchpad.net/nova/+bug/1514997/comments/2\n[3] - https://bugs.launchpad.net/nova/+bug/1514997","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"a68be97d8f264aba7321a73f0648b69f26cfd977","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    fields \u003d {"},{"line_number":39,"context_line":"        \u0027name\u0027: fields.MonitorMetricTypeField(nullable\u003dFalse),"},{"line_number":40,"context_line":"        \u0027value\u0027: fields.FloatField(nullable\u003dFalse),"},{"line_number":41,"context_line":"        \u0027numa_membw_values\u0027: fields.DictOfIntegersField(nullable\u003dTrue),"},{"line_number":42,"context_line":"        \u0027timestamp\u0027: fields.DateTimeField(nullable\u003dFalse),"},{"line_number":43,"context_line":"        # This will be the stevedore extension full class name"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_0f63c11b","line":40,"in_reply_to":"da85f559_809fc04f","updated":"2015-11-14 00:18:50.000000000","message":"Ryan,\nMy first stab on this is as follows -\n1. In this particular case, the change in version 1.2 is only applicable at the reader end, i.e. scheduler. Only way 1.2 can prevent it by sending value \u003d value * 100, which will break, as follows -\n    - The value won\u0027t be normalized as [0,1], which is the expectation of the framework.\n   - The value would not be perfect, as there is still going to be round offs.\n2. If the reader is at 1.2, there is no change required.\n\nSo, IMHO, we are good without any change for compatibility as of now.\n\nI will still wait for suggestions from Dan and others.","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"416c75a7e8aec77726a44b46e11137c63970a7b4","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    fields \u003d {"},{"line_number":39,"context_line":"        \u0027name\u0027: fields.MonitorMetricTypeField(nullable\u003dFalse),"},{"line_number":40,"context_line":"        \u0027value\u0027: fields.FloatField(nullable\u003dFalse),"},{"line_number":41,"context_line":"        \u0027numa_membw_values\u0027: fields.DictOfIntegersField(nullable\u003dTrue),"},{"line_number":42,"context_line":"        \u0027timestamp\u0027: fields.DateTimeField(nullable\u003dFalse),"},{"line_number":43,"context_line":"        # This will be the stevedore extension full class name"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_1161ecd3","line":40,"in_reply_to":"da85f559_e29e1462","updated":"2015-11-12 19:21:30.000000000","message":"@Ryan,\nThanks for catching this. I will bump the version.\n\nThe issue was in while reading it from the DB in the scheduler. What kind of compatibility logic are you suggesting?","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"e8d6e76d2c741caf67a745615fff5a5c4409db07","unresolved":false,"context_lines":[{"line_number":66,"context_line":""},{"line_number":67,"context_line":"        if self.obj_attr_is_set(\u0027value\u0027):"},{"line_number":68,"context_line":"            if self.name in FIELDS_REQUIRING_CONVERSION:"},{"line_number":69,"context_line":"                dict_to_return[\u0027value\u0027] \u003d self.value / 100.0"},{"line_number":70,"context_line":"            else:"},{"line_number":71,"context_line":"                dict_to_return[\u0027value\u0027] \u003d self.value"},{"line_number":72,"context_line":"        elif self.obj_attr_is_set(\u0027numa_membw_values\u0027):"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_c2bc30bd","line":69,"updated":"2015-11-11 22:19:09.000000000","message":"This seems to be doing the work of converting to [0,1]","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"416c75a7e8aec77726a44b46e11137c63970a7b4","unresolved":false,"context_lines":[{"line_number":66,"context_line":""},{"line_number":67,"context_line":"        if self.obj_attr_is_set(\u0027value\u0027):"},{"line_number":68,"context_line":"            if self.name in FIELDS_REQUIRING_CONVERSION:"},{"line_number":69,"context_line":"                dict_to_return[\u0027value\u0027] \u003d self.value / 100.0"},{"line_number":70,"context_line":"            else:"},{"line_number":71,"context_line":"                dict_to_return[\u0027value\u0027] \u003d self.value"},{"line_number":72,"context_line":"        elif self.obj_attr_is_set(\u0027numa_membw_values\u0027):"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_91a39c00","line":69,"in_reply_to":"da85f559_c2bc30bd","updated":"2015-11-12 19:21:30.000000000","message":"@Ryan,\nThat\u0027s correct!","commit_id":"d5204facaede53df7bf7e3dec69df90b11fa1c97"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"5425c1a07ca9462245fe77f81f3cf73157108681","unresolved":false,"context_lines":[{"line_number":86,"context_line":"    }"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    @classmethod"},{"line_number":89,"context_line":"    def from_json(cls, metrics):"},{"line_number":90,"context_line":"        \"\"\"Converts a legacy json object into a list of MonitorMetric objs"},{"line_number":91,"context_line":"        and finally returns of MonitorMetricList"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        :param metrics: a string of json serialized objects"},{"line_number":94,"context_line":"        :returns: a MonitorMetricList Object."},{"line_number":95,"context_line":"        \"\"\""},{"line_number":96,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"},{"line_number":97,"context_line":"        metric_list \u003d ["},{"line_number":98,"context_line":"            MonitorMetric(**metric) for metric in metrics]"},{"line_number":99,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":102,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_a1bae8be","side":"PARENT","line":99,"range":{"start_line":89,"start_character":4,"end_line":99,"end_character":53},"updated":"2015-11-21 01:19:01.000000000","message":"A comment on the \"leave it as an int and fix the read\" front:\n\nI think this is the code that\u0027s interpreting data as represented in the database (JSON-formatted value). I think if you were to multiply values of FIELDS_REQUIRING_CONVERSION by 100 when creating the MonitorMetric objects, it might solve the problem.\n\nMore investigation is needed to determine what the expected representation in the ComputeNode metrics field is supposed to be for percentages (float or int?). If it\u0027s expected to be float, then we definitely should be multiplying to an int when we create the objects.\n\nThis is based on what you said earlier if the problem originates in update_from_compute_node:\n\nhttps://github.com/openstack/nova/blob/d0f06c7/nova/scheduler/host_manager.py#L248","commit_id":"855891574144d0c68b2d732d05f7c37fca1b1723"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"66dea70c9046ab194b27ef56bcc6c3127024f20a","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"},{"line_number":97,"context_line":"        metric_list \u003d ["},{"line_number":98,"context_line":"            MonitorMetric(**metric) for metric in metrics]"},{"line_number":99,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":102,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_4dd775bf","side":"PARENT","line":99,"in_reply_to":"ba8a016a_48da2e7a","updated":"2015-11-23 17:25:26.000000000","message":"@Melanie/Joe,\nAFAIK, the value is intentionally kept to be normalized as [0,1] - which must be a Float. Even otherwise for CPU percentage, making it Integer would be losing a degree of accuracy, unless you want to multiply/divide by 1000 or more! Also, keeping the representation of a parameter consistent across system is more desirable.e.g. if it were to be kept as Int, why we are not doing the same in the text form in DB?\n\nIf the type of a value is inherently a float, I do not understand the reasoning behind keeping it Integer and writing juggling code around that. I find multiplying by 100 would be yet another hack.\n\nLet me know, your opinion further.","commit_id":"855891574144d0c68b2d732d05f7c37fca1b1723"},{"author":{"_account_id":7664,"name":"Joe Cropper","email":"jwcroppe@us.ibm.com","username":"jwcroppe"},"change_message_id":"47f0390925302e9c53f1641583f1d9694f7ee75c","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"},{"line_number":97,"context_line":"        metric_list \u003d ["},{"line_number":98,"context_line":"            MonitorMetric(**metric) for metric in metrics]"},{"line_number":99,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":102,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_d861e1a9","side":"PARENT","line":99,"in_reply_to":"ba8a016a_4dd775bf","updated":"2015-11-23 17:33:09.000000000","message":"The data was originally floats in the range [0, 1].  When the new objects were introduced, it was turned into an int and hence some of these issues.\n\nWhen I talked to Jay and Dan about this, we were all comfortable with not being able to represent 22.45% vs. just 22% -- these stats get you close enough for metrics.\n\nAlso, the idea of my original fix was to keep the data going out on the message queue (the compute node metrics update) the same so that downstream consumers (e.g., Ceilometer) didn\u0027t need to start changing the format in which they read the data - this allowed us to keep everything consistent with the \u0027old\u0027 (read: pre-object) behavior.","commit_id":"855891574144d0c68b2d732d05f7c37fca1b1723"},{"author":{"_account_id":7664,"name":"Joe Cropper","email":"jwcroppe@us.ibm.com","username":"jwcroppe"},"change_message_id":"f73df0499629de7e409e5ada2fd5f60d23dbcc4a","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"},{"line_number":97,"context_line":"        metric_list \u003d ["},{"line_number":98,"context_line":"            MonitorMetric(**metric) for metric in metrics]"},{"line_number":99,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":102,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_8cdb061b","side":"PARENT","line":99,"in_reply_to":"ba8a016a_8e31d00d","updated":"2015-11-24 06:29:15.000000000","message":"Dan and I just thought at the time we\u0027d cope with the float\u003c--\u003eint conversions vs. the hack in the object version.  Plus, any non-percent metric isn\u0027t really a float, but rather an int.\n\nTechnically either way would work - I\u0027d probably just make the change in the read as Melanie described and move on.\n\nI think getting Jay or Dan to weigh in here might be useful as well.","commit_id":"855891574144d0c68b2d732d05f7c37fca1b1723"},{"author":{"_account_id":7664,"name":"Joe Cropper","email":"jwcroppe@us.ibm.com","username":"jwcroppe"},"change_message_id":"5b44435549dd63317432dd4fbb8b90a90d9601d9","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"},{"line_number":97,"context_line":"        metric_list \u003d ["},{"line_number":98,"context_line":"            MonitorMetric(**metric) for metric in metrics]"},{"line_number":99,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":102,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_48da2e7a","side":"PARENT","line":99,"in_reply_to":"ba8a016a_a1bae8be","updated":"2015-11-22 17:14:01.000000000","message":"Right, this is what I was talking about.  Why can\u0027t we just leave everything as is and just multiply by 100 here for the select fields as Melanie suggested.  Then we convert the internal float representation (which is by design/for compatibility with the pre-object metrics) in the DB back to an integer, and we avoid the need to bump the objection version too.\n\nFWIW, I should have caught this when I did my first change on the original patch - but I was only (at the time) looking at the values up to the point of getting into the database/sent via the message queue.","commit_id":"855891574144d0c68b2d732d05f7c37fca1b1723"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"0bf3393aa00300f8280e1c683618d22326f6567e","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        metrics \u003d jsonutils.loads(metrics) if metrics else []"},{"line_number":97,"context_line":"        metric_list \u003d ["},{"line_number":98,"context_line":"            MonitorMetric(**metric) for metric in metrics]"},{"line_number":99,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":102,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_8e31d00d","side":"PARENT","line":99,"in_reply_to":"ba8a016a_d861e1a9","updated":"2015-11-23 19:18:13.000000000","message":"@Joe,\nAs you also mention that the issue was turning into \u0027int\u0027. I am wondering what was the reason not to restore it or fix it? As we agree here that MonitorMetric-object code is the one which introduced the bug, I am not sure why the aim was to make it happy with the pre-object code. IMHO, we should just fix the MonitorMetric-object code.\n\nIf Ceilometer reads it directly from DB - Then it won\u0027t experience the issue. But the code[1] reads using the object\u0027s field definition and hence the issue seen in monitor_metric_filter.\n\n[1] - https://github.com/openstack/nova/blob/d0f06c7/nova/scheduler/host_manager.py#L248","commit_id":"855891574144d0c68b2d732d05f7c37fca1b1723"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"5425c1a07ca9462245fe77f81f3cf73157108681","unresolved":false,"context_lines":[{"line_number":41,"context_line":"                                                       target_version)"},{"line_number":42,"context_line":"        target_version \u003d utils.convert_version_to_tuple(target_version)"},{"line_number":43,"context_line":"        if target_version \u003c (1, 2):"},{"line_number":44,"context_line":"            primitive[\u0027value\u0027] \u003d int(primitive[\u0027value\u0027])"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":47,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_a1cbc81d","line":44,"updated":"2015-11-21 01:19:01.000000000","message":"I think you\u0027ll have to multiply by 100 before converting to int, if the float is going to be [0, 1]","commit_id":"fcf0968806447b8657d2536dc7947f2f0beb6b4f"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"66dea70c9046ab194b27ef56bcc6c3127024f20a","unresolved":false,"context_lines":[{"line_number":41,"context_line":"                                                       target_version)"},{"line_number":42,"context_line":"        target_version \u003d utils.convert_version_to_tuple(target_version)"},{"line_number":43,"context_line":"        if target_version \u003c (1, 2):"},{"line_number":44,"context_line":"            primitive[\u0027value\u0027] \u003d int(primitive[\u0027value\u0027])"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"},{"line_number":47,"context_line":"    # format expected by the RPC notifier for metrics events."}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_6744d873","line":44,"in_reply_to":"ba8a016a_a1cbc81d","updated":"2015-11-23 17:25:26.000000000","message":"@Melanie,\nAt present, due to the bug, the value would be read as 0, which still satisfies the condition on range [0,1]\nMultiplying by 100, under this upgrade scenario might lead to some other bug, as the value would out of range.\nI was trying to keep the compat-code compatible with existing behavior/bug :)","commit_id":"fcf0968806447b8657d2536dc7947f2f0beb6b4f"},{"author":{"_account_id":7664,"name":"Joe Cropper","email":"jwcroppe@us.ibm.com","username":"jwcroppe"},"change_message_id":"804658136fdd9423bcad28b90993e769a404b976","unresolved":false,"context_lines":[{"line_number":80,"context_line":"    # Version 1.0: Initial version"},{"line_number":81,"context_line":"    # Version 1.1: MonitorMetric version 1.1"},{"line_number":82,"context_line":"    # Version 1.2: Metric conversion with multiplication by 100 in from_json"},{"line_number":83,"context_line":"    VERSION \u003d \u00271.2\u0027"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    fields \u003d {"},{"line_number":86,"context_line":"        \u0027objects\u0027: fields.ListOfObjectsField(\u0027MonitorMetric\u0027),"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_61834f57","line":83,"updated":"2015-11-26 07:19:43.000000000","message":"Do we really need a version bump for this?  I would check with Dan Smith, but it seems that this doesn\u0027t really break the compatibility at all since the metrics were still ints, albeit always 0?","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"df9227219ceff92ead49a605282a5a2e48cd1938","unresolved":false,"context_lines":[{"line_number":80,"context_line":"    # Version 1.0: Initial version"},{"line_number":81,"context_line":"    # Version 1.1: MonitorMetric version 1.1"},{"line_number":82,"context_line":"    # Version 1.2: Metric conversion with multiplication by 100 in from_json"},{"line_number":83,"context_line":"    VERSION \u003d \u00271.2\u0027"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    fields \u003d {"},{"line_number":86,"context_line":"        \u0027objects\u0027: fields.ListOfObjectsField(\u0027MonitorMetric\u0027),"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_b5cd565f","line":83,"in_reply_to":"9a8ffd7b_097d3de7","updated":"2015-11-30 18:17:43.000000000","message":"Done","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"df9227219ceff92ead49a605282a5a2e48cd1938","unresolved":false,"context_lines":[{"line_number":80,"context_line":"    # Version 1.0: Initial version"},{"line_number":81,"context_line":"    # Version 1.1: MonitorMetric version 1.1"},{"line_number":82,"context_line":"    # Version 1.2: Metric conversion with multiplication by 100 in from_json"},{"line_number":83,"context_line":"    VERSION \u003d \u00271.2\u0027"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    fields \u003d {"},{"line_number":86,"context_line":"        \u0027objects\u0027: fields.ListOfObjectsField(\u0027MonitorMetric\u0027),"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_f5eafeab","line":83,"in_reply_to":"9a8ffd7b_61834f57","updated":"2015-11-30 18:17:43.000000000","message":"Done","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":11803,"name":"Ryan Rossiter","email":"rlrossit@us.ibm.com","username":"rlrossiter"},"change_message_id":"899abe3fe688fe10641c31fa2a3db6b23e737392","unresolved":false,"context_lines":[{"line_number":80,"context_line":"    # Version 1.0: Initial version"},{"line_number":81,"context_line":"    # Version 1.1: MonitorMetric version 1.1"},{"line_number":82,"context_line":"    # Version 1.2: Metric conversion with multiplication by 100 in from_json"},{"line_number":83,"context_line":"    VERSION \u003d \u00271.2\u0027"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    fields \u003d {"},{"line_number":86,"context_line":"        \u0027objects\u0027: fields.ListOfObjectsField(\u0027MonitorMetric\u0027),"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_097d3de7","line":83,"in_reply_to":"9a8ffd7b_61834f57","updated":"2015-11-30 14:35:39.000000000","message":"You are correct, nothing exposed over RPC has changed, so no version bump is needed.","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":7664,"name":"Joe Cropper","email":"jwcroppe@us.ibm.com","username":"jwcroppe"},"change_message_id":"804658136fdd9423bcad28b90993e769a404b976","unresolved":false,"context_lines":[{"line_number":99,"context_line":"        # NOTE(suro-patz): While instantiating the MonitorMetric() from"},{"line_number":100,"context_line":"        #                  JSON-ified string, we need to re-convert the"},{"line_number":101,"context_line":"        #                  normalized metrics to avoid truncation to 0 by"},{"line_number":102,"context_line":"        #                  typecasting into an integer.."},{"line_number":103,"context_line":"        for metric in metrics:"},{"line_number":104,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":105,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_4172cbae","line":102,"updated":"2015-11-26 07:19:43.000000000","message":"Nit: extra period at end.","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"df9227219ceff92ead49a605282a5a2e48cd1938","unresolved":false,"context_lines":[{"line_number":99,"context_line":"        # NOTE(suro-patz): While instantiating the MonitorMetric() from"},{"line_number":100,"context_line":"        #                  JSON-ified string, we need to re-convert the"},{"line_number":101,"context_line":"        #                  normalized metrics to avoid truncation to 0 by"},{"line_number":102,"context_line":"        #                  typecasting into an integer.."},{"line_number":103,"context_line":"        for metric in metrics:"},{"line_number":104,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":105,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_55daea18","line":102,"in_reply_to":"9a8ffd7b_4172cbae","updated":"2015-11-30 18:17:43.000000000","message":"Done","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":7664,"name":"Joe Cropper","email":"jwcroppe@us.ibm.com","username":"jwcroppe"},"change_message_id":"804658136fdd9423bcad28b90993e769a404b976","unresolved":false,"context_lines":[{"line_number":103,"context_line":"        for metric in metrics:"},{"line_number":104,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":105,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":106,"context_line":"                if metric[\u0027value\u0027] \u003e\u003d 0 and metric[\u0027value\u0027] \u003c\u003d 1:"},{"line_number":107,"context_line":"                    metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        metric_list \u003d ["}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_c1e31b32","line":106,"updated":"2015-11-26 07:19:43.000000000","message":"Why do we need this check?","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"df9227219ceff92ead49a605282a5a2e48cd1938","unresolved":false,"context_lines":[{"line_number":103,"context_line":"        for metric in metrics:"},{"line_number":104,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":105,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":106,"context_line":"                if metric[\u0027value\u0027] \u003e\u003d 0 and metric[\u0027value\u0027] \u003c\u003d 1:"},{"line_number":107,"context_line":"                    metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        metric_list \u003d ["}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_f5019e6b","line":106,"in_reply_to":"9a8ffd7b_c1e31b32","updated":"2015-11-30 18:17:43.000000000","message":"@Joe,\nI agree this is a paranoid check! I will remove the same - thanks for catching.","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":7664,"name":"Joe Cropper","email":"jwcroppe@us.ibm.com","username":"jwcroppe"},"change_message_id":"804658136fdd9423bcad28b90993e769a404b976","unresolved":false,"context_lines":[{"line_number":104,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":105,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":106,"context_line":"                if metric[\u0027value\u0027] \u003e\u003d 0 and metric[\u0027value\u0027] \u003c\u003d 1:"},{"line_number":107,"context_line":"                    metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        metric_list \u003d ["},{"line_number":110,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_81ed1327","line":107,"updated":"2015-11-26 07:19:43.000000000","message":"I assume the explicit cast to int() isn\u0027t needed since the object code handles it?","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"df9227219ceff92ead49a605282a5a2e48cd1938","unresolved":false,"context_lines":[{"line_number":104,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":105,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":106,"context_line":"                if metric[\u0027value\u0027] \u003e\u003d 0 and metric[\u0027value\u0027] \u003c\u003d 1:"},{"line_number":107,"context_line":"                    metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        metric_list \u003d ["},{"line_number":110,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a8ffd7b_352f26f8","line":107,"in_reply_to":"9a8ffd7b_81ed1327","updated":"2015-11-30 18:17:43.000000000","message":"@Joe,\nYes, explicit cast is not required.","commit_id":"b7d7c60e2ba172d7062fb0bc464008461ef67c7a"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"afadf311ecb9c8946116c87a71b88f59a570f07f","unresolved":false,"context_lines":[{"line_number":100,"context_line":"        #                  normalized metrics to avoid truncation to 0 by"},{"line_number":101,"context_line":"        #                  typecasting into an integer."},{"line_number":102,"context_line":"        for metric in metrics:"},{"line_number":103,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":104,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":105,"context_line":"                metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":106,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"9a8ffd7b_51af5094","line":103,"updated":"2015-12-01 00:45:48.000000000","message":"FYI I think you don\u0027t need metric.keys(), \u0027if k in dict\u0027 is a standard way to check if a key is in a dict.\n\nAlso, we avoid backslash line continuation [1], you can use parens to continue lines.\n\n[1] http://docs.openstack.org/developer/hacking/#general","commit_id":"da94c01986b0ff70fac8986b8260ed8062fd2284"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"8d6f5e54b5180a059643bab021e40c4675754e4b","unresolved":false,"context_lines":[{"line_number":100,"context_line":"        #                  normalized metrics to avoid truncation to 0 by"},{"line_number":101,"context_line":"        #                  typecasting into an integer."},{"line_number":102,"context_line":"        for metric in metrics:"},{"line_number":103,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":104,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":105,"context_line":"                metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":106,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7a740942_8899dd70","line":103,"in_reply_to":"9a8ffd7b_51af5094","updated":"2015-12-04 23:16:29.000000000","message":"Done","commit_id":"da94c01986b0ff70fac8986b8260ed8062fd2284"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"afadf311ecb9c8946116c87a71b88f59a570f07f","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        for metric in metrics:"},{"line_number":103,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":104,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":105,"context_line":"                metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        metric_list \u003d ["},{"line_number":108,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a8ffd7b_718e1429","line":105,"updated":"2015-12-01 00:45:48.000000000","message":"Here, you should indent the line to make it apparent it\u0027s not part of the line continuation from L104 [2]\n\n[2] https://www.python.org/dev/peps/pep-0008/#indentation","commit_id":"da94c01986b0ff70fac8986b8260ed8062fd2284"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"8d6f5e54b5180a059643bab021e40c4675754e4b","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        for metric in metrics:"},{"line_number":103,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":104,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":105,"context_line":"                metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        metric_list \u003d ["},{"line_number":108,"context_line":"            MonitorMetric(**metric) for metric in metrics]"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a740942_a89cd95d","line":105,"in_reply_to":"9a8ffd7b_718e1429","updated":"2015-12-04 23:16:29.000000000","message":"Done","commit_id":"da94c01986b0ff70fac8986b8260ed8062fd2284"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"afadf311ecb9c8946116c87a71b88f59a570f07f","unresolved":false,"context_lines":[{"line_number":99,"context_line":"        #                  JSON-ified string, we need to re-convert the"},{"line_number":100,"context_line":"        #                  normalized metrics to avoid truncation to 0 by"},{"line_number":101,"context_line":"        #                  typecasting into an integer."},{"line_number":102,"context_line":"        for metric in metrics:"},{"line_number":103,"context_line":"            if \u0027value\u0027 in metric.keys() and\\"},{"line_number":104,"context_line":"                metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:"},{"line_number":105,"context_line":"                metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        metric_list \u003d ["},{"line_number":108,"context_line":"            MonitorMetric(**metric) for metric in metrics]"},{"line_number":109,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a8ffd7b_317bac7d","line":108,"range":{"start_line":102,"start_character":8,"end_line":108,"end_character":58},"updated":"2015-12-01 00:45:48.000000000","message":"This is going to iterate across the metrics twice unnecessarily. I think it would be good to iterate once, check and convert if needed, and append to the metric_list, for example:\n\n metric_list \u003d []\n for metric in metrics:\n     if \u0027value\u0027 in metric and metric[\u0027name\u0027] in FIELDS_REQUIRING_CONVERSION:\n         metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100\n     metric_list.append(MonitorMetric(**metric))","commit_id":"da94c01986b0ff70fac8986b8260ed8062fd2284"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"8d6f5e54b5180a059643bab021e40c4675754e4b","unresolved":false,"context_lines":[{"line_number":105,"context_line":"                metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        metric_list \u003d ["},{"line_number":108,"context_line":"            MonitorMetric(**metric) for metric in metrics]"},{"line_number":109,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"    # NOTE(jaypipes): This method exists to convert the object to the"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a740942_689fd150","line":108,"in_reply_to":"9a8ffd7b_317bac7d","updated":"2015-12-04 23:16:29.000000000","message":"Done","commit_id":"da94c01986b0ff70fac8986b8260ed8062fd2284"},{"author":{"_account_id":8688,"name":"Alexis Lee","email":"openstack@lxsli.co.uk","username":"lxsli"},"change_message_id":"2e4f12e6a020813719739656eda77f3f71964fa6","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        for metric in metrics:"},{"line_number":103,"context_line":"            if (\u0027value\u0027 in metric and metric[\u0027name\u0027] in"},{"line_number":104,"context_line":"                                      FIELDS_REQUIRING_CONVERSION):"},{"line_number":105,"context_line":"                metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":106,"context_line":"            metric_list.append(MonitorMetric(**metric))"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a740942_c244f21c","line":105,"updated":"2015-12-09 12:21:54.000000000","message":"can we add an extra 0 here? I know not many people will care between 99% and 99.9% CPU usage but this feels like an easy and cheap thing to do now which will be harder to fix later.","commit_id":"ddb3c4e26f3a908de7836a8fac48360afa6aa1d7"},{"author":{"_account_id":7664,"name":"Joe Cropper","email":"jwcroppe@us.ibm.com","username":"jwcroppe"},"change_message_id":"a8479857708a4638273012da6f817dee7906c673","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        for metric in metrics:"},{"line_number":103,"context_line":"            if (\u0027value\u0027 in metric and metric[\u0027name\u0027] in"},{"line_number":104,"context_line":"                                      FIELDS_REQUIRING_CONVERSION):"},{"line_number":105,"context_line":"                metric[\u0027value\u0027] \u003d metric[\u0027value\u0027] * 100"},{"line_number":106,"context_line":"            metric_list.append(MonitorMetric(**metric))"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        return MonitorMetricList(objects\u003dmetric_list)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a740942_08daf478","line":105,"in_reply_to":"7a740942_c244f21c","updated":"2015-12-10 02:58:12.000000000","message":"Dan Smith and I talked about this when I made the original change to * 100 and we felt that was sufficient for the \u0027general purpose\u0027 metric interface that this provides.\n\nAs you said, the difference between 2.55% and 2/% is effectively nil for almost any use case and adds an element of confusion when reading the data, so we just decided to stick with * 100.","commit_id":"ddb3c4e26f3a908de7836a8fac48360afa6aa1d7"}],"nova/tests/unit/objects/test_monitor_metric.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"afadf311ecb9c8946116c87a71b88f59a570f07f","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        spec_list \u003d [_monitor_metric_spec, _monitor_metric_perc_spec]"},{"line_number":79,"context_line":"        metrics \u003d objects.MonitorMetricList.from_json("},{"line_number":80,"context_line":"            jsonutils.dumps(spec_list))"},{"line_number":81,"context_line":"        self.assertEqual(metrics[1].value,"},{"line_number":82,"context_line":"                         _monitor_metric_perc_spec[\u0027value\u0027] * 100)"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"class TestMonitorMetricObject(test_objects._LocalTest,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a8ffd7b_2e110b5e","line":82,"range":{"start_line":81,"start_character":8,"end_line":82,"end_character":66},"updated":"2015-12-01 00:45:48.000000000","message":"Since you have a list, you should verify all items in the list. Also, usual convention is assertEqual(expected, actual):\n\n for metric in metrics:\n     self.assertEqual(_monitor_metric_perc_spec[\u0027value\u0027] * 100,\n                      metric.value)","commit_id":"da94c01986b0ff70fac8986b8260ed8062fd2284"},{"author":{"_account_id":15311,"name":"Surojit Pathak","email":"surojit.pathak@gmail.com","username":"suropathak"},"change_message_id":"8d6f5e54b5180a059643bab021e40c4675754e4b","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        metrics \u003d objects.MonitorMetricList.from_json("},{"line_number":80,"context_line":"            jsonutils.dumps(spec_list))"},{"line_number":81,"context_line":"        self.assertEqual(metrics[1].value,"},{"line_number":82,"context_line":"                         _monitor_metric_perc_spec[\u0027value\u0027] * 100)"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"class TestMonitorMetricObject(test_objects._LocalTest,"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a740942_a8ea99aa","line":82,"in_reply_to":"9a8ffd7b_2e110b5e","updated":"2015-12-04 23:16:29.000000000","message":"@Melanie,\nI understand the comment. \nI guess you meant accessing spec_list instead of _monitor_metric_perc_spec in the loop.","commit_id":"da94c01986b0ff70fac8986b8260ed8062fd2284"}]}
