)]}'
{"monasca_common/validation/metric_validation.py":[{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"b7ab7ce1feddec0b0e641c722de789ac7b63a6cc","unresolved":false,"context_lines":[{"line_number":54,"context_line":"class InvalidValueMeta(Exception):"},{"line_number":55,"context_line":"    pass"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"def metric_value_meta(value_meta):"},{"line_number":59,"context_line":"    if len(value_meta) \u003e VALUE_META_MAX_NUMBER:"},{"line_number":60,"context_line":"        msg \u003d \"Too many valueMeta entries {0}, limit is {1}: valueMeta {2}\""}],"source_content_type":"text/x-python","patch_set":1,"id":"1ac06dbe_82e146d3","line":57,"updated":"2016-08-25 02:00:53.000000000","message":"One thing we\u0027re missing here is the entry point function where you can submit a metric and have that function run all the various validations on the metric components.  We don\u0027t want people to have to run these bits and pieces by hand.  In the monasca agent the submit_metric function was our entry point to the validation.  We just need a replacement for that in this new library.","commit_id":"fdb95f2c7df483c006570b72f536cdcda5297c46"}],"monasca_common/validation/metrics.py":[{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"e89c6bd729f51d9cd7515de47dba70eadedf90c9","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        else:"},{"line_number":65,"context_line":"            _validate_single_metric(metrics)"},{"line_number":66,"context_line":"    except Exception as ex:"},{"line_number":67,"context_line":"        raise ex"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"def _validate_single_metric(metric):"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa7ab95a_1f5cbcec","line":67,"range":{"start_line":67,"start_character":8,"end_line":67,"end_character":13},"updated":"2016-08-31 04:44:07.000000000","message":"If we\u0027re just re-raising I don\u0027t think we need the try statement at all.","commit_id":"e1b99b38e07cf213a5f8a1c8ab1bbd684f4657c9"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"c30f945e553258b242d6b88794827384f8801796","unresolved":false,"context_lines":[{"line_number":101,"context_line":"            raise InvalidValueMeta(\"Unable to serialize valueMeta into JSON\")"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"def _metric_dimensions(dimensions):"},{"line_number":105,"context_line":"    for k, v in dimensions.iteritems():"},{"line_number":106,"context_line":"        if not isinstance(k, (str, unicode)):"},{"line_number":107,"context_line":"            msg \u003d \"invalid dimension key {0} must be a string: {1}\".format("}],"source_content_type":"text/x-python","patch_set":4,"id":"fa7ab95a_5f47241d","line":104,"updated":"2016-08-31 04:40:34.000000000","message":"Do you think we can create another script under validation just for dimensions ? Log-API validates them, so maybe we could try and see later if your code fits there.","commit_id":"e1b99b38e07cf213a5f8a1c8ab1bbd684f4657c9"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"e89c6bd729f51d9cd7515de47dba70eadedf90c9","unresolved":false,"context_lines":[{"line_number":101,"context_line":"            raise InvalidValueMeta(\"Unable to serialize valueMeta into JSON\")"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"def _metric_dimensions(dimensions):"},{"line_number":105,"context_line":"    for k, v in dimensions.iteritems():"},{"line_number":106,"context_line":"        if not isinstance(k, (str, unicode)):"},{"line_number":107,"context_line":"            msg \u003d \"invalid dimension key {0} must be a string: {1}\".format("}],"source_content_type":"text/x-python","patch_set":4,"id":"fa7ab95a_7f0228b6","line":104,"in_reply_to":"fa7ab95a_5f47241d","updated":"2016-08-31 04:44:07.000000000","message":"Is your spec for dimensions the same as our spec?","commit_id":"e1b99b38e07cf213a5f8a1c8ab1bbd684f4657c9"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"b87e2da611f4d8bbe98ec316b79159a3ea30e57e","unresolved":false,"context_lines":[{"line_number":13,"context_line":"# See the License for the specific language governing permissions and"},{"line_number":14,"context_line":"# limitations under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import json"},{"line_number":17,"context_line":"import re"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"# This is used to ensure that metrics with a timestamp older than"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa7ab95a_ba90cc4f","line":16,"updated":"2016-09-01 15:51:15.000000000","message":"Would ujson be a better choice?","commit_id":"3fd851a4786260080936dc95ca83024e443b47da"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"b87e2da611f4d8bbe98ec316b79159a3ea30e57e","unresolved":false,"context_lines":[{"line_number":29,"context_line":""},{"line_number":30,"context_line":"invalid_chars \u003d \"\u003c\u003e\u003d{}(),\\\"\\\\\\\\;\u0026\""},{"line_number":31,"context_line":"restricted_dimension_chars \u003d re.compile(\u0027[\u0027 + invalid_chars + \u0027]\u0027)"},{"line_number":32,"context_line":"restricted_name_chars \u003d re.compile(\u0027[\u0027 + invalid_chars + \u0027 \u0027 + \u0027]\u0027)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"class InvalidMetricName(Exception):"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa7ab95a_b591bd9c","line":32,"updated":"2016-09-01 15:51:15.000000000","message":"I think you should make these all upper case too.","commit_id":"3fd851a4786260080936dc95ca83024e443b47da"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"b87e2da611f4d8bbe98ec316b79159a3ea30e57e","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        _validate_single_metric(metrics)"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"def _validate_single_metric(metric):"},{"line_number":68,"context_line":"    _metric_name(metric[\u0027name\u0027])"},{"line_number":69,"context_line":"    _metric_value(metric[\u0027value\u0027])"},{"line_number":70,"context_line":"    _metric_timestamp(metric[\u0027timestamp\u0027])"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa7ab95a_5a350044","line":67,"updated":"2016-09-01 15:51:15.000000000","message":"Why declare all these methods with an _. I guess you are thinking that they are private, and not meant to be invoked by external clients, but at the same time, I\u0027m wondering if these functions would be useful to external clients. Is it always the case that clients will go through \"validate\".","commit_id":"3fd851a4786260080936dc95ca83024e443b47da"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"b87e2da611f4d8bbe98ec316b79159a3ea30e57e","unresolved":false,"context_lines":[{"line_number":65,"context_line":""},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"def _validate_single_metric(metric):"},{"line_number":68,"context_line":"    _metric_name(metric[\u0027name\u0027])"},{"line_number":69,"context_line":"    _metric_value(metric[\u0027value\u0027])"},{"line_number":70,"context_line":"    _metric_timestamp(metric[\u0027timestamp\u0027])"},{"line_number":71,"context_line":"    if \"dimensions\" in metric:"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa7ab95a_7a5d6478","line":68,"updated":"2016-09-01 15:51:15.000000000","message":"I think we should add a \"_validate\" prefix to everything. The code would be slightly longer, but it would also be more clear. _metric_value as a function name, doesn\u0027t tell me what it does.","commit_id":"3fd851a4786260080936dc95ca83024e443b47da"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"f98f63a07b2ef16ba90412557603a0398701ecfc","unresolved":false,"context_lines":[{"line_number":65,"context_line":""},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"def _validate_single_metric(metric):"},{"line_number":68,"context_line":"    _metric_name(metric[\u0027name\u0027])"},{"line_number":69,"context_line":"    _metric_value(metric[\u0027value\u0027])"},{"line_number":70,"context_line":"    _metric_timestamp(metric[\u0027timestamp\u0027])"},{"line_number":71,"context_line":"    if \"dimensions\" in metric:"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa7ab95a_10827752","line":68,"in_reply_to":"fa7ab95a_7a5d6478","updated":"2016-09-01 16:02:01.000000000","message":"We originally had a validate prefix but once you imported the module you ended up writing validate a lot to call the method.  Right now the example Kaiyan has in the tests ends up doing:\n\nimport monasca_common.validation.metrics as metric_validator\nmetric_validator.validate([metrics])\n\nThat\u0027s how we intended to use it in the API but it turns out that we can\u0027t use it that way in the Agent because when we do the validation there we don\u0027t have a fully constructed metric yet we just have the component pieces.\n\nWe should take a look at the changes Kaiyan has there and see if prefixing with \u0027_validate\u0027 would make more sense or if we even want to prefix with \u0027_\u0027 when half our use cases end up calling \"private\" methods.","commit_id":"3fd851a4786260080936dc95ca83024e443b47da"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"b87e2da611f4d8bbe98ec316b79159a3ea30e57e","unresolved":false,"context_lines":[{"line_number":81,"context_line":"        raise InvalidValueMeta(msg)"},{"line_number":82,"context_line":"    for key, value in value_meta.iteritems():"},{"line_number":83,"context_line":"        if not key:"},{"line_number":84,"context_line":"            raise InvalidValueMeta(\"valueMeta name cannot be empty\")"},{"line_number":85,"context_line":"        if len(key) \u003e VALUE_META_NAME_MAX_LENGTH:"},{"line_number":86,"context_line":"            msg \u003d \"valueMeta name {0} must be {1} characters or less\".\\"},{"line_number":87,"context_line":"                format(key, VALUE_META_NAME_MAX_LENGTH)"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa7ab95a_fa2a548f","line":84,"updated":"2016-09-01 15:51:15.000000000","message":"Do you want to add the key that is empty in the error message?","commit_id":"3fd851a4786260080936dc95ca83024e443b47da"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"b87e2da611f4d8bbe98ec316b79159a3ea30e57e","unresolved":false,"context_lines":[{"line_number":95,"context_line":"                                                  value_meta)"},{"line_number":96,"context_line":"            raise InvalidValueMeta(msg)"},{"line_number":97,"context_line":"    except Exception:"},{"line_number":98,"context_line":"            raise InvalidValueMeta(\"Unable to serialize valueMeta into JSON\")"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"def _metric_dimensions(dimensions):"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa7ab95a_dae590a8","line":98,"updated":"2016-09-01 15:51:15.000000000","message":"I believe that the tabbing is too far.","commit_id":"3fd851a4786260080936dc95ca83024e443b47da"}]}
