)]}'
{"monasca_api/tests/test_validation.py":[{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"3d0e67211950e6065e51df07ba4e925b9447f71d","unresolved":false,"context_lines":[{"line_number":22,"context_line":"class TestMetricNameValidation(unittest.TestCase):"},{"line_number":23,"context_line":"    def test_valid_name(self):"},{"line_number":24,"context_line":"        metric_name \u003d \"this.is_a.valid_name\""},{"line_number":25,"context_line":"        validation.metric_name(metric_name)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"    def test_nonstring_name(self):"},{"line_number":28,"context_line":"        metric_name \u003d 123456789"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a41bdd9_5d4c0142","line":25,"updated":"2015-07-13 17:52:52.000000000","message":"This needs to assert something to verify that success happened.","commit_id":"6d564e76cc80763557ce4b7b35a611253010702a"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"3d0e67211950e6065e51df07ba4e925b9447f71d","unresolved":false,"context_lines":[{"line_number":44,"context_line":"class TestDimensionValidation(unittest.TestCase):"},{"line_number":45,"context_line":"    def test_valid_key(self):"},{"line_number":46,"context_line":"        dim_key \u003d \"this.is_a.valid_key\""},{"line_number":47,"context_line":"        validation.dimension_key(dim_key)"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    def test_nonstring_key(self):"},{"line_number":50,"context_line":"        dim_key \u003d 123456"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a41bdd9_dd37b1ae","line":47,"updated":"2015-07-13 17:52:52.000000000","message":"This needs to assert something to verify that success happened.","commit_id":"6d564e76cc80763557ce4b7b35a611253010702a"}],"monasca_api/v2/common/validation.py":[{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"dbf6d60c0ea9201c1cb52ba89f4a83d469a0ff8a","unresolved":false,"context_lines":[{"line_number":15,"context_line":"import re"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"invalid_chars \u003d \"\u003c\u003e\u003d{}(),\u0027\\\"\\\\\\\\;\u0026\""},{"line_number":18,"context_line":"restricted_chars \u003d re.compile(\".*[\" + invalid_chars + \"].*\")"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_metric_name(name):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_dd027a3e","line":18,"updated":"2015-07-13 04:41:01.000000000","message":"That expression is overly broad.  There\u0027s no need to use .* on either end of the invalid_chars set when we should be able to use re.search with just the invalid_chars.  I put together a small test for it and it looks like using re.search vs re.match with your expression is about twice as fast.","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"1b91054a73dae7dd86a4ca92aa50b3cf717101ed","unresolved":false,"context_lines":[{"line_number":15,"context_line":"import re"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"invalid_chars \u003d \"\u003c\u003e\u003d{}(),\u0027\\\"\\\\\\\\;\u0026\""},{"line_number":18,"context_line":"restricted_chars \u003d re.compile(\".*[\" + invalid_chars + \"].*\")"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_metric_name(name):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_23024d70","line":18,"in_reply_to":"9a41bdd9_dd027a3e","updated":"2015-07-13 17:47:02.000000000","message":"Done","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"ad3c0bffbbe67e86ee855cd12afd195336b0a8db","unresolved":false,"context_lines":[{"line_number":18,"context_line":"restricted_chars \u003d re.compile(\".*[\" + invalid_chars + \"].*\")"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_metric_name(name):"},{"line_number":22,"context_line":"    assert isinstance(name, (str, unicode)), \"Name must be a string\""},{"line_number":23,"context_line":"    assert len(name) \u003c\u003d 255, \"Name must be 64 characters or less\""},{"line_number":24,"context_line":"    assert not restricted_chars.match(name), \"Invalid characters in metric name \" + name"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_78e9fc19","line":21,"updated":"2015-07-13 04:57:22.000000000","message":"If we\u0027re already inside the validation file do we need to preface everything in here with validate_?  When we import this we\u0027re using it as validation.validate_metric_name.  Could we use something like validation.metric_name or validate.metric_name instead?","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"1b91054a73dae7dd86a4ca92aa50b3cf717101ed","unresolved":false,"context_lines":[{"line_number":18,"context_line":"restricted_chars \u003d re.compile(\".*[\" + invalid_chars + \"].*\")"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_metric_name(name):"},{"line_number":22,"context_line":"    assert isinstance(name, (str, unicode)), \"Name must be a string\""},{"line_number":23,"context_line":"    assert len(name) \u003c\u003d 255, \"Name must be 64 characters or less\""},{"line_number":24,"context_line":"    assert not restricted_chars.match(name), \"Invalid characters in metric name \" + name"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_a3ee5db2","line":21,"in_reply_to":"9a41bdd9_78e9fc19","updated":"2015-07-13 17:47:02.000000000","message":"Done","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"dbf6d60c0ea9201c1cb52ba89f4a83d469a0ff8a","unresolved":false,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_metric_name(name):"},{"line_number":22,"context_line":"    assert isinstance(name, (str, unicode)), \"Name must be a string\""},{"line_number":23,"context_line":"    assert len(name) \u003c\u003d 255, \"Name must be 64 characters or less\""},{"line_number":24,"context_line":"    assert not restricted_chars.match(name), \"Invalid characters in metric name \" + name"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_7d9a4e16","line":23,"updated":"2015-07-13 04:41:01.000000000","message":"Is name supposed to be 255 or 64 characters?","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"1b91054a73dae7dd86a4ca92aa50b3cf717101ed","unresolved":false,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_metric_name(name):"},{"line_number":22,"context_line":"    assert isinstance(name, (str, unicode)), \"Name must be a string\""},{"line_number":23,"context_line":"    assert len(name) \u003c\u003d 255, \"Name must be 64 characters or less\""},{"line_number":24,"context_line":"    assert not restricted_chars.match(name), \"Invalid characters in metric name \" + name"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_e3222501","line":23,"in_reply_to":"9a41bdd9_7d9a4e16","updated":"2015-07-13 17:47:02.000000000","message":"Done","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"dbf6d60c0ea9201c1cb52ba89f4a83d469a0ff8a","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"def validate_dimension_value(value):"},{"line_number":34,"context_line":"    assert isinstance(value, (str, unicode, int, float)), \"Dimension value must be a string or number\".format(value)"},{"line_number":35,"context_line":"    assert len(str(value)) \u003c\u003d 255, \"Dimension value must be 255 characters or less\""},{"line_number":36,"context_line":"    assert not restricted_chars.match(value), \"Invalid characters in dimension value \" + value"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_1d6d4204","line":34,"updated":"2015-07-13 04:41:01.000000000","message":"The assertion this is replacing and the voluptuous schema that was there before only allowed dimension values to be str or unicode.  Are they supposed to allow int and floats as well?","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"1b91054a73dae7dd86a4ca92aa50b3cf717101ed","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"def validate_dimension_value(value):"},{"line_number":34,"context_line":"    assert isinstance(value, (str, unicode, int, float)), \"Dimension value must be a string or number\".format(value)"},{"line_number":35,"context_line":"    assert len(str(value)) \u003c\u003d 255, \"Dimension value must be 255 characters or less\""},{"line_number":36,"context_line":"    assert not restricted_chars.match(value), \"Invalid characters in dimension value \" + value"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_764a51c7","line":34,"in_reply_to":"9a41bdd9_1d6d4204","updated":"2015-07-13 17:47:02.000000000","message":"As far as I know, numbers are valid dimension values. Without allowing this (or converting to strings before calling validation), we are currently rejecting metrics which the java API accepts.","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"}],"monasca_api/v2/reference/metrics.py":[{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"dbf6d60c0ea9201c1cb52ba89f4a83d469a0ff8a","unresolved":false,"context_lines":[{"line_number":81,"context_line":"            raise falcon.HTTPBadRequest(\u0027Bad request\u0027, ex.message)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def _validate_single_metric(self, metric):"},{"line_number":84,"context_line":"        validation.validate_metric_name(metric[\u0027name\u0027])"},{"line_number":85,"context_line":"        assert isinstance(metric[\u0027timestamp\u0027], (int, float)), \"Timestamp must be a number\""},{"line_number":86,"context_line":"        assert isinstance(metric[\u0027value\u0027], (int, long, float, complex)), \"Value must be a number\""},{"line_number":87,"context_line":"        if \"dimensions\" in metric:"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a41bdd9_7d36ce04","line":84,"updated":"2015-07-13 04:41:01.000000000","message":"We need to check and see how much of a performance hit we\u0027re going to be taking here, if any at all, with the extra stack frames we\u0027re introducing.","commit_id":"2a8c6ac7f9516505179ea6eeb8b254a4bfc5198d"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4ce43a30240383d86fadf55814e2e9950e7f31cc","unresolved":false,"context_lines":[{"line_number":88,"context_line":"            for dimension_key in metric[\u0027dimensions\u0027]:"},{"line_number":89,"context_line":"                dimension_value \u003d metric[\u0027dimensions\u0027][dimension_key]"},{"line_number":90,"context_line":"                validation.dimension_key(dimension_key)"},{"line_number":91,"context_line":"                if type(dimension_value) is not str:"},{"line_number":92,"context_line":"                    dimension_value \u003d str(dimension_value)"},{"line_number":93,"context_line":"                    LOG.warn(\"Converting dimension value to string \u0027{}\u0027\".format(dimension_value))"},{"line_number":94,"context_line":"                validation.dimension_value(dimension_value)"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a41bdd9_c8d11f59","line":91,"updated":"2015-07-14 02:47:18.000000000","message":"We shouldn\u0027t be using the type function here.  We should use the isinstance function like we do in the validation.  We also need to check if the type is str or unicode since we don\u0027t want to do any casting if it\u0027s already a valid unicode type.","commit_id":"bbdd2d768d441719bc604baff9b273e3b0ddf2d4"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"eeffd249536af6f7e5c8a7825ee551cb3858fe9c","unresolved":false,"context_lines":[{"line_number":88,"context_line":"            for dimension_key in metric[\u0027dimensions\u0027]:"},{"line_number":89,"context_line":"                dimension_value \u003d metric[\u0027dimensions\u0027][dimension_key]"},{"line_number":90,"context_line":"                validation.dimension_key(dimension_key)"},{"line_number":91,"context_line":"                if type(dimension_value) is not str:"},{"line_number":92,"context_line":"                    dimension_value \u003d str(dimension_value)"},{"line_number":93,"context_line":"                    LOG.warn(\"Converting dimension value to string \u0027{}\u0027\".format(dimension_value))"},{"line_number":94,"context_line":"                validation.dimension_value(dimension_value)"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a41bdd9_32233ea9","line":91,"in_reply_to":"9a41bdd9_c8d11f59","updated":"2015-07-14 14:05:00.000000000","message":"Done","commit_id":"bbdd2d768d441719bc604baff9b273e3b0ddf2d4"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"4ce43a30240383d86fadf55814e2e9950e7f31cc","unresolved":false,"context_lines":[{"line_number":89,"context_line":"                dimension_value \u003d metric[\u0027dimensions\u0027][dimension_key]"},{"line_number":90,"context_line":"                validation.dimension_key(dimension_key)"},{"line_number":91,"context_line":"                if type(dimension_value) is not str:"},{"line_number":92,"context_line":"                    dimension_value \u003d str(dimension_value)"},{"line_number":93,"context_line":"                    LOG.warn(\"Converting dimension value to string \u0027{}\u0027\".format(dimension_value))"},{"line_number":94,"context_line":"                validation.dimension_value(dimension_value)"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a41bdd9_285f6b0f","line":92,"updated":"2015-07-14 02:47:18.000000000","message":"This will probably do the right thing with dimension_value given how Python uses object references but it might be a good idea to explicitly set metric[\u0027dimensions\u0027][dimension_key] back to dimension_value after the cast.\n\nAlong with that we can remove the type check in validation.dimension_value since we\u0027re manually casting to a string here.","commit_id":"bbdd2d768d441719bc604baff9b273e3b0ddf2d4"},{"author":{"_account_id":14517,"name":"Ryan Brandt","email":"ryan.brandt@hpe.com","username":"ryan-brandt"},"change_message_id":"eeffd249536af6f7e5c8a7825ee551cb3858fe9c","unresolved":false,"context_lines":[{"line_number":89,"context_line":"                dimension_value \u003d metric[\u0027dimensions\u0027][dimension_key]"},{"line_number":90,"context_line":"                validation.dimension_key(dimension_key)"},{"line_number":91,"context_line":"                if type(dimension_value) is not str:"},{"line_number":92,"context_line":"                    dimension_value \u003d str(dimension_value)"},{"line_number":93,"context_line":"                    LOG.warn(\"Converting dimension value to string \u0027{}\u0027\".format(dimension_value))"},{"line_number":94,"context_line":"                validation.dimension_value(dimension_value)"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a41bdd9_8fa8e521","line":92,"in_reply_to":"9a41bdd9_285f6b0f","updated":"2015-07-14 14:05:00.000000000","message":"First part, done, but the type check in validation.dimension_value may be used by other components.","commit_id":"bbdd2d768d441719bc604baff9b273e3b0ddf2d4"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"34b5e43326ca5a5a7481545946a16286c1ae47a5","unresolved":false,"context_lines":[{"line_number":89,"context_line":"                dimension_value \u003d metric[\u0027dimensions\u0027][dimension_key]"},{"line_number":90,"context_line":"                validation.dimension_key(dimension_key)"},{"line_number":91,"context_line":"                if type(dimension_value) is not str:"},{"line_number":92,"context_line":"                    dimension_value \u003d str(dimension_value)"},{"line_number":93,"context_line":"                    LOG.warn(\"Converting dimension value to string \u0027{}\u0027\".format(dimension_value))"},{"line_number":94,"context_line":"                validation.dimension_value(dimension_value)"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a41bdd9_9e56d128","line":92,"in_reply_to":"9a41bdd9_8fa8e521","updated":"2015-07-14 15:18:53.000000000","message":"Any other part that cares about the type should also be converting it to str as well, right?  We don\u0027t want some part of the API accepting non-string values and other parts rejecting it.","commit_id":"bbdd2d768d441719bc604baff9b273e3b0ddf2d4"}]}
