)]}'
{"conf.d/json_plugin.yaml.example":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9c7a0f501a0b6c5d2f50a77eb34d7dcd4d683c6d","unresolved":false,"context_lines":[{"line_number":4,"context_line":"  metrics_dir: /var/cache/monasca_json_plugin"},{"line_number":5,"context_line":"  name: /var/cache/monasca_json_plugin"},{"line_number":6,"context_line":"- built_by: Me"},{"line_number":7,"context_line":"  metrics_files: /var/cache/my_dir/my_metrics.json,/dev/shm/more_metrics.json"},{"line_number":8,"context_line":"  name: Mine"}],"source_content_type":"application/octet-stream","patch_set":4,"id":"ba5da102_d6e3ff31","line":7,"range":{"start_line":7,"start_character":2,"end_line":7,"end_character":15},"updated":"2016-11-04 20:17:09.000000000","message":"Is this supported in the plugin? I don\u0027t see it","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9c7a0f501a0b6c5d2f50a77eb34d7dcd4d683c6d","unresolved":false,"context_lines":[{"line_number":4,"context_line":"  metrics_dir: /var/cache/monasca_json_plugin"},{"line_number":5,"context_line":"  name: /var/cache/monasca_json_plugin"},{"line_number":6,"context_line":"- built_by: Me"},{"line_number":7,"context_line":"  metrics_files: /var/cache/my_dir/my_metrics.json,/dev/shm/more_metrics.json"},{"line_number":8,"context_line":"  name: Mine"}],"source_content_type":"application/octet-stream","patch_set":4,"id":"ba5da102_16ed7725","line":7,"range":{"start_line":7,"start_character":17,"end_line":7,"end_character":77},"updated":"2016-11-04 20:17:09.000000000","message":"Why is this a comma separated list of files instead of a yaml list?","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"d1cdd92b3d39cb6fbd79c4ff9e2d0dbceef368cd","unresolved":false,"context_lines":[{"line_number":4,"context_line":"  metrics_dir: /var/cache/monasca_json_plugin"},{"line_number":5,"context_line":"  name: /var/cache/monasca_json_plugin"},{"line_number":6,"context_line":"- built_by: Me"},{"line_number":7,"context_line":"  metrics_files: /var/cache/my_dir/my_metrics.json,/dev/shm/more_metrics.json"},{"line_number":8,"context_line":"  name: Mine"}],"source_content_type":"application/octet-stream","patch_set":4,"id":"9a629dbe_406f4492","line":7,"range":{"start_line":7,"start_character":17,"end_line":7,"end_character":77},"in_reply_to":"ba5da102_16ed7725","updated":"2016-11-07 11:07:03.000000000","message":"Good question. It\u0027s a carry-over from previous code. Now that I think about it, I see no need for this to be a list of files. If you have several files, just add another instance. I\u0027ll fix this in next patch.","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"d1cdd92b3d39cb6fbd79c4ff9e2d0dbceef368cd","unresolved":false,"context_lines":[{"line_number":4,"context_line":"  metrics_dir: /var/cache/monasca_json_plugin"},{"line_number":5,"context_line":"  name: /var/cache/monasca_json_plugin"},{"line_number":6,"context_line":"- built_by: Me"},{"line_number":7,"context_line":"  metrics_files: /var/cache/my_dir/my_metrics.json,/dev/shm/more_metrics.json"},{"line_number":8,"context_line":"  name: Mine"}],"source_content_type":"application/octet-stream","patch_set":4,"id":"9a629dbe_c030b4a1","line":7,"range":{"start_line":7,"start_character":2,"end_line":7,"end_character":15},"in_reply_to":"ba5da102_d6e3ff31","updated":"2016-11-07 11:07:03.000000000","message":"It is. Per above, it won;t be in next patch.","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"}],"docs/Plugins.md":[{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":950,"context_line":"Simple Example -- /var/cache/monasca_json_plugin/my-metrics-file.json:"},{"line_number":951,"context_line":"```"},{"line_number":952,"context_line":"["},{"line_number":953,"context_line":"   {\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": 1475596165},"},{"line_number":954,"context_line":"   {\"name\": \"metric2\", \"value\": 12.3, \"timestamp\": 1475596165}"},{"line_number":955,"context_line":"]"},{"line_number":956,"context_line":"```"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_16b9542e","line":953,"updated":"2016-11-02 22:25:43.000000000","message":"Would it be preferable to report the timestamp in milliseconds from the epoch to match the format that Monasca expects in the API?","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":950,"context_line":"Simple Example -- /var/cache/monasca_json_plugin/my-metrics-file.json:"},{"line_number":951,"context_line":"```"},{"line_number":952,"context_line":"["},{"line_number":953,"context_line":"   {\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": 1475596165},"},{"line_number":954,"context_line":"   {\"name\": \"metric2\", \"value\": 12.3, \"timestamp\": 1475596165}"},{"line_number":955,"context_line":"]"},{"line_number":956,"context_line":"```"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_8a124257","line":953,"in_reply_to":"ba5da102_00d64a27","updated":"2016-11-04 18:05:13.000000000","message":"The Monasca API takes accepts the apoch in milliseconds from the epoch as follows: 1475596165000, with 3 values for the milliseconds after it.\n\nFor example, 1475596165000\n\nSee, https://github.com/openstack/monasca-api/blob/master/docs/monasca-api-spec.md#request-examples-2.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":950,"context_line":"Simple Example -- /var/cache/monasca_json_plugin/my-metrics-file.json:"},{"line_number":951,"context_line":"```"},{"line_number":952,"context_line":"["},{"line_number":953,"context_line":"   {\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": 1475596165},"},{"line_number":954,"context_line":"   {\"name\": \"metric2\", \"value\": 12.3, \"timestamp\": 1475596165}"},{"line_number":955,"context_line":"]"},{"line_number":956,"context_line":"```"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_00d64a27","line":953,"in_reply_to":"ba5da102_16b9542e","updated":"2016-11-03 17:20:04.000000000","message":"to clarify, you want me to change 1475596165 to 1475596165.00? I\u0027ll do that.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":961,"context_line":"| ----------- | ---------- |"},{"line_number":962,"context_line":"| name  | Required. The name of the metric. The key \"metric\" may be used instead of \"name\". |"},{"line_number":963,"context_line":"| value | Required. The value of the measurement. This is a floating point number. |"},{"line_number":964,"context_line":"| timestamp | Optional (if interpolate_timestamps is true; see below); otherwise required. The time of the measurement. Uses UNIX time epoch value. |"},{"line_number":965,"context_line":"| dimensions | Optional. Dimensions of the metric as a set of key/value pairs. |"},{"line_number":966,"context_line":"| value_meta | Optional. Value meta of the metric as a set of key/value pairs. |"},{"line_number":967,"context_line":""}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_368bb869","line":964,"updated":"2016-11-02 22:25:43.000000000","message":"Would it be preferable to report the timestamp in milliseconds from the epoch to match the format that Monasca expects in the API?","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":961,"context_line":"| ----------- | ---------- |"},{"line_number":962,"context_line":"| name  | Required. The name of the metric. The key \"metric\" may be used instead of \"name\". |"},{"line_number":963,"context_line":"| value | Required. The value of the measurement. This is a floating point number. |"},{"line_number":964,"context_line":"| timestamp | Optional (if interpolate_timestamps is true; see below); otherwise required. The time of the measurement. Uses UNIX time epoch value. |"},{"line_number":965,"context_line":"| dimensions | Optional. Dimensions of the metric as a set of key/value pairs. |"},{"line_number":966,"context_line":"| value_meta | Optional. Value meta of the metric as a set of key/value pairs. |"},{"line_number":967,"context_line":""}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_008baa1f","line":964,"in_reply_to":"ba5da102_368bb869","updated":"2016-11-03 17:20:04.000000000","message":"As above. However, as far as I can see, the AgentCheck.guage() functions accepts an int. I\u0027ll confirm this.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":977,"context_line":""},{"line_number":978,"context_line":"```"},{"line_number":979,"context_line":"metric_data \u003d [{\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": time.time()}]"},{"line_number":980,"context_line":"max_attempts \u003d 10"},{"line_number":981,"context_line":"delay \u003d 0.02"},{"line_number":982,"context_line":"attempts \u003d 0"},{"line_number":983,"context_line":"with open(\u0027/var/cache/monasca_json_plugin/my-metrics-file.json\u0027, \u0027w\u0027) as fd:"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_191d0766","line":980,"range":{"start_line":980,"start_character":0,"end_line":980,"end_character":12},"updated":"2016-11-02 22:25:43.000000000","message":"maybe max_retries is better?","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":977,"context_line":""},{"line_number":978,"context_line":"```"},{"line_number":979,"context_line":"metric_data \u003d [{\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": time.time()}]"},{"line_number":980,"context_line":"max_attempts \u003d 10"},{"line_number":981,"context_line":"delay \u003d 0.02"},{"line_number":982,"context_line":"attempts \u003d 0"},{"line_number":983,"context_line":"with open(\u0027/var/cache/monasca_json_plugin/my-metrics-file.json\u0027, \u0027w\u0027) as fd:"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_bb8f8f73","line":980,"range":{"start_line":980,"start_character":0,"end_line":980,"end_character":12},"in_reply_to":"ba5da102_191d0766","updated":"2016-11-03 17:20:04.000000000","message":"I always find \"retries\" confusing --- a \"re\" try means, I \"tried\" once, failed, so I\u0027ll try (i.e., \"retry\") again. However, most pieces of code I\u0027ve ever seen the retry variable actually counts \"tries\", not \"retries\". Anyway, on closer inspection, this code has a off-by one error (will do one more attempt than max_attempts), so I\u0027ll change the variable name.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":977,"context_line":""},{"line_number":978,"context_line":"```"},{"line_number":979,"context_line":"metric_data \u003d [{\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": time.time()}]"},{"line_number":980,"context_line":"max_attempts \u003d 10"},{"line_number":981,"context_line":"delay \u003d 0.02"},{"line_number":982,"context_line":"attempts \u003d 0"},{"line_number":983,"context_line":"with open(\u0027/var/cache/monasca_json_plugin/my-metrics-file.json\u0027, \u0027w\u0027) as fd:"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_4a566a07","line":980,"range":{"start_line":980,"start_character":0,"end_line":980,"end_character":12},"in_reply_to":"ba5da102_bb8f8f73","updated":"2016-11-04 18:05:13.000000000","message":"OK, thanks. I think we\u0027ve been using retry in other places, but to be honest, i didn\u0027t check closely. Just thought i\u0027d mention it.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":978,"context_line":"```"},{"line_number":979,"context_line":"metric_data \u003d [{\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": time.time()}]"},{"line_number":980,"context_line":"max_attempts \u003d 10"},{"line_number":981,"context_line":"delay \u003d 0.02"},{"line_number":982,"context_line":"attempts \u003d 0"},{"line_number":983,"context_line":"with open(\u0027/var/cache/monasca_json_plugin/my-metrics-file.json\u0027, \u0027w\u0027) as fd:"},{"line_number":984,"context_line":"    while True:"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_76d9b056","line":981,"updated":"2016-11-02 22:25:43.000000000","message":"I was wondering if this delay of .02 secs in this example, was sufficient to prevent the cpu from spinning? Would a longer delay be recommended? I guess the idea is that the file should be written quickly, and then read quickly, but I thought I would ask, just  in case.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":978,"context_line":"```"},{"line_number":979,"context_line":"metric_data \u003d [{\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": time.time()}]"},{"line_number":980,"context_line":"max_attempts \u003d 10"},{"line_number":981,"context_line":"delay \u003d 0.02"},{"line_number":982,"context_line":"attempts \u003d 0"},{"line_number":983,"context_line":"with open(\u0027/var/cache/monasca_json_plugin/my-metrics-file.json\u0027, \u0027w\u0027) as fd:"},{"line_number":984,"context_line":"    while True:"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_2a9f76b5","line":981,"in_reply_to":"ba5da102_5bb673f9","updated":"2016-11-04 18:05:13.000000000","message":"Well, with a sleep interval of .02, that was starting to look close to spinning. But, i agree, the concern that I was potentially raising, is not a concern here.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":978,"context_line":"```"},{"line_number":979,"context_line":"metric_data \u003d [{\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": time.time()}]"},{"line_number":980,"context_line":"max_attempts \u003d 10"},{"line_number":981,"context_line":"delay \u003d 0.02"},{"line_number":982,"context_line":"attempts \u003d 0"},{"line_number":983,"context_line":"with open(\u0027/var/cache/monasca_json_plugin/my-metrics-file.json\u0027, \u0027w\u0027) as fd:"},{"line_number":984,"context_line":"    while True:"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_5bb673f9","line":981,"in_reply_to":"ba5da102_76d9b056","updated":"2016-11-03 17:20:04.000000000","message":"A few points:\n- The CPU is not spinning, we sleep\n- The plugin should be able to open, read and close a file well within 0.2 secs\n- On retry, the sleeps get exponentially longer","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":1015,"context_line":""},{"line_number":1016,"context_line":"| Directive | Description |"},{"line_number":1017,"context_line":"| --------- | ----------- |"},{"line_number":1018,"context_line":"| interpolate_timestamps | If true, the timestamps are ignored. Instead, the timestamp of the measurement is set to the current time. Default is false.|"},{"line_number":1019,"context_line":"| stale_age | The number of seconds after which metrics are considered stale. This stops measurements from a file that is not updating from being reported to Monasca. It defaults to 4 minutes.|"},{"line_number":1020,"context_line":""},{"line_number":1021,"context_line":"The main purpose of the stage_age directive is to detect if the JSON file stops updating (e.g., due to a bug or system failure). See the description of the json_plugin.status metric below."}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_d6a6fcac","line":1018,"updated":"2016-11-02 22:25:43.000000000","message":"Would replace_timestamps be a better name. The word \"interpolate\" I usually associate with linear interpolation between to points.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":1015,"context_line":""},{"line_number":1016,"context_line":"| Directive | Description |"},{"line_number":1017,"context_line":"| --------- | ----------- |"},{"line_number":1018,"context_line":"| interpolate_timestamps | If true, the timestamps are ignored. Instead, the timestamp of the measurement is set to the current time. Default is false.|"},{"line_number":1019,"context_line":"| stale_age | The number of seconds after which metrics are considered stale. This stops measurements from a file that is not updating from being reported to Monasca. It defaults to 4 minutes.|"},{"line_number":1020,"context_line":""},{"line_number":1021,"context_line":"The main purpose of the stage_age directive is to detect if the JSON file stops updating (e.g., due to a bug or system failure). See the description of the json_plugin.status metric below."}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_8aaec2e5","line":1018,"in_reply_to":"ba5da102_3b81bffb","updated":"2016-11-04 18:05:13.000000000","message":"OK.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":1015,"context_line":""},{"line_number":1016,"context_line":"| Directive | Description |"},{"line_number":1017,"context_line":"| --------- | ----------- |"},{"line_number":1018,"context_line":"| interpolate_timestamps | If true, the timestamps are ignored. Instead, the timestamp of the measurement is set to the current time. Default is false.|"},{"line_number":1019,"context_line":"| stale_age | The number of seconds after which metrics are considered stale. This stops measurements from a file that is not updating from being reported to Monasca. It defaults to 4 minutes.|"},{"line_number":1020,"context_line":""},{"line_number":1021,"context_line":"The main purpose of the stage_age directive is to detect if the JSON file stops updating (e.g., due to a bug or system failure). See the description of the json_plugin.status metric below."}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_3b81bffb","line":1018,"in_reply_to":"ba5da102_d6a6fcac","updated":"2016-11-03 17:20:04.000000000","message":"I see your point. Might go with overwrite_timestamps","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":1016,"context_line":"| Directive | Description |"},{"line_number":1017,"context_line":"| --------- | ----------- |"},{"line_number":1018,"context_line":"| interpolate_timestamps | If true, the timestamps are ignored. Instead, the timestamp of the measurement is set to the current time. Default is false.|"},{"line_number":1019,"context_line":"| stale_age | The number of seconds after which metrics are considered stale. This stops measurements from a file that is not updating from being reported to Monasca. It defaults to 4 minutes.|"},{"line_number":1020,"context_line":""},{"line_number":1021,"context_line":"The main purpose of the stage_age directive is to detect if the JSON file stops updating (e.g., due to a bug or system failure). See the description of the json_plugin.status metric below."},{"line_number":1022,"context_line":""}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_767ff0df","line":1019,"updated":"2016-11-02 22:25:43.000000000","message":"Would measurement_ttl, be a better description?","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":1016,"context_line":"| Directive | Description |"},{"line_number":1017,"context_line":"| --------- | ----------- |"},{"line_number":1018,"context_line":"| interpolate_timestamps | If true, the timestamps are ignored. Instead, the timestamp of the measurement is set to the current time. Default is false.|"},{"line_number":1019,"context_line":"| stale_age | The number of seconds after which metrics are considered stale. This stops measurements from a file that is not updating from being reported to Monasca. It defaults to 4 minutes.|"},{"line_number":1020,"context_line":""},{"line_number":1021,"context_line":"The main purpose of the stage_age directive is to detect if the JSON file stops updating (e.g., due to a bug or system failure). See the description of the json_plugin.status metric below."},{"line_number":1022,"context_line":""}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_6a808e47","line":1019,"in_reply_to":"ba5da102_1b66bb50","updated":"2016-11-04 18:05:13.000000000","message":"i didn\u0027t get the reference to Riemann, but whatever you want to go with.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":1016,"context_line":"| Directive | Description |"},{"line_number":1017,"context_line":"| --------- | ----------- |"},{"line_number":1018,"context_line":"| interpolate_timestamps | If true, the timestamps are ignored. Instead, the timestamp of the measurement is set to the current time. Default is false.|"},{"line_number":1019,"context_line":"| stale_age | The number of seconds after which metrics are considered stale. This stops measurements from a file that is not updating from being reported to Monasca. It defaults to 4 minutes.|"},{"line_number":1020,"context_line":""},{"line_number":1021,"context_line":"The main purpose of the stage_age directive is to detect if the JSON file stops updating (e.g., due to a bug or system failure). See the description of the json_plugin.status metric below."},{"line_number":1022,"context_line":""}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_1b66bb50","line":1019,"in_reply_to":"ba5da102_767ff0df","updated":"2016-11-03 17:20:04.000000000","message":"Would ttl to confusing to anyone who knows Riemann?","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":1018,"context_line":"| interpolate_timestamps | If true, the timestamps are ignored. Instead, the timestamp of the measurement is set to the current time. Default is false.|"},{"line_number":1019,"context_line":"| stale_age | The number of seconds after which metrics are considered stale. This stops measurements from a file that is not updating from being reported to Monasca. It defaults to 4 minutes.|"},{"line_number":1020,"context_line":""},{"line_number":1021,"context_line":"The main purpose of the stage_age directive is to detect if the JSON file stops updating (e.g., due to a bug or system failure). See the description of the json_plugin.status metric below."},{"line_number":1022,"context_line":""},{"line_number":1023,"context_line":"The main purpose of the interpolate_timestamps directive is where the mechanism to write the JSON file runs infrequently or erratically. Every time Monasa Agent runs, the metrics"},{"line_number":1024,"context_line":"are reported with the current time -- whether or not the file is updated. In this mode, you do not need to supply a timestamp (in fact, any timestamp you include is ignored). Also the"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_b60ee889","line":1021,"updated":"2016-11-02 22:25:43.000000000","message":"stage_age -\u003e stale-age","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":1018,"context_line":"| interpolate_timestamps | If true, the timestamps are ignored. Instead, the timestamp of the measurement is set to the current time. Default is false.|"},{"line_number":1019,"context_line":"| stale_age | The number of seconds after which metrics are considered stale. This stops measurements from a file that is not updating from being reported to Monasca. It defaults to 4 minutes.|"},{"line_number":1020,"context_line":""},{"line_number":1021,"context_line":"The main purpose of the stage_age directive is to detect if the JSON file stops updating (e.g., due to a bug or system failure). See the description of the json_plugin.status metric below."},{"line_number":1022,"context_line":""},{"line_number":1023,"context_line":"The main purpose of the interpolate_timestamps directive is where the mechanism to write the JSON file runs infrequently or erratically. Every time Monasa Agent runs, the metrics"},{"line_number":1024,"context_line":"are reported with the current time -- whether or not the file is updated. In this mode, you do not need to supply a timestamp (in fact, any timestamp you include is ignored). Also the"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_3b6c5f07","line":1021,"in_reply_to":"ba5da102_b60ee889","updated":"2016-11-03 17:20:04.000000000","message":"Done","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":1033,"context_line":""},{"line_number":1034,"context_line":"The Monasca Agent user must be able to read the files."},{"line_number":1035,"context_line":""},{"line_number":1036,"context_line":"### The json_plugin.status Metric"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"The plugin reports a metric called \"json_plugin.status\". A metric is reported for each JSON file processed. This metric"},{"line_number":1039,"context_line":"provides a way to trouble shoot the plugin. It also allows you to create an alarm to trigger if there is"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_36e01896","line":1036,"updated":"2016-11-02 22:25:43.000000000","message":"I think we should add a \"monasca\" prefix to help identify the metric better.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":1033,"context_line":""},{"line_number":1034,"context_line":"The Monasca Agent user must be able to read the files."},{"line_number":1035,"context_line":""},{"line_number":1036,"context_line":"### The json_plugin.status Metric"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"The plugin reports a metric called \"json_plugin.status\". A metric is reported for each JSON file processed. This metric"},{"line_number":1039,"context_line":"provides a way to trouble shoot the plugin. It also allows you to create an alarm to trigger if there is"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_db528334","line":1036,"in_reply_to":"ba5da102_36e01896","updated":"2016-11-03 17:20:04.000000000","message":"Done","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":1045,"context_line":"| --------- | ----------- |"},{"line_number":1046,"context_line":"| name      | \"json_plugin.status\" -- the name of the metric |"},{"line_number":1047,"context_line":"| dimensions | The dimensions contains a \"path\" key. The value is the path of the JSON file"},{"line_number":1048,"context_line":"| value      | A value of 0.0 is normal -- there are no issues processing the JSON file. A value of 2.0 indicates there is a problem. |"},{"line_number":1049,"context_line":"| value_meta | The value meta contains a \"msg\" key. The value is a string indicating the problem. |"},{"line_number":1050,"context_line":""},{"line_number":1051,"context_line":"The value_meta/msg reports problems such as:"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_c47e4669","line":1048,"range":{"start_line":1048,"start_character":56,"end_line":1048,"end_character":62},"updated":"2016-11-02 22:25:43.000000000","message":"Why not just report a value of 0 and 1, instead of 0 and 2? This is what is reported for all the other \"status\" like metrics such as http_status.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":1045,"context_line":"| --------- | ----------- |"},{"line_number":1046,"context_line":"| name      | \"json_plugin.status\" -- the name of the metric |"},{"line_number":1047,"context_line":"| dimensions | The dimensions contains a \"path\" key. The value is the path of the JSON file"},{"line_number":1048,"context_line":"| value      | A value of 0.0 is normal -- there are no issues processing the JSON file. A value of 2.0 indicates there is a problem. |"},{"line_number":1049,"context_line":"| value_meta | The value meta contains a \"msg\" key. The value is a string indicating the problem. |"},{"line_number":1050,"context_line":""},{"line_number":1051,"context_line":"The value_meta/msg reports problems such as:"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_5b3d93db","line":1048,"range":{"start_line":1048,"start_character":56,"end_line":1048,"end_character":62},"in_reply_to":"ba5da102_c47e4669","updated":"2016-11-03 17:20:04.000000000","message":"Done","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"- Failure to open the JSON file"},{"line_number":1054,"context_line":"- Invalid JSON syntax"},{"line_number":1055,"context_line":"- That metrics are older than the stale_age"},{"line_number":1056,"context_line":""},{"line_number":1057,"context_line":""},{"line_number":1058,"context_line":"## Kafka Checks"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_f675c0ca","line":1055,"updated":"2016-11-02 22:25:43.000000000","message":"is you change the variable name then this msg would change too.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":1052,"context_line":""},{"line_number":1053,"context_line":"- Failure to open the JSON file"},{"line_number":1054,"context_line":"- Invalid JSON syntax"},{"line_number":1055,"context_line":"- That metrics are older than the stale_age"},{"line_number":1056,"context_line":""},{"line_number":1057,"context_line":""},{"line_number":1058,"context_line":"## Kafka Checks"}],"source_content_type":"text/x-markdown","patch_set":3,"id":"ba5da102_26052610","line":1055,"in_reply_to":"ba5da102_f675c0ca","updated":"2016-11-03 17:20:04.000000000","message":"As above","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"1773c465c9dd0dbbd96b89aeeb1721a380d1373b","unresolved":false,"context_lines":[{"line_number":950,"context_line":"Simple Example -- /var/cache/monasca_json_plugin/my-metrics-file.json:"},{"line_number":951,"context_line":"```"},{"line_number":952,"context_line":"["},{"line_number":953,"context_line":"   {\"name\": \"metric1\", \"value\": 10.1, \"timestamp\": 1475596165.00},"},{"line_number":954,"context_line":"   {\"name\": \"metric2\", \"value\": 12.3, \"timestamp\": 1475596165.00}"},{"line_number":955,"context_line":"]"},{"line_number":956,"context_line":"```"}],"source_content_type":"text/x-markdown","patch_set":4,"id":"9a629dbe_b1307009","line":953,"range":{"start_line":953,"start_character":51,"end_line":953,"end_character":64},"updated":"2016-11-07 11:21:03.000000000","message":"The API uses millseconds since the epoch. The *agent* expects seconds since the epoch. Will fix/clarify in next draft.","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"}],"monasca_agent/collector/checks_d/json_plugin.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"6a325d64333a331155b48db15cfb50bafe869e8c","unresolved":false,"context_lines":[{"line_number":7,"context_line":"from monasca_agent.collector.checks import AgentCheck as AgentCheck"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":""},{"line_number":10,"context_line":"# This module provides a check plugin clas s for monasca-agent. The plugin"},{"line_number":11,"context_line":"# runs \u0027tasks\u0027 each of which generates one or more metrics that are reported to"},{"line_number":12,"context_line":"# the monasca-agent daemon. There are three types of tasks:"},{"line_number":13,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a95cdbc_46c0e87b","line":10,"updated":"2016-10-06 11:06:17.000000000","message":"s/clas s/class/","commit_id":"22f81c24066a3a6c151e3242245d3dad6822e2b3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"9b2ec82447f0b95dc7a1256b377523bb3fc91f4f","unresolved":false,"context_lines":[{"line_number":7,"context_line":"from monasca_agent.collector.checks import AgentCheck as AgentCheck"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":""},{"line_number":10,"context_line":"# This module provides a check plugin clas s for monasca-agent. The plugin"},{"line_number":11,"context_line":"# runs \u0027tasks\u0027 each of which generates one or more metrics that are reported to"},{"line_number":12,"context_line":"# the monasca-agent daemon. There are three types of tasks:"},{"line_number":13,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a95cdbc_293ffa24","line":10,"in_reply_to":"1a95cdbc_46c0e87b","updated":"2016-10-07 09:30:05.000000000","message":"\"fixed\" by removing this whole comment -- the description of the class is in the doc string below.","commit_id":"22f81c24066a3a6c151e3242245d3dad6822e2b3"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"6a325d64333a331155b48db15cfb50bafe869e8c","unresolved":false,"context_lines":[{"line_number":9,"context_line":""},{"line_number":10,"context_line":"# This module provides a check plugin clas s for monasca-agent. The plugin"},{"line_number":11,"context_line":"# runs \u0027tasks\u0027 each of which generates one or more metrics that are reported to"},{"line_number":12,"context_line":"# the monasca-agent daemon. There are three types of tasks:"},{"line_number":13,"context_line":"#"},{"line_number":14,"context_line":"# 1. Load metrics from files: file names may be specified via an ansible"},{"line_number":15,"context_line":"# playbook task that deploys the associated swiftlm_detect detect plugin. Files"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a95cdbc_e6ce54b3","line":12,"updated":"2016-10-06 11:06:17.000000000","message":"only the first is implemented here","commit_id":"22f81c24066a3a6c151e3242245d3dad6822e2b3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"9b2ec82447f0b95dc7a1256b377523bb3fc91f4f","unresolved":false,"context_lines":[{"line_number":9,"context_line":""},{"line_number":10,"context_line":"# This module provides a check plugin clas s for monasca-agent. The plugin"},{"line_number":11,"context_line":"# runs \u0027tasks\u0027 each of which generates one or more metrics that are reported to"},{"line_number":12,"context_line":"# the monasca-agent daemon. There are three types of tasks:"},{"line_number":13,"context_line":"#"},{"line_number":14,"context_line":"# 1. Load metrics from files: file names may be specified via an ansible"},{"line_number":15,"context_line":"# playbook task that deploys the associated swiftlm_detect detect plugin. Files"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a95cdbc_89148ea0","line":12,"in_reply_to":"1a95cdbc_e6ce54b3","updated":"2016-10-07 09:30:05.000000000","message":"ditto","commit_id":"22f81c24066a3a6c151e3242245d3dad6822e2b3"},{"author":{"_account_id":1706,"name":"Tom Hancock","email":"tom.hancock@hp.com","username":"tom-hancock"},"change_message_id":"730ec11d9b23ef4270a19c806e574ae5640cff3a","unresolved":false,"context_lines":[{"line_number":315,"context_line":"                             name in file_names]:"},{"line_number":316,"context_line":"                    # .json extension protects from reading .swp and similar"},{"line_number":317,"context_line":"                    if os.path.isfile(name) and name.lower().endswith(\u0027.json\u0027):"},{"line_number":318,"context_line":"                        self.metrics_files.append(name)"},{"line_number":319,"context_line":"            except OSError as err:"},{"line_number":320,"context_line":"                self._plugin_failed(self.metrics_dir,"},{"line_number":321,"context_line":"                                    \u0027Error processing: %s\u0027 % err)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a95cdbc_e62ad42b","line":318,"range":{"start_line":318,"start_character":54,"end_line":318,"end_character":55},"updated":"2016-10-06 11:09:58.000000000","message":"would glob make thjis any easier?","commit_id":"22f81c24066a3a6c151e3242245d3dad6822e2b3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"9b2ec82447f0b95dc7a1256b377523bb3fc91f4f","unresolved":false,"context_lines":[{"line_number":315,"context_line":"                             name in file_names]:"},{"line_number":316,"context_line":"                    # .json extension protects from reading .swp and similar"},{"line_number":317,"context_line":"                    if os.path.isfile(name) and name.lower().endswith(\u0027.json\u0027):"},{"line_number":318,"context_line":"                        self.metrics_files.append(name)"},{"line_number":319,"context_line":"            except OSError as err:"},{"line_number":320,"context_line":"                self._plugin_failed(self.metrics_dir,"},{"line_number":321,"context_line":"                                    \u0027Error processing: %s\u0027 % err)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a95cdbc_494d26c3","line":318,"range":{"start_line":318,"start_character":54,"end_line":318,"end_character":55},"in_reply_to":"1a95cdbc_e62ad42b","updated":"2016-10-07 09:30:05.000000000","message":"I still need to check for isfile(). Also glob looks a bit bash-like","commit_id":"22f81c24066a3a6c151e3242245d3dad6822e2b3"},{"author":{"_account_id":20033,"name":"Artur Basiak","email":"artur.basiak@ts.fujitsu.com","username":"abasiak"},"change_message_id":"1b25aa7cfa4de205f7ae267db962044a2264f55f","unresolved":false,"context_lines":[{"line_number":8,"context_line":"import os"},{"line_number":9,"context_line":"import time"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"from monasca_agent.collector.checks import AgentCheck as AgentCheck"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"OK \u003d 0"},{"line_number":14,"context_line":"WARN \u003d 1"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a95cdbc_7a60dea5","line":11,"range":{"start_line":11,"start_character":42,"end_line":11,"end_character":67},"updated":"2016-10-07 10:42:01.000000000","message":"Alias here unnecessary, import AgentCheck will be sufficient.","commit_id":"a3c5331712436586e282ea880f6f047b42eb70b2"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3213b78a61e376e17c28464630c51f524a42e026","unresolved":false,"context_lines":[{"line_number":8,"context_line":"import os"},{"line_number":9,"context_line":"import time"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"from monasca_agent.collector.checks import AgentCheck as AgentCheck"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"OK \u003d 0"},{"line_number":14,"context_line":"WARN \u003d 1"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a95cdbc_185a7d2a","line":11,"range":{"start_line":11,"start_character":42,"end_line":11,"end_character":67},"in_reply_to":"1a95cdbc_7a60dea5","updated":"2016-10-07 13:17:47.000000000","message":"Done","commit_id":"a3c5331712436586e282ea880f6f047b42eb70b2"},{"author":{"_account_id":20033,"name":"Artur Basiak","email":"artur.basiak@ts.fujitsu.com","username":"abasiak"},"change_message_id":"1b25aa7cfa4de205f7ae267db962044a2264f55f","unresolved":false,"context_lines":[{"line_number":26,"context_line":"               \u0027value_meta\u0027]"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"def _take_shared_lock(fd):"},{"line_number":30,"context_line":"    \"\"\"Take shared lock on a file descriptor"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    Assuming the writer of the JSON file also takes a lock, this"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a95cdbc_da5d727a","line":29,"range":{"start_line":29,"start_character":4,"end_line":29,"end_character":21},"updated":"2016-10-07 10:42:01.000000000","message":"Is there a reason why this method cannot be a part of JsonPlugin class?","commit_id":"a3c5331712436586e282ea880f6f047b42eb70b2"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3213b78a61e376e17c28464630c51f524a42e026","unresolved":false,"context_lines":[{"line_number":26,"context_line":"               \u0027value_meta\u0027]"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"def _take_shared_lock(fd):"},{"line_number":30,"context_line":"    \"\"\"Take shared lock on a file descriptor"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    Assuming the writer of the JSON file also takes a lock, this"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a95cdbc_78ef01e9","line":29,"range":{"start_line":29,"start_character":4,"end_line":29,"end_character":21},"in_reply_to":"1a95cdbc_da5d727a","updated":"2016-10-07 13:17:47.000000000","message":"I\u0027ll make it a staticmethod. I should do this for _csv_to_list() as well.","commit_id":"a3c5331712436586e282ea880f6f047b42eb70b2"},{"author":{"_account_id":20033,"name":"Artur Basiak","email":"artur.basiak@ts.fujitsu.com","username":"abasiak"},"change_message_id":"1b25aa7cfa4de205f7ae267db962044a2264f55f","unresolved":false,"context_lines":[{"line_number":116,"context_line":"    measurement list and the header values are defaulted."},{"line_number":117,"context_line":"    \"\"\""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def __init__(self, name, init_config, agent_config, instances\u003dNone,"},{"line_number":120,"context_line":"                 logger\u003dNone):"},{"line_number":121,"context_line":"        super(JsonPlugin, self).__init__("},{"line_number":122,"context_line":"            name, init_config, agent_config, instances)"},{"line_number":123,"context_line":"        self.log \u003d logger or self.log"},{"line_number":124,"context_line":"        self.plugin_failures \u003d {}"},{"line_number":125,"context_line":"        self.now \u003d time.time()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a95cdbc_7a845e5d","line":122,"range":{"start_line":119,"start_character":3,"end_line":122,"end_character":55},"updated":"2016-10-07 10:42:01.000000000","message":"Please format it according to PEP8","commit_id":"a3c5331712436586e282ea880f6f047b42eb70b2"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3213b78a61e376e17c28464630c51f524a42e026","unresolved":false,"context_lines":[{"line_number":116,"context_line":"    measurement list and the header values are defaulted."},{"line_number":117,"context_line":"    \"\"\""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def __init__(self, name, init_config, agent_config, instances\u003dNone,"},{"line_number":120,"context_line":"                 logger\u003dNone):"},{"line_number":121,"context_line":"        super(JsonPlugin, self).__init__("},{"line_number":122,"context_line":"            name, init_config, agent_config, instances)"},{"line_number":123,"context_line":"        self.log \u003d logger or self.log"},{"line_number":124,"context_line":"        self.plugin_failures \u003d {}"},{"line_number":125,"context_line":"        self.now \u003d time.time()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a95cdbc_f8ceb12b","line":122,"range":{"start_line":119,"start_character":3,"end_line":122,"end_character":55},"in_reply_to":"1a95cdbc_7a845e5d","updated":"2016-10-07 13:17:47.000000000","message":"Oddly neither flake8 or PyCharm complain so it must *be* complient. However, I\u0027ll reformat.","commit_id":"a3c5331712436586e282ea880f6f047b42eb70b2"},{"author":{"_account_id":20033,"name":"Artur Basiak","email":"artur.basiak@ts.fujitsu.com","username":"abasiak"},"change_message_id":"1b25aa7cfa4de205f7ae267db962044a2264f55f","unresolved":false,"context_lines":[{"line_number":207,"context_line":"                self._plugin_failed(file_name, \u0027invalid key: %s\u0027 % key)"},{"line_number":208,"context_line":"                continue"},{"line_number":209,"context_line":"            if \u0027value\u0027 not in metric.keys():"},{"line_number":210,"context_line":"                metrics.remove(metric)  # missing name"},{"line_number":211,"context_line":"                invalid_metric \u003d metric"},{"line_number":212,"context_line":"                self._plugin_failed(file_name, \u0027invalid key: %s\u0027 % key)"},{"line_number":213,"context_line":"                continue"},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"            if \u0027name\u0027 in metric:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a95cdbc_da7012df","line":212,"range":{"start_line":210,"start_character":16,"end_line":212,"end_character":71},"updated":"2016-10-07 10:42:01.000000000","message":"This code is duplicated. I think you can move it to a method.","commit_id":"a3c5331712436586e282ea880f6f047b42eb70b2"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3213b78a61e376e17c28464630c51f524a42e026","unresolved":false,"context_lines":[{"line_number":207,"context_line":"                self._plugin_failed(file_name, \u0027invalid key: %s\u0027 % key)"},{"line_number":208,"context_line":"                continue"},{"line_number":209,"context_line":"            if \u0027value\u0027 not in metric.keys():"},{"line_number":210,"context_line":"                metrics.remove(metric)  # missing name"},{"line_number":211,"context_line":"                invalid_metric \u003d metric"},{"line_number":212,"context_line":"                self._plugin_failed(file_name, \u0027invalid key: %s\u0027 % key)"},{"line_number":213,"context_line":"                continue"},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"            if \u0027name\u0027 in metric:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a95cdbc_38601901","line":212,"range":{"start_line":210,"start_character":16,"end_line":212,"end_character":71},"in_reply_to":"1a95cdbc_da7012df","updated":"2016-10-07 13:17:47.000000000","message":"Opps. It\u0027s a bug. I attempted a refactor in an earlier version of the code and then undid it. The message should read \"no value supplied\" or similar","commit_id":"a3c5331712436586e282ea880f6f047b42eb70b2"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":8,"context_line":"import os"},{"line_number":9,"context_line":"import time"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"from monasca_agent.collector.checks import AgentCheck"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"OK \u003d 0"},{"line_number":14,"context_line":"WARN \u003d 1"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_d96b8fb5","line":11,"updated":"2016-11-02 22:25:43.000000000","message":"Do not import objects, only modules (*)\n\nhttp://docs.openstack.org/developer/hacking/#imports","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":8,"context_line":"import os"},{"line_number":9,"context_line":"import time"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"from monasca_agent.collector.checks import AgentCheck"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"OK \u003d 0"},{"line_number":14,"context_line":"WARN \u003d 1"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_0615829a","line":11,"in_reply_to":"ba5da102_d96b8fb5","updated":"2016-11-03 17:20:04.000000000","message":"Done","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":13,"context_line":"OK \u003d 0"},{"line_number":14,"context_line":"WARN \u003d 1"},{"line_number":15,"context_line":"FAIL \u003d 2"},{"line_number":16,"context_line":"UNKNOWN \u003d 3"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"# name used for metrics reported directly by this module"},{"line_number":19,"context_line":"PLUGIN_METRIC_NAME \u003d \u0027json_plugin.status\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_4446b64f","line":16,"updated":"2016-11-02 22:25:43.000000000","message":"Not all the variables above are used. Additionally, just wondering if this should be simplified to OK and FAIL only, so the only values that would be reported according are 0 and 1, not 0 and 2. Do you expect to ever return a WARN and UNKNOWN value?","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":13,"context_line":"OK \u003d 0"},{"line_number":14,"context_line":"WARN \u003d 1"},{"line_number":15,"context_line":"FAIL \u003d 2"},{"line_number":16,"context_line":"UNKNOWN \u003d 3"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"# name used for metrics reported directly by this module"},{"line_number":19,"context_line":"PLUGIN_METRIC_NAME \u003d \u0027json_plugin.status\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_46593a8d","line":16,"in_reply_to":"ba5da102_4446b64f","updated":"2016-11-03 17:20:04.000000000","message":"Carryover from other code that used check_mk values. Fixing","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":16,"context_line":"UNKNOWN \u003d 3"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"# name used for metrics reported directly by this module"},{"line_number":19,"context_line":"PLUGIN_METRIC_NAME \u003d \u0027json_plugin.status\u0027"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"# Assumes metrics file written every 60 seconds"},{"line_number":22,"context_line":"DEFAULT_STALE_AGE \u003d 60 * 4                # These are too old to report"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_d9754f64","line":19,"updated":"2016-11-02 22:25:43.000000000","message":"If you append monasca, then will be monasca.json_plugin.status.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":16,"context_line":"UNKNOWN \u003d 3"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"# name used for metrics reported directly by this module"},{"line_number":19,"context_line":"PLUGIN_METRIC_NAME \u003d \u0027json_plugin.status\u0027"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"# Assumes metrics file written every 60 seconds"},{"line_number":22,"context_line":"DEFAULT_STALE_AGE \u003d 60 * 4                # These are too old to report"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_a6521665","line":19,"in_reply_to":"ba5da102_d9754f64","updated":"2016-11-03 17:20:04.000000000","message":"Done","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":60,"context_line":"    In effect, the file contains a header and a list of measurements. The"},{"line_number":61,"context_line":"    header has the following fields:"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    stale_age:"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        A time in seconds. If the timestamp of a measurement is"},{"line_number":66,"context_line":"        older than this, this plugin reports a json_plugin.check metric"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_b9a7bb09","line":63,"updated":"2016-11-02 22:25:43.000000000","message":"See comment is doc file.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":60,"context_line":"    In effect, the file contains a header and a list of measurements. The"},{"line_number":61,"context_line":"    header has the following fields:"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    stale_age:"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        A time in seconds. If the timestamp of a measurement is"},{"line_number":66,"context_line":"        older than this, this plugin reports a json_plugin.check metric"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_c6e46aad","line":63,"in_reply_to":"ba5da102_b9a7bb09","updated":"2016-11-03 17:20:04.000000000","message":"See reply there.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            msg \u003d self.plugin_failures[file_name]"},{"line_number":111,"context_line":"            if msg:"},{"line_number":112,"context_line":"                if len(msg) \u003e 1024:"},{"line_number":113,"context_line":"                    msg \u003d msg[:-3] + \u0027...\u0027"},{"line_number":114,"context_line":"                plugin_metrics.append(dict("},{"line_number":115,"context_line":"                    metric\u003dPLUGIN_METRIC_NAME,"},{"line_number":116,"context_line":"                    dimensions\u003d{\u0027path\u0027: file_name},"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_f9c21384","line":113,"updated":"2016-11-02 22:25:43.000000000","message":"See, https://github.com/openstack/monasca-api/blob/master/docs/monasca-api-spec.md#request-body-2, but the length of value_meta is restricted as specified there.\n\nI\u0027m wondering if you should use the validation code at, https://github.com/openstack/monasca-common/blob/master/monasca_common/validation/metrics.py#L77, to validate if the value_meta is OK?\n\nAlso, just subtracting of three elements and appending ..., doesn\u0027t seem correct.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            msg \u003d self.plugin_failures[file_name]"},{"line_number":111,"context_line":"            if msg:"},{"line_number":112,"context_line":"                if len(msg) \u003e 1024:"},{"line_number":113,"context_line":"                    msg \u003d msg[:-3] + \u0027...\u0027"},{"line_number":114,"context_line":"                plugin_metrics.append(dict("},{"line_number":115,"context_line":"                    metric\u003dPLUGIN_METRIC_NAME,"},{"line_number":116,"context_line":"                    dimensions\u003d{\u0027path\u0027: file_name},"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_8adc0276","line":113,"in_reply_to":"ba5da102_f6c119e5","updated":"2016-11-04 18:05:13.000000000","message":"Done","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            msg \u003d self.plugin_failures[file_name]"},{"line_number":111,"context_line":"            if msg:"},{"line_number":112,"context_line":"                if len(msg) \u003e 1024:"},{"line_number":113,"context_line":"                    msg \u003d msg[:-3] + \u0027...\u0027"},{"line_number":114,"context_line":"                plugin_metrics.append(dict("},{"line_number":115,"context_line":"                    metric\u003dPLUGIN_METRIC_NAME,"},{"line_number":116,"context_line":"                    dimensions\u003d{\u0027path\u0027: file_name},"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_f6c119e5","line":113,"in_reply_to":"ba5da102_f9c21384","updated":"2016-11-03 17:20:04.000000000","message":"It\u0027s pretty hard to get this *exactly* and in most similar situations, the plugin goes well below the limit both to a) make sure we *are* below the limit and b) to save space, where (b) is the main motivator (if 1000 chars does not give you a good clue, adding another 1000 probably won\u0027t help)\n\nThe [:-3] is a bug, it should be [:1021]","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":122,"context_line":"                    metric\u003dPLUGIN_METRIC_NAME,"},{"line_number":123,"context_line":"                    dimensions\u003d{\u0027path\u0027: file_name},"},{"line_number":124,"context_line":"                    value\u003dOK,"},{"line_number":125,"context_line":"                    timestamp\u003dself.now))"},{"line_number":126,"context_line":"        return plugin_metrics"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    @staticmethod"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_c4e9e6b8","line":125,"updated":"2016-11-02 22:25:43.000000000","message":"It might be a little nicer to code the above as something like\n\nvalue \u003d OK\nmsg \u003d None\n\nif len(msg) \u003e MAX_VALUE_META_LENGTH:\n    msg \u003d ...\n    value \u003d FAIL\n    value_meta \u003d dict(msg\u003dmsg)\n\nplugin_metrics.append(...","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":122,"context_line":"                    metric\u003dPLUGIN_METRIC_NAME,"},{"line_number":123,"context_line":"                    dimensions\u003d{\u0027path\u0027: file_name},"},{"line_number":124,"context_line":"                    value\u003dOK,"},{"line_number":125,"context_line":"                    timestamp\u003dself.now))"},{"line_number":126,"context_line":"        return plugin_metrics"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    @staticmethod"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_166ccd06","line":125,"in_reply_to":"ba5da102_c4e9e6b8","updated":"2016-11-03 17:20:04.000000000","message":"Done","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        return plugin_metrics"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    @staticmethod"},{"line_number":129,"context_line":"    def _take_shared_lock(fd):"},{"line_number":130,"context_line":"        \"\"\"Take shared lock on a file descriptor"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"        Assuming the writer of the JSON file also takes a lock, this"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_199fc75f","line":129,"updated":"2016-11-02 22:25:43.000000000","message":"I think _lock_file, would have been a better name.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":138,"context_line":"        :param fd: the file descriptor of the file being read"},{"line_number":139,"context_line":"        \"\"\""},{"line_number":140,"context_line":"        max_attempts \u003d 5"},{"line_number":141,"context_line":"        delay \u003d 0.02"},{"line_number":142,"context_line":"        attempts \u003d 0"},{"line_number":143,"context_line":"        while True:"},{"line_number":144,"context_line":"            attempts +\u003d 1"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_19ad0788","line":141,"updated":"2016-11-02 22:25:43.000000000","message":"Should max_attempts/max_retries and delay/retry_msecs, be configurable?","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":158,"context_line":"            with open(file_name, \u0027r\u0027) as f:"},{"line_number":159,"context_line":"                self._take_shared_lock(f)"},{"line_number":160,"context_line":"                f.seek(0)"},{"line_number":161,"context_line":"                file_data \u003d json.load(f)"},{"line_number":162,"context_line":"        except (ValueError, TypeError) as e:"},{"line_number":163,"context_line":"            self._plugin_failed(file_name,"},{"line_number":164,"context_line":"                                \u0027failed parsing json: %s\u0027 % e)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_f975b3ca","line":161,"updated":"2016-11-02 22:25:43.000000000","message":"I believe that this should be converted to safe_load. We had a security issue for this recently, that needed to be addressed.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":158,"context_line":"            with open(file_name, \u0027r\u0027) as f:"},{"line_number":159,"context_line":"                self._take_shared_lock(f)"},{"line_number":160,"context_line":"                f.seek(0)"},{"line_number":161,"context_line":"                file_data \u003d json.load(f)"},{"line_number":162,"context_line":"        except (ValueError, TypeError) as e:"},{"line_number":163,"context_line":"            self._plugin_failed(file_name,"},{"line_number":164,"context_line":"                                \u0027failed parsing json: %s\u0027 % e)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_6aceceb5","line":161,"in_reply_to":"ba5da102_297ed669","updated":"2016-11-04 18:05:13.000000000","message":"oh yeah, i\u0027ve got yaml on the brain now.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":158,"context_line":"            with open(file_name, \u0027r\u0027) as f:"},{"line_number":159,"context_line":"                self._take_shared_lock(f)"},{"line_number":160,"context_line":"                f.seek(0)"},{"line_number":161,"context_line":"                file_data \u003d json.load(f)"},{"line_number":162,"context_line":"        except (ValueError, TypeError) as e:"},{"line_number":163,"context_line":"            self._plugin_failed(file_name,"},{"line_number":164,"context_line":"                                \u0027failed parsing json: %s\u0027 % e)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_297ed669","line":161,"in_reply_to":"ba5da102_f975b3ca","updated":"2016-11-03 17:20:04.000000000","message":"I think you are thinking of yaml.safe_load()","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        metrics \u003d self._validate_metrics(metrics, file_name)"},{"line_number":184,"context_line":"        return self._remove_duplicate_metrics(handling, metrics, file_name)"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"    def _validate_metrics(self, metrics, file_name):"},{"line_number":187,"context_line":"        \"\"\"Remove invalid metrics from the metric list"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":"        Also cleans up the metric for posting to AgentCheck.gauge()"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_caa1ef47","line":186,"updated":"2016-11-02 22:25:43.000000000","message":"Technically speaking this is filtering valid metrics. Not to be too pedantic on names, but would _filter_valid_metrics would be a better name. I usually think of functions called _validate_metrics as returning either a boolean or throwing an exception, not returning a list of metrics.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        metrics \u003d self._validate_metrics(metrics, file_name)"},{"line_number":184,"context_line":"        return self._remove_duplicate_metrics(handling, metrics, file_name)"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"    def _validate_metrics(self, metrics, file_name):"},{"line_number":187,"context_line":"        \"\"\"Remove invalid metrics from the metric list"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":"        Also cleans up the metric for posting to AgentCheck.gauge()"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_09403206","line":186,"in_reply_to":"ba5da102_caa1ef47","updated":"2016-11-03 17:20:04.000000000","message":"Done","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":210,"context_line":"                metric[\u0027metric\u0027] \u003d metric.get(\u0027name\u0027)"},{"line_number":211,"context_line":"                del metric[\u0027name\u0027]"},{"line_number":212,"context_line":"            if not metric.get(\u0027dimensions\u0027, None):"},{"line_number":213,"context_line":"                metric[\u0027dimensions\u0027] \u003d {}"},{"line_number":214,"context_line":"            valid_metrics.append(metric)"},{"line_number":215,"context_line":""},{"line_number":216,"context_line":"        if invalid_metric:"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_d9fb8f77","line":213,"updated":"2016-11-02 22:25:43.000000000","message":"You might be able to use the validation code in monasca-common at, https://github.com/openstack/monasca-common/blob/master/monasca_common/validation/metrics.py","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":210,"context_line":"                metric[\u0027metric\u0027] \u003d metric.get(\u0027name\u0027)"},{"line_number":211,"context_line":"                del metric[\u0027name\u0027]"},{"line_number":212,"context_line":"            if not metric.get(\u0027dimensions\u0027, None):"},{"line_number":213,"context_line":"                metric[\u0027dimensions\u0027] \u003d {}"},{"line_number":214,"context_line":"            valid_metrics.append(metric)"},{"line_number":215,"context_line":""},{"line_number":216,"context_line":"        if invalid_metric:"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_8a4a4226","line":213,"in_reply_to":"ba5da102_47113103","updated":"2016-11-04 18:05:13.000000000","message":"OK, thanks for trying.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":210,"context_line":"                metric[\u0027metric\u0027] \u003d metric.get(\u0027name\u0027)"},{"line_number":211,"context_line":"                del metric[\u0027name\u0027]"},{"line_number":212,"context_line":"            if not metric.get(\u0027dimensions\u0027, None):"},{"line_number":213,"context_line":"                metric[\u0027dimensions\u0027] \u003d {}"},{"line_number":214,"context_line":"            valid_metrics.append(metric)"},{"line_number":215,"context_line":""},{"line_number":216,"context_line":"        if invalid_metric:"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_47113103","line":213,"in_reply_to":"ba5da102_d9fb8f77","updated":"2016-11-03 17:20:04.000000000","message":"Spent a bit of time trying to get this to work, but it can\u0027t work since of the \"metric\" vs \"name\" thing. Besides, I realised that what we\u0027re doing here is to make sure the argument to AgentCheck.guage() is correct - not that the metric is valid.\n\nI\u0027ve updated the description of this function.\n\n(BTW: calling these functions would have involved adding monasca-common to requirements.txt)","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"728cdd5695ef41fb804a396989803c7ccf2b8141","unresolved":false,"context_lines":[{"line_number":218,"context_line":"            self._plugin_failed(file_name, \u0027invalid metric found: %s\u0027 % metric)"},{"line_number":219,"context_line":"        return valid_metrics"},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"    def _remove_duplicate_metrics(self, handling, metrics, file_name):"},{"line_number":222,"context_line":"        \"\"\"Remove metrics if we\u0027ve already reported them"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        We track the metrics we\u0027ve posted to the Monasca Agent This allows us"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_6a4d4399","line":221,"range":{"start_line":221,"start_character":8,"end_line":221,"end_character":33},"updated":"2016-11-02 22:25:43.000000000","message":"I was wondering if the Agent should delete the metrics that are sent to the Monasca API after sending them, rather than trying to detect duplicates in the case that the Agent is running more frequently than the writer. Is there more than one consumer expected of this file? If not, then would that be simpler?","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"611aca28973c90e686d1167dd42b94389bf9352b","unresolved":false,"context_lines":[{"line_number":218,"context_line":"            self._plugin_failed(file_name, \u0027invalid metric found: %s\u0027 % metric)"},{"line_number":219,"context_line":"        return valid_metrics"},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"    def _remove_duplicate_metrics(self, handling, metrics, file_name):"},{"line_number":222,"context_line":"        \"\"\"Remove metrics if we\u0027ve already reported them"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        We track the metrics we\u0027ve posted to the Monasca Agent This allows us"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_2a6216ae","line":221,"range":{"start_line":221,"start_character":8,"end_line":221,"end_character":33},"in_reply_to":"ba5da102_4785b1cc","updated":"2016-11-04 18:05:13.000000000","message":"OK, sounds good.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"3c95cf7177e1701143ea220a2f8e756a10980e5b","unresolved":false,"context_lines":[{"line_number":218,"context_line":"            self._plugin_failed(file_name, \u0027invalid metric found: %s\u0027 % metric)"},{"line_number":219,"context_line":"        return valid_metrics"},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"    def _remove_duplicate_metrics(self, handling, metrics, file_name):"},{"line_number":222,"context_line":"        \"\"\"Remove metrics if we\u0027ve already reported them"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        We track the metrics we\u0027ve posted to the Monasca Agent This allows us"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5da102_4785b1cc","line":221,"range":{"start_line":221,"start_character":8,"end_line":221,"end_character":33},"in_reply_to":"ba5da102_6a4d4399","updated":"2016-11-03 17:20:04.000000000","message":"You mean deleting them from the json file? I can\u0027t see how that would work -- we\u0027ve no control over what the \"writer\" writes to the file -- just because the plugin overwrites the file does not mean the \"writer\" won\u0027t write the same set of metrics (with same timestamp) again.\n\nIn fact, we we have one piece of \"writer\" code that on-purpose writes two cycles-worth of data to the json file. This means the \"writer\" can be sure the Agent didn\u0027t miss a cycle because it was stalled doing something else.","commit_id":"761acdbc250b024cd2be3aece7a66a879b6a0ca4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9c7a0f501a0b6c5d2f50a77eb34d7dcd4d683c6d","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    {"},{"line_number":41,"context_line":"        \"stale_age\": 300,"},{"line_number":42,"context_line":"        \"interpolate_timestamps\": false,"},{"line_number":43,"context_line":"        \"measurements: ["},{"line_number":44,"context_line":"            {"},{"line_number":45,"context_line":"                \"metric\": \"a_metric\","}],"source_content_type":"text/x-python","patch_set":4,"id":"ba5da102_749dd358","line":42,"range":{"start_line":42,"start_character":9,"end_line":42,"end_character":31},"updated":"2016-11-04 20:17:09.000000000","message":"Should be replace_timestamps","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"d1cdd92b3d39cb6fbd79c4ff9e2d0dbceef368cd","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    {"},{"line_number":41,"context_line":"        \"stale_age\": 300,"},{"line_number":42,"context_line":"        \"interpolate_timestamps\": false,"},{"line_number":43,"context_line":"        \"measurements: ["},{"line_number":44,"context_line":"            {"},{"line_number":45,"context_line":"                \"metric\": \"a_metric\","}],"source_content_type":"text/x-python","patch_set":4,"id":"9a629dbe_c6644c4b","line":42,"range":{"start_line":42,"start_character":9,"end_line":42,"end_character":31},"in_reply_to":"ba5da102_749dd358","updated":"2016-11-07 11:07:03.000000000","message":"Doh. I changed the doc, but seem to have nat carried through to the code.\nFixed in next draft.","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9c7a0f501a0b6c5d2f50a77eb34d7dcd4d683c6d","unresolved":false,"context_lines":[{"line_number":168,"context_line":"                metrics \u003d file_data.get(\u0027measurements\u0027, [])"},{"line_number":169,"context_line":"                handling[\u0027stale_age\u0027] \u003d file_data.get(\u0027stale_age\u0027,"},{"line_number":170,"context_line":"                                                      DEFAULT_STALE_AGE)"},{"line_number":171,"context_line":"                handling[\u0027interpolate_timestamps\u0027] \u003d file_data.get("},{"line_number":172,"context_line":"                    \u0027interpolate_timestamps\u0027, False)"},{"line_number":173,"context_line":"        except Exception as e:  # noqa"},{"line_number":174,"context_line":"            self._plugin_failed(file_name,"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba5da102_f44563b3","line":171,"range":{"start_line":171,"start_character":26,"end_line":171,"end_character":48},"updated":"2016-11-04 20:17:09.000000000","message":"Should be replace_timestamps","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"d1cdd92b3d39cb6fbd79c4ff9e2d0dbceef368cd","unresolved":false,"context_lines":[{"line_number":168,"context_line":"                metrics \u003d file_data.get(\u0027measurements\u0027, [])"},{"line_number":169,"context_line":"                handling[\u0027stale_age\u0027] \u003d file_data.get(\u0027stale_age\u0027,"},{"line_number":170,"context_line":"                                                      DEFAULT_STALE_AGE)"},{"line_number":171,"context_line":"                handling[\u0027interpolate_timestamps\u0027] \u003d file_data.get("},{"line_number":172,"context_line":"                    \u0027interpolate_timestamps\u0027, False)"},{"line_number":173,"context_line":"        except Exception as e:  # noqa"},{"line_number":174,"context_line":"            self._plugin_failed(file_name,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a629dbe_8603340f","line":171,"range":{"start_line":171,"start_character":26,"end_line":171,"end_character":48},"in_reply_to":"ba5da102_f44563b3","updated":"2016-11-07 11:07:03.000000000","message":"Done","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9c7a0f501a0b6c5d2f50a77eb34d7dcd4d683c6d","unresolved":false,"context_lines":[{"line_number":169,"context_line":"                handling[\u0027stale_age\u0027] \u003d file_data.get(\u0027stale_age\u0027,"},{"line_number":170,"context_line":"                                                      DEFAULT_STALE_AGE)"},{"line_number":171,"context_line":"                handling[\u0027interpolate_timestamps\u0027] \u003d file_data.get("},{"line_number":172,"context_line":"                    \u0027interpolate_timestamps\u0027, False)"},{"line_number":173,"context_line":"        except Exception as e:  # noqa"},{"line_number":174,"context_line":"            self._plugin_failed(file_name,"},{"line_number":175,"context_line":"                                \u0027unable to process file contents: %s\u0027 % e)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba5da102_1411f7af","line":172,"range":{"start_line":172,"start_character":21,"end_line":172,"end_character":43},"updated":"2016-11-04 20:17:09.000000000","message":"Should be replace_timestamps","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"d1cdd92b3d39cb6fbd79c4ff9e2d0dbceef368cd","unresolved":false,"context_lines":[{"line_number":169,"context_line":"                handling[\u0027stale_age\u0027] \u003d file_data.get(\u0027stale_age\u0027,"},{"line_number":170,"context_line":"                                                      DEFAULT_STALE_AGE)"},{"line_number":171,"context_line":"                handling[\u0027interpolate_timestamps\u0027] \u003d file_data.get("},{"line_number":172,"context_line":"                    \u0027interpolate_timestamps\u0027, False)"},{"line_number":173,"context_line":"        except Exception as e:  # noqa"},{"line_number":174,"context_line":"            self._plugin_failed(file_name,"},{"line_number":175,"context_line":"                                \u0027unable to process file contents: %s\u0027 % e)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a629dbe_d103240c","line":172,"range":{"start_line":172,"start_character":21,"end_line":172,"end_character":43},"in_reply_to":"ba5da102_1411f7af","updated":"2016-11-07 11:07:03.000000000","message":"Done","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9c7a0f501a0b6c5d2f50a77eb34d7dcd4d683c6d","unresolved":false,"context_lines":[{"line_number":180,"context_line":"    def _filter_metrics(self, metrics, file_name):"},{"line_number":181,"context_line":"        \"\"\"Remove invalid metrics from the metric list"},{"line_number":182,"context_line":""},{"line_number":183,"context_line":"        Validate tand clean up so the metric is suitable for passing to"},{"line_number":184,"context_line":"        AgentCheck.gauge(). The metric might be invalid (e.g., value_meta too"},{"line_number":185,"context_line":"        long), but that\u0027s not our concern here."},{"line_number":186,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"ba5da102_1bd76224","line":183,"range":{"start_line":183,"start_character":17,"end_line":183,"end_character":21},"updated":"2016-11-04 20:17:09.000000000","message":"s/tand/and/","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"d1cdd92b3d39cb6fbd79c4ff9e2d0dbceef368cd","unresolved":false,"context_lines":[{"line_number":180,"context_line":"    def _filter_metrics(self, metrics, file_name):"},{"line_number":181,"context_line":"        \"\"\"Remove invalid metrics from the metric list"},{"line_number":182,"context_line":""},{"line_number":183,"context_line":"        Validate tand clean up so the metric is suitable for passing to"},{"line_number":184,"context_line":"        AgentCheck.gauge(). The metric might be invalid (e.g., value_meta too"},{"line_number":185,"context_line":"        long), but that\u0027s not our concern here."},{"line_number":186,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"9a629dbe_313aa0ce","line":183,"range":{"start_line":183,"start_character":17,"end_line":183,"end_character":21},"in_reply_to":"ba5da102_1bd76224","updated":"2016-11-07 11:07:03.000000000","message":"Done","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"9c7a0f501a0b6c5d2f50a77eb34d7dcd4d683c6d","unresolved":false,"context_lines":[{"line_number":232,"context_line":"        \"\"\""},{"line_number":233,"context_line":""},{"line_number":234,"context_line":"        # Set timestamp if asked"},{"line_number":235,"context_line":"        if handling[\u0027interpolate_timestamps\u0027]:"},{"line_number":236,"context_line":"            for metric in metrics:"},{"line_number":237,"context_line":"                metric[\u0027timestamp\u0027] \u003d self.now"},{"line_number":238,"context_line":"            # Since we\u0027ve set the timestamp, these are unique (not duplicate)"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba5da102_d6477f49","line":235,"range":{"start_line":235,"start_character":21,"end_line":235,"end_character":43},"updated":"2016-11-04 20:17:09.000000000","message":"Should be replace_timestamps","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"d1cdd92b3d39cb6fbd79c4ff9e2d0dbceef368cd","unresolved":false,"context_lines":[{"line_number":232,"context_line":"        \"\"\""},{"line_number":233,"context_line":""},{"line_number":234,"context_line":"        # Set timestamp if asked"},{"line_number":235,"context_line":"        if handling[\u0027interpolate_timestamps\u0027]:"},{"line_number":236,"context_line":"            for metric in metrics:"},{"line_number":237,"context_line":"                metric[\u0027timestamp\u0027] \u003d self.now"},{"line_number":238,"context_line":"            # Since we\u0027ve set the timestamp, these are unique (not duplicate)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a629dbe_513714e3","line":235,"range":{"start_line":235,"start_character":21,"end_line":235,"end_character":43},"in_reply_to":"ba5da102_d6477f49","updated":"2016-11-07 11:07:03.000000000","message":"Done","commit_id":"f7c5a7129bec6282c036008d04edd75ec2a601d3"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"ade4251e96c613bfaf8baa632f57af422e3c6a1c","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                handling[\u0027replace_timestamps\u0027] \u003d file_data.get("},{"line_number":172,"context_line":"                    \u0027replace_timestamps\u0027, False)"},{"line_number":173,"context_line":"        except Exception as e:  # noqa"},{"line_number":174,"context_line":"            self._plugin_failed(file_name,"},{"line_number":175,"context_line":"                                \u0027unable to process file contents: %s\u0027 % e)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        metrics \u003d self._filter_metrics(metrics, file_name)"},{"line_number":178,"context_line":"        return self._remove_duplicate_metrics(handling, metrics, file_name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_df00e203","line":175,"range":{"start_line":174,"start_character":0,"end_line":175,"end_character":74},"updated":"2016-11-17 23:56:12.000000000","message":"I think it would be safest to just return in this case rather than assume that the two methods below can handle questionable data","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"f8492f526f5a5c04e5c3effc503929d66203b33a","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                handling[\u0027replace_timestamps\u0027] \u003d file_data.get("},{"line_number":172,"context_line":"                    \u0027replace_timestamps\u0027, False)"},{"line_number":173,"context_line":"        except Exception as e:  # noqa"},{"line_number":174,"context_line":"            self._plugin_failed(file_name,"},{"line_number":175,"context_line":"                                \u0027unable to process file contents: %s\u0027 % e)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        metrics \u003d self._filter_metrics(metrics, file_name)"},{"line_number":178,"context_line":"        return self._remove_duplicate_metrics(handling, metrics, file_name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_93c40541","line":175,"range":{"start_line":174,"start_character":0,"end_line":175,"end_character":74},"in_reply_to":"7a77a97e_c1c94627","updated":"2016-11-22 17:34:54.000000000","message":"On purpose -- it allows _remove_duplicate_metrics() to purge its cache of stale metrics.","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"41f1d5be97caf59037713a16f276b10ac54385e8","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                handling[\u0027replace_timestamps\u0027] \u003d file_data.get("},{"line_number":172,"context_line":"                    \u0027replace_timestamps\u0027, False)"},{"line_number":173,"context_line":"        except Exception as e:  # noqa"},{"line_number":174,"context_line":"            self._plugin_failed(file_name,"},{"line_number":175,"context_line":"                                \u0027unable to process file contents: %s\u0027 % e)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        metrics \u003d self._filter_metrics(metrics, file_name)"},{"line_number":178,"context_line":"        return self._remove_duplicate_metrics(handling, metrics, file_name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_e4dca61a","line":175,"range":{"start_line":174,"start_character":0,"end_line":175,"end_character":74},"in_reply_to":"7a77a97e_df00e203","updated":"2016-11-22 11:20:50.000000000","message":"Good catch.","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"61c280e49163a2d42f7d5abefe172ea8e29220be","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                handling[\u0027replace_timestamps\u0027] \u003d file_data.get("},{"line_number":172,"context_line":"                    \u0027replace_timestamps\u0027, False)"},{"line_number":173,"context_line":"        except Exception as e:  # noqa"},{"line_number":174,"context_line":"            self._plugin_failed(file_name,"},{"line_number":175,"context_line":"                                \u0027unable to process file contents: %s\u0027 % e)"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        metrics \u003d self._filter_metrics(metrics, file_name)"},{"line_number":178,"context_line":"        return self._remove_duplicate_metrics(handling, metrics, file_name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_c1c94627","line":175,"range":{"start_line":174,"start_character":0,"end_line":175,"end_character":74},"in_reply_to":"7a77a97e_e4dca61a","updated":"2016-11-22 17:21:18.000000000","message":"There is still no return in the new code","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"ade4251e96c613bfaf8baa632f57af422e3c6a1c","unresolved":false,"context_lines":[{"line_number":278,"context_line":"        self.metrics_files \u003d []"},{"line_number":279,"context_line":"        self.metrics_dir \u003d instance.get(\u0027metrics_dir\u0027, \u0027\u0027)"},{"line_number":280,"context_line":"        if self.metrics_dir:"},{"line_number":281,"context_line":"            self.plugin_failures[self.metrics_dir] \u003d \u0027\u0027"},{"line_number":282,"context_line":"            try:"},{"line_number":283,"context_line":"                file_names \u003d os.listdir(self.metrics_dir)"},{"line_number":284,"context_line":"                for name in [os.path.join(self.metrics_dir, name) for"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_9f010ab2","line":281,"range":{"start_line":281,"start_character":12,"end_line":281,"end_character":55},"updated":"2016-11-17 23:56:12.000000000","message":"I don\u0027t believe that you want this line. This would cause a metric to be output for the directory that is already OK because everywhere else uses self.plugin_failures indexed by file name","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"f8492f526f5a5c04e5c3effc503929d66203b33a","unresolved":false,"context_lines":[{"line_number":278,"context_line":"        self.metrics_files \u003d []"},{"line_number":279,"context_line":"        self.metrics_dir \u003d instance.get(\u0027metrics_dir\u0027, \u0027\u0027)"},{"line_number":280,"context_line":"        if self.metrics_dir:"},{"line_number":281,"context_line":"            self.plugin_failures[self.metrics_dir] \u003d \u0027\u0027"},{"line_number":282,"context_line":"            try:"},{"line_number":283,"context_line":"                file_names \u003d os.listdir(self.metrics_dir)"},{"line_number":284,"context_line":"                for name in [os.path.join(self.metrics_dir, name) for"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_b344a1b7","line":281,"range":{"start_line":281,"start_character":12,"end_line":281,"end_character":55},"in_reply_to":"7a77a97e_53afcde2","updated":"2016-11-22 17:34:54.000000000","message":"Logging only works if the operator happens to observe a problem. A status metric allows us to identify issues more directly (via alarms). Maybe we could have a single metric to cover any errors instead of a metric/file? I\u0027ll refactor to do that.","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"61c280e49163a2d42f7d5abefe172ea8e29220be","unresolved":false,"context_lines":[{"line_number":278,"context_line":"        self.metrics_files \u003d []"},{"line_number":279,"context_line":"        self.metrics_dir \u003d instance.get(\u0027metrics_dir\u0027, \u0027\u0027)"},{"line_number":280,"context_line":"        if self.metrics_dir:"},{"line_number":281,"context_line":"            self.plugin_failures[self.metrics_dir] \u003d \u0027\u0027"},{"line_number":282,"context_line":"            try:"},{"line_number":283,"context_line":"                file_names \u003d os.listdir(self.metrics_dir)"},{"line_number":284,"context_line":"                for name in [os.path.join(self.metrics_dir, name) for"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_53afcde2","line":281,"range":{"start_line":281,"start_character":12,"end_line":281,"end_character":55},"in_reply_to":"7a77a97e_646df631","updated":"2016-11-22 17:21:18.000000000","message":"So, it looks like you\u0027ve added a metric which is the status of retrieving each metric dir or file. I just wonder if that is a good use of a metric or if logging the error would be better/sufficient. The disadvantages of the way you have it is more metrics of questionable utility and if you reconfigure the directory or file, the alarm will go to undetermined.","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"41f1d5be97caf59037713a16f276b10ac54385e8","unresolved":false,"context_lines":[{"line_number":278,"context_line":"        self.metrics_files \u003d []"},{"line_number":279,"context_line":"        self.metrics_dir \u003d instance.get(\u0027metrics_dir\u0027, \u0027\u0027)"},{"line_number":280,"context_line":"        if self.metrics_dir:"},{"line_number":281,"context_line":"            self.plugin_failures[self.metrics_dir] \u003d \u0027\u0027"},{"line_number":282,"context_line":"            try:"},{"line_number":283,"context_line":"                file_names \u003d os.listdir(self.metrics_dir)"},{"line_number":284,"context_line":"                for name in [os.path.join(self.metrics_dir, name) for"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_646df631","line":281,"range":{"start_line":281,"start_character":12,"end_line":281,"end_character":55},"in_reply_to":"7a77a97e_9f010ab2","updated":"2016-11-22 11:20:50.000000000","message":"If we ever get a failure at directory level (line 290), we report a failure metric. If we don\u0027t report ok at the directory level, an alarm generated as a result of the directory-level failure will never clear -- even if the directory-level problem is fixed [at best it will go undetermined]","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"31ebf99222c31861db632e750bd456c748db4b82","unresolved":false,"context_lines":[{"line_number":278,"context_line":"        self.metrics_files \u003d []"},{"line_number":279,"context_line":"        self.metrics_dir \u003d instance.get(\u0027metrics_dir\u0027, \u0027\u0027)"},{"line_number":280,"context_line":"        if self.metrics_dir:"},{"line_number":281,"context_line":"            self.plugin_failures[self.metrics_dir] \u003d \u0027\u0027"},{"line_number":282,"context_line":"            try:"},{"line_number":283,"context_line":"                file_names \u003d os.listdir(self.metrics_dir)"},{"line_number":284,"context_line":"                for name in [os.path.join(self.metrics_dir, name) for"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_5377cdd3","line":281,"range":{"start_line":281,"start_character":12,"end_line":281,"end_character":55},"in_reply_to":"7a77a97e_b344a1b7","updated":"2016-11-22 17:38:13.000000000","message":"Before you do that, I would suggest seeing if other people comment. Maybe I\u0027m wrong :)","commit_id":"d0c8abe7dd6116fc4475bf9627a4b9887b603cc4"}],"monasca_setup/detection/plugins/json_plugin.py":[{"author":{"_account_id":1706,"name":"Tom Hancock","email":"tom.hancock@hp.com","username":"tom-hancock"},"change_message_id":"730ec11d9b23ef4270a19c806e574ae5640cff3a","unresolved":false,"context_lines":[{"line_number":38,"context_line":"        self.available \u003d False"},{"line_number":39,"context_line":"        if os.path.isdir(VAR_CACHE_DIR):"},{"line_number":40,"context_line":"            self.available \u003d True"},{"line_number":41,"context_line":"        self.available \u003d True"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    def build_config(self):"},{"line_number":44,"context_line":"        \"\"\"Build the config as a Plugins object and return.\"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"1a95cdbc_c6107804","line":41,"range":{"start_line":41,"start_character":25,"end_line":41,"end_character":29},"updated":"2016-10-06 11:09:58.000000000","message":"is this last line needed","commit_id":"22f81c24066a3a6c151e3242245d3dad6822e2b3"},{"author":{"_account_id":860,"name":"Donagh McCabe","email":"donagh.mccabe@gmail.com","username":"donagh-mccabe"},"change_message_id":"9b2ec82447f0b95dc7a1256b377523bb3fc91f4f","unresolved":false,"context_lines":[{"line_number":38,"context_line":"        self.available \u003d False"},{"line_number":39,"context_line":"        if os.path.isdir(VAR_CACHE_DIR):"},{"line_number":40,"context_line":"            self.available \u003d True"},{"line_number":41,"context_line":"        self.available \u003d True"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    def build_config(self):"},{"line_number":44,"context_line":"        \"\"\"Build the config as a Plugins object and return.\"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"1a95cdbc_89c9ee28","line":41,"range":{"start_line":41,"start_character":25,"end_line":41,"end_character":29},"in_reply_to":"1a95cdbc_c6107804","updated":"2016-10-07 09:30:05.000000000","message":"Done","commit_id":"22f81c24066a3a6c151e3242245d3dad6822e2b3"}]}
