[PATCH v2 compass-ci] doc/stats-rule.md

[Why] The rules to follow when writing the stats script. Signed-off-by: Wang Chenglong <18509160991@163.com> --- doc/stats-rule.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 doc/stats-rule.md diff --git a/doc/stats-rule.md b/doc/stats-rule.md new file mode 100644 index 0000000..0fb557a --- /dev/null +++ b/doc/stats-rule.md @@ -0,0 +1,42 @@ +${LKP_SERVER}/stats/${script} stat������������ +========================================== + +## ������������������������������������������������������������������es������������ + +1.������error_id������������������������������������ + - original: {"changed": false, "failures": ["No package yum-plugin-priorities available."], "msg": "Failed to + install some of the specified packages", "rc": 1, "results": []} + + - error_id: error.No-package-yum-plugin-priorities-available: 1 + +2.��������������������������������������������������������������������� + - ������������������������������������������������error_id��� + # ��������������������������������������� + # {"changed": false, "cmd": "csf -v", "msg": "[Errno 2] No such file or directory: b'csf': b'csf'", "rc": 2} + when /(No such file or directory: b'.+')/ + output_error $1 + end + + - ������������jobs������������������������������������'������'���������es���������error_id.���������������stats/${script}������ + +3.������������������������������������������error message��� + # original error message + # {"changed": false, "msg": "Failed to download packages: Cannot download 7.10.2/filebeat-7.10.2-aarch64.rpm: + # All mirrors were tried", "results": []} + when /(Failed to download packages: Cannot download .+):/ + output_error $1 + end + +4.������������������error_id��������������������������������������� + - ������������������������������ + def common_error_id(line) + line = line.chomp + line.gsub!(/ /, '-') + line.gsub!(/:/, '') # error.:-'__mysql_packages'-is-undefined: 1 + line.gsub!(/,/, '') + line.gsub!(/'/, '') # Failed-to-download-metadata-for-repo-'dockerrepo: 1 + line.gsub!(/!/, '') # Distribution-openEuler-is-not-supported-by-this-role!: 1 + line.gsub!(/{%/, ' ') + line.gsub!(/%}/, ' ') + line + end -- 2.23.0

+4.需要对输出的error_id中含有的特殊字符进行处理。 + - 单引号,空格,冒号等
1. 定义一个白名单。名单之外的字符,统统替换为'-'. 2. 各种数字,统统替换为'#'. 3. 连续的-, #替换为单个
+ def common_error_id(line) + line = line.chomp + line.gsub!(/ /, '-') + line.gsub!(/:/, '') # error.:-'__mysql_packages'-is-undefined: 1 + line.gsub!(/,/, '') + line.gsub!(/'/, '') # Failed-to-download-metadata-for-repo-'dockerrepo: 1 + line.gsub!(/!/, '') # Distribution-openEuler-is-not-supported-by-this-role!: 1 + line.gsub!(/{%/, ' ') + line.gsub!(/%}/, ' ') + line + end -- 2.23.0

On Wed, Feb 24, 2021 at 03:20:36PM +0800, Wu Fengguang wrote:
+4.需要对输出的error_id中含有的特殊字符进行处理。 + - 单引号,空格,冒号等
1. 定义一个白名单。名单之外的字符,统统替换为'-'. 2. 各种数字,统统替换为'#'. 3. 连续的-, #替换为单个
Got it. Thanks, Chenglong
+ def common_error_id(line) + line = line.chomp + line.gsub!(/ /, '-') + line.gsub!(/:/, '') # error.:-'__mysql_packages'-is-undefined: 1 + line.gsub!(/,/, '') + line.gsub!(/'/, '') # Failed-to-download-metadata-for-repo-'dockerrepo: 1 + line.gsub!(/!/, '') # Distribution-openEuler-is-not-supported-by-this-role!: 1 + line.gsub!(/{%/, ' ') + line.gsub!(/%}/, ' ') + line + end -- 2.23.0
participants (2)
-
Wang Chenglong
-
Wu Fengguang