)]}'
{"monasca_agent/collector/checks_d/memory.py":[{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"5e3b18de4c4ccff08944ad27350f3b87f9f0c7fd","unresolved":false,"context_lines":[{"line_number":46,"context_line":"                   dimensions\u003ddimensions)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        count \u003d 8"},{"line_number":49,"context_line":"        if hasattr(mem_info, \u0027buffers\u0027):"},{"line_number":50,"context_line":"            self.gauge(\u0027mem.used_buffers\u0027,"},{"line_number":51,"context_line":"                       int(mem_info.buffers / 1048576),"},{"line_number":52,"context_line":"                       dimensions\u003ddimensions)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a1a9d01_6bbb6076","line":49,"updated":"2015-10-02 10:10:17.000000000","message":"That however only tells you if tuple has a key defined but tells nothing about the value. It can happen that key is there (as it is named tupple) but has a false-like value (i.e. empty string or None))\n\nIt would be better to ensure that value is set rather then to check for key existence, because it should be always there according to documentation of psutil.virtual_memory().\n\nSimple test to confirm that:\n\n from collections import namedtuple\n \n Test \u003d namedtuple(\u0027A\u0027, [\u0027a\u0027,\u0027b\u0027,\u0027c\u0027])\n \n test \u003d Test(a\u003d1,b\u003dNone,c\u003d3)\n\n print \u0027b\u0027 in a  # will resolve to False\n print hasattr(a, \u0027b\u0027)  # will resolve to True\n #  however\n print a.b is not None  # will resolve to False","commit_id":"76bc30ca19d3f1c1bdca33582cee4ea26b6b36d8"},{"author":{"_account_id":15799,"name":"Ben Motz","email":"ben.launchpad@ouat.co.uk","username":"bmotz"},"change_message_id":"5c551b4b716ea5a266ab2ed9b388461714fa67db","unresolved":false,"context_lines":[{"line_number":58,"context_line":"                       dimensions\u003ddimensions)"},{"line_number":59,"context_line":"            count +\u003d 1"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        if mem_info.shared:"},{"line_number":62,"context_line":"            self.gauge(\u0027mem.used_shared\u0027,"},{"line_number":63,"context_line":"                       int(mem_info.shared / 1048576),"},{"line_number":64,"context_line":"                       dimensions\u003ddimensions)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a1a9d01_da76b83d","line":61,"updated":"2015-10-05 10:38:54.000000000","message":"On my Linux system, with PSutils 3.0.1, this raises an AttributeError. The documentation (http://pythonhosted.org/psutil/#memory) states that this attribute isn\u0027t supported on Linux.","commit_id":"4526bbe846c96f6d594e2388602a5f34cc8e4a21"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"d0efd13957a6450525c0b4e856c08e8f3c51ef5d","unresolved":false,"context_lines":[{"line_number":58,"context_line":"                       dimensions\u003ddimensions)"},{"line_number":59,"context_line":"            count +\u003d 1"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        if mem_info.shared:"},{"line_number":62,"context_line":"            self.gauge(\u0027mem.used_shared\u0027,"},{"line_number":63,"context_line":"                       int(mem_info.shared / 1048576),"},{"line_number":64,"context_line":"                       dimensions\u003ddimensions)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a1a9d01_f3fc0740","line":61,"in_reply_to":"9a1a9d01_da76b83d","updated":"2015-10-05 12:15:07.000000000","message":"I did not follow that deep into documentation, but if that\u0027s the case lets add hasattr to the current check, that should both support verifying the attribute existence + true-like value.","commit_id":"4526bbe846c96f6d594e2388602a5f34cc8e4a21"},{"author":{"_account_id":18462,"name":"Rahul U Nair","email":"rahulunair@gmail.com","username":"rahulunair"},"change_message_id":"0da5111eeb74a2f2bba43a6410083aa8936545a9","unresolved":false,"context_lines":[{"line_number":58,"context_line":"                       dimensions\u003ddimensions)"},{"line_number":59,"context_line":"            count +\u003d 1"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        if mem_info.shared:"},{"line_number":62,"context_line":"            self.gauge(\u0027mem.used_shared\u0027,"},{"line_number":63,"context_line":"                       int(mem_info.shared / 1048576),"},{"line_number":64,"context_line":"                       dimensions\u003ddimensions)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_19b544ed","line":61,"in_reply_to":"9a1a9d01_f3fc0740","updated":"2015-10-07 00:06:36.000000000","message":"Done","commit_id":"4526bbe846c96f6d594e2388602a5f34cc8e4a21"}]}
