{"id":336748,"date":"2023-10-08T15:25:56","date_gmt":"2023-10-08T07:25:56","guid":{"rendered":"https:\/\/www.idc.net\/help\/336748\/"},"modified":"2023-10-08T15:25:56","modified_gmt":"2023-10-08T07:25:56","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8k6%e5%81%9a%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/336748\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528k6\u505a\u6027\u80fd\u6d4b\u8bd5"},"content":{"rendered":"<h3>\u80cc\u666f<\/h3>\n<p>\u9879\u76ee\u7684\u76ee\u6807\u662f\u4e3a\u5ba2\u6237\u4ea4\u4ed8\u4e00\u4e2aToC\u7684APP\uff0c\u5176\u540e\u7aef\u662f\u57fa\u4e8eRESTful\u7684\u5fae\u670d\u52a1\u67b6\u6784\uff0c\u540c\u65f6\u540e\u7aef\u8fd8\u91c7\u7528\u4e86Protobuf\u534f\u8bae\u6765\u63d0\u9ad8\u4f20\u8f93\u6548\u7387\u3002\u5728\u6700\u7ec8\u4e0a\u7ebf\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u6267\u884c\u6027\u80fd\u6d4b\u8bd5\u4ee5\u786e\u5b9a\u7cfb\u7edf\u5728\u6b63\u5e38\u548c\u9884\u671f\u5cf0\u503c\u8d1f\u8f7d\u6761\u4ef6\u4e0b\u7684\u8868\u73b0\uff0c\u4ece\u800c\u8bc6\u522b\u5e94\u7528\u7a0b\u5e8f\u7684\u6700\u5927\u8fd0\u884c\u5bb9\u91cf\u4ee5\u53ca\u5b58\u5728\u7684\u74f6\u9888\uff0c\u5e76\u9488\u5bf9\u6027\u80fd\u95ee\u9898\u8fdb\u884c\u4f18\u5316\u4ee5\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<p>\u6027\u80fd\u6d4b\u8bd5\u662f\u4e00\u4e2a\u8f83\u4e3a\u590d\u6742\u7684\u4efb\u52a1\uff0c\u5305\u62ec\u786e\u5b9a\u6027\u80fd\u6d4b\u8bd5\u76ee\u6807\uff0c\u5de5\u5177\u9009\u62e9\uff0c\u811a\u672c\u5f00\u53d1\uff0cCI\u96c6\u6210\uff0c\u7ed3\u679c\u5206\u6790\uff0c\u6027\u80fd\u8c03\u4f18\u7b49\u8fc7\u7a0b\uff0c\u9700\u8981QA\uff0cDev\uff0cDevops\u534f\u529b\u5408\u4f5c\u3002\u672c\u6587\u5c06\u5bf9\u8fd9\u4e00\u7cfb\u5217\u8fc7\u7a0b\u8fdb\u884c\u8be6\u7ec6\u63cf\u8ff0\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s8.\/oss\/202205\/26\/951bdf4215170fdd7c09395d12d42f760af00f.jpg\" style=\"width: 3561px;height: 1379px\" class=\"aligncenter\"><\/p>\n<h3>\u4e3a\u4ec0\u4e48\u9009\u62e9k6<\/h3>\n<p>\u5728\u5f97\u77e5\u9700\u8981\u505a\u6027\u80fd\u6d4b\u8bd5\u540e\uff0c\u6211\u4eec\u5c31\u5f00\u59cb\u9488\u5bf9\u6027\u80fd\u6d4b\u8bd5\u505a\u4e86\u4e00\u756a\u8c03\u7814\uff0c\u5728\u9605\u8bfb\u4e86\u4e00\u4e9b\u6027\u80fd\u6d4b\u8bd5\u5de5\u5177\u5bf9\u6bd4\u7684\u6587\u7ae0\u540e\uff0c\u6700\u7ec8\u6311\u9009\u4e86k6\uff0clocust\u548cGatling\u505a\u4e86\u8fdb\u4e00\u6b65\u5bf9\u6bd4\uff0c\u4e0b\u9762\u662f\u5bf9\u6bd4\u7684\u7ed3\u679c\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s2.\/oss\/202205\/26\/4633d8659c9c96f058402860a5b19a6351c4bd.png\" style=\"width: 916px;height: 942px\" class=\"aligncenter\"><\/p>\n<p>\u5bf9\u6211\u4eec\u6765\u8bf4\uff0ck6\u7684\u4f18\u52bf\u5728\u4e8e\uff1a<\/p>\n<ul>\n<li>k6\u652f\u6301TypeScript\uff0c\u7531\u4e8e\u9879\u76ee\u4e0a\u5df2\u7ecf\u6709TypeScript\u4f7f\u7528\u7ecf\u9a8c\uff0c\u56e0\u6b64\u8be5\u5de5\u5177\u5b66\u4e60\u6210\u672c\u76f8\u5bf9\u66f4\u5c11\uff1b<\/li>\n<li>k6\u672c\u8eab\u652f\u6301metrics\u7684\u8f93\u51fa\uff0c\u53ef\u4ee5\u6ee1\u8db3\u5927\u90e8\u5206metrics\u7684\u9700\u6c42\uff0c\u6709\u9700\u8981\u8fd8\u53ef\u4ee5\u8fdb\u884c\u81ea\u5b9a\u4e49\uff1b<\/li>\n<li>k6\u5b98\u65b9\u652f\u6301\u4e0e\u591a\u79cdCI\u5de5\u5177\uff0c\u6570\u636e\u53ef\u89c6\u5316\u7cfb\u7edf\u7684\u96c6\u6210\uff0c\u5f00\u7bb1\u5373\u7528\uff1b<\/li>\n<li>Gatling\u652f\u6301Scala\/Java\/Kotlin\uff0c\u9879\u76ee\u4e0a\u6ca1\u6709\u4f7f\u7528\u76f8\u5173\u7684\u6280\u672f\u6808\uff0c\u9700\u8981\u548c\u5ba2\u6237\u7533\u8bf7\uff0c\u6210\u672c\u9ad8\u4e8ek6\u3002<\/li>\n<\/ul>\n<h3>\u52a8\u624b\u5199\u7b2c\u4e00\u4e2acase<\/h3>\n<p>\u6709\u4e86\u4e0a\u9762\u7684\u57fa\u7840\uff0c\u6211\u4eec\u4fbf\u5f00\u59cb\u5c1d\u8bd5\u5728\u9879\u76ee\u4e2d\u96c6\u6210k6\uff0c\u5728\u9009\u4e86\u4e00\u4e2a\u7b80\u5355\u7684API\u5199\u7b2c\u4e00\u4e2acase\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u6709\u4ee5\u4e0b\u4e00\u4e9b\u6311\u6218\u9700\u8981\u89e3\u51b3\uff1a<\/p>\n<h4>\u6311\u62181-\u83b7\u53d6Access Token\u548c\u4fdd\u8bc1token\u65f6\u6548\u6027<\/h4>\n<p>\u7531\u4e8e\u5f53\u524d\u9879\u76ee\u7684API\u90fd\u96c6\u6210\u4e86OAuth\uff0c\u4efb\u4f55\u64cd\u4f5c\u90fd\u8981\u6709\u4e00\u4e2a\u6709\u6548\u7684\u7528\u6237\u548cAccess Token\uff0c\u56e0\u6b64\u9700\u8981\u63d0\u524d\u751f\u6210token\u548c\u6d4b\u8bd5\u6570\u636e\u3002\u8fd9\u4e00\u90e8\u5206\u56e0\u4e3a\u9879\u76ee\u7684\u4e0d\u540c\u4f1a\u6709\u4e00\u4e9b\u5dee\u5f02\uff0c\u9700\u8981\u5177\u4f53\u60c5\u51b5\u5177\u4f53\u5206\u6790\u3002\u5728\u6b64\u6b21\u6d4b\u8bd5\u4e2d\u5177\u4f53\u5305\u62ec\u4ee5\u4e0b\u51e0\u9879\uff1a<\/p>\n<ul>\n<li>\u7528\u6237\u8d26\u53f7\u51c6\u5907\uff0c\u6bd4\u5982\u751f\u6210200\u4e2a\u7528\u6237\uff0c\u5e76\u8fdb\u884c\u4e00\u7cfb\u5217\u7684\u524d\u7f6e\u5904\u7406\uff0c\u8ba9\u5b83\u4eec\u53d8\u6210\u53ef\u7528\u7684\u6b63\u5e38\u6d4b\u8bd5\u8d26\u53f7\uff0c\u5e76\u4e14\u9700\u6839\u636e\u9879\u76ee\u5b89\u5168\u89c4\u8303\uff0c\u4fdd\u5b58\u5230\u5408\u9002\u5730\u65b9\uff0c\u6bd4\u5982AWS Secrets Manager\u6216\u8005AWS Parameter Store\uff0c\u8fd9\u91cc\u7684\u8d26\u53f7\u53ef\u4ee5\u590d\u7528\u3002<\/li>\n<li>token\u751f\u6210\uff0c\u8fd0\u884c\u6d4b\u8bd5\u524d\uff0c\u751f\u6210\u6700\u65b0\u7684\u6709\u6548token\uff0c\u6267\u884c\u6d4b\u8bd5\u7684\u65f6\u5019\u53ea\u9700\u8981\u53bb\u8bfb\u53d6token\u6570\u636e\u3002<\/li>\n<li>token\u5237\u65b0\uff0c\u7531\u4e8etoken\u57fa\u672c\u4e0a\u90fd\u5177\u6709\u65f6\u6548\u6027\uff0c\u5982\u679c\u6709\u6548\u65f6\u95f4\u77ed\uff0c\u8fd8\u9700\u8981\u8003\u8651renew token\uff0c\u8fd9\u91cc\u6211\u4eec\u91c7\u7528refresh token\u53bb\u83b7\u53d6\u65b0access token\u7684\u65b9\u5f0f\u3002<\/li>\n<li>\u9700\u8981\u6ce8\u610f\u7684\u662f\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\u5237\u65b0token\u4f1a\u8ba1\u5165\u8bf7\u6c42\uff0c\u5bf9\u6027\u80fd\u6d4b\u8bd5\u6570\u636e\u4f1a\u6709\u4e9b\u8bb8\u5f71\u54cd\uff0c\u5237\u65b0\u673a\u5236\u9700\u8981\u7eb3\u5165\u8003\u8651\u8303\u56f4\u3002<\/li>\n<\/ul>\n<h4>\u6311\u62182-Protobuf\u6570\u636e\u7684\u7f16\u89e3\u7801<\/h4>\n<p>\u4e0b\u56fe\u7b80\u8981\u8bf4\u660e\u4e86\u524d\u540e\u7aef\u7684\u67b6\u6784\uff0cMobile\u548cBFF\u662f\u4ee5Protobuf\u683c\u5f0f\u505a\u6570\u636e\u4ea4\u6362\uff0cBFF\u548cBackend\u662f\u4ee5Json\u683c\u5f0f\u505a\u6570\u636e\u4ea4\u6362\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s9.\/oss\/202205\/26\/f582d8494f105d348163977ee0c76cde1011cf.png\" style=\"width: 936px;height: 380px\" class=\"aligncenter\"><\/p>\n<p>\u6211\u4eec\u7684\u6027\u80fd\u6d4b\u8bd5\u662f\u9488\u5bf9BFF\u7684\uff0c\u56e0\u6b64\u9700\u8981\u6839\u636e\u9879\u76ee\u4e2d\u5b9a\u4e49\u7684Protobuf\u683c\u5f0f\u5bf9\u8bf7\u6c42\u6570\u636e\u8fdb\u884c\u7f16\u7801\u518d\u53d1\u9001\u7ed9BFF\uff0c\u4eceBFF\u63a5\u53d7\u5230\u54cd\u5e94\u6570\u636e\u65f6\u4e5f\u9700\u8981\u6839\u636eProtobuf\u5b9a\u4e49\u7684\u54cd\u5e94\u683c\u5f0f\u8fdb\u884c\u89e3\u7801\uff0c\u4ece\u800c\u89e3\u6790\u51fa\u60f3\u8981\u7684\u6570\u636e\u3002<\/p>\n<p>\u53e6\u5916\u7531\u4e8e\u6027\u80fd\u6d4b\u8bd5\u91c7\u7528\u7684\u662fTypeScript\u8bed\u8a00\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u5c06Protobuf\u6587\u4ef6\u7f16\u8bd1\u6210TS\u7248\u672c\uff0c\u8fd9\u4e00\u70b9\u5728Protobuf\u5b98\u65b9\u6587\u6863\u4e0a\u7ed9\u51fa\u4e86\u89e3\u51b3\u529e\u6cd5\uff0c\u53ef\u4ee5\u5f88\u5bb9\u6613\u7684\u751f\u6210TS\u7248\u672c\u4ee3\u7801\u3002<\/p>\n<p>\u7531\u4e8e\u6bcf\u4e2aAPI\u7684\u7f16\u89e3\u7801\u7ed3\u6784\u90fd\u662f\u4e00\u4efd\u5355\u72ec\u7684proto\uff0c\u56e0\u6b64\u8fd8\u6d89\u53ca\u5230\u4ee3\u7801\u590d\u7528\u7684\u95ee\u9898\uff0c\u9700\u8981\u8bbe\u8ba1\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u8ba9\u4e0d\u540c\u7684API\u53ea\u9700\u8981\u63d0\u4f9b\u5bf9\u5e94\u7684encode\u548cdecode schema\u5373\u53ef\u3002<\/p>\n<p>\u5f53\u89e3\u51b3\u6389\u524d\u9762\u7684\u4e24\u4e2a\u6311\u6218\u540e\uff0c\u53ef\u4ee5\u521d\u6b65\u5f97\u5230\u7b26\u5408\u9879\u76ee\u9700\u6c42\u7684\u6d4b\u8bd5\u6846\u67b6\u3002<\/p>\n<pre> <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">protobuf<\/span> <span style=\"margin: 0px;padding: 0px\">file<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>        <span style=\"margin: 0px;padding: 0px\">--<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">protobuf\u6587\u4ef6<\/span><br> <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">dist<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>                 <span style=\"margin: 0px;padding: 0px\">--<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">ts\u8f6c\u6210js\u7684\u6d4b\u8bd5\u6587\u4ef6<\/span><br> <span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">src<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>                  <br>            <br>    <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">command<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>          <span style=\"margin: 0px;padding: 0px\">--<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">\u4e00\u4e9b\u811a\u672c\u6587\u4ef6<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">config<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>           <span style=\"margin: 0px;padding: 0px\">--<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">config\u6587\u4ef6<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">httpClient<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>       <span style=\"margin: 0px;padding: 0px\">--<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">http<\/span> <span style=\"margin: 0px;padding: 0px\">client<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">ProtobufSchema<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>   <span style=\"margin: 0px;padding: 0px\">--<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">\u7f16\u8bd1\u597d\u7684protobuf\u6587\u4ef6<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">test<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>             <span style=\"margin: 0px;padding: 0px\">--<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">\u6d4b\u8bd5case<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">testAccount<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span>      <span style=\"margin: 0px;padding: 0px\">--<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">\u6d4b\u8bd5\u8d26\u6237<\/span><\/pre>\n<h3>\u4f18\u5316\u9879\u76ee&amp;\u96c6\u6210CI&amp;\u53ef\u89c6\u5316\u62a5\u544a<\/h3>\n<h4>\u6d4b\u8bd5\u7528\u4f8b\u8bbe\u8ba1<\/h4>\n<p>\u5f53\u6d4b\u8bd5case\u9010\u6e10\u589e\u591a\u540e\uff0c\u6211\u4eec\u5bf9\u6d4b\u8bd5\u7528\u4f8b\u8fdb\u884c\u4e86\u591a\u6b21\u7684\u8c03\u6574\uff0c\u4f8b\u5982\u5bf9API\u8fdb\u884c\u4e86\u5206\u7c7b\uff0c\u5e76\u901a\u8fc7\u4e0d\u540c\u7684\u65b9\u5f0f\u6765\u5bf9\u4ed6\u4eec\u8fdb\u884c\u6027\u80fd\u6d4b\u8bd5\u3002<\/p>\n<h4>\u72ec\u7acbAPI<\/h4>\n<p>\u72ec\u7acbAPI\u662f\u6307\u4e0d\u4f9d\u8d56\u5176\u4ed6\u63a5\u53e3\u63d0\u4f9b\u53c2\u6570\u8f93\u5165\uff0c\u5373\u53ef\u5b8c\u6210\u8bf7\u6c42\u7684API\uff0c\u4f8b\u5982\u90e8\u5206Get\u7c7bAPI\u3002<\/p>\n<h4>\u975e\u72ec\u7acbAPI<\/h4>\n<p>\u975e\u72ec\u7acbAPI\u662f\u6307\u4f9d\u8d56\u4e8e\u5176\u4ed6API\u7ed3\u679c\u4f5c\u4e3a\u53c2\u6570\u8f93\u5165\u624d\u53ef\u5b8c\u6210\u8bf7\u6c42\u7684API\uff0c\u4f8b\u5982\u90e8\u5206Put\u3001Delete\u7c7bAPI\u3002\u7531\u4e8e\u6b64\u7c7bAPI\u4f9d\u8d56\u4e8e\u5176\u4ed6API\u7684\u7ed3\u679c\u6570\u636e\uff0c\u65e0\u6cd5\u5355\u72ec\u505a\u6027\u80fd\u6d4b\u8bd5\uff0c\u5728\u672c\u6b21\u6027\u80fd\u6d4b\u8bd5\u4e2d\u4ee5\u6574\u4f53journey\u7684\u5f62\u5f0f\u6765\u6d4b\u8fd9\u4e9b\u975e\u72ec\u7acb\u7684API\uff0c\u5728\u6d4b\u8bd5case\u4e2d\u5c06\u524d\u4e00\u6b65\u7684\u7ed3\u679c\u4f20\u7ed9\u540e\u4e00\u6b65\uff0c\u4ece\u800c\u5b8c\u6210\u6574\u4f53\u7684journey\u6d4b\u8bd5\u3002<\/p>\n<p>\u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u4f8b\u5b50\u6765\u8bf4\u660e\uff0c\u6211\u4eec\u7684test case\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<pre><span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">test<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">orderService<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">createOrder<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">createOrderRequestBuilder<\/span>.<span style=\"margin: 0px;padding: 0px\">ts<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">createOrderRequestClient<\/span>.<span style=\"margin: 0px;padding: 0px\">ts<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">createOrderTest<\/span>.<span style=\"margin: 0px;padding: 0px\">ts<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">getOrders<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">getOrdersRequestClient<\/span>.<span style=\"margin: 0px;padding: 0px\">ts<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">getOrdersTest<\/span>.<span style=\"margin: 0px;padding: 0px\">ts<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">orderJourney<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">orderJourneyTest<\/span>.<span style=\"margin: 0px;padding: 0px\">ts<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>   <span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">updateOder<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>       <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">updateOrderRequestBuilder<\/span>.<span style=\"margin: 0px;padding: 0px\">ts<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2502<\/span>       <span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">updateOrderRequestClient<\/span>.<span style=\"margin: 0px;padding: 0px\">ts<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u251c\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">payService<\/span><br>    <span style=\"margin: 0px;padding: 0px\">\u2514\u2500\u2500<\/span> <span style=\"margin: 0px;padding: 0px\">userService<\/span><\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>\u5bf9\u4e8ecreateOrder\uff0cgetOrders\u662f\u72ec\u7acbAPI\uff0c\u53ef\u4ee5\u65b9\u4fbf\u7684\u8fdb\u884c\u5355\u4e2aAPI\u8c03\u7528\uff0c\u76f4\u63a5\u8fdb\u884c\u6d4b\u8bd5\u5373\u53ef\uff1b<\/li>\n<li>\u5bf9\u4e8eupdateOder\uff0c\u5b83\u4f9d\u8d56\u4e8ecreateOrder\u7684\u7ed3\u679c\uff0c\u6240\u4ee5\u6211\u4eec\u5c06\u5b83\u4eec\u7ec4\u5408\u8d77\u6765\u5728Journey\u4e2d\u6d4b\u8bd5\uff0corderJourneyTest\u91cc\u9762\u53ef\u4ee5\u7ec4\u5408createOrder -&gt; getOrder -&gt; updateOrder\u3002<\/li>\n<\/ul>\n<h4>k6\u7684executor\u9009\u62e9<\/h4>\n<p>k6\u63d0\u4f9b\u4e86\u591a\u4e2aexecutor\uff0c\u4e0d\u540c\u7684executor\u4f1a\u4ee5\u4e0d\u540c\u7684\u65b9\u5f0f\u53bb\u6267\u884c\u6d4b\u8bd5\u3002\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u7684\u9700\u6c42\u6765\u9009\u62e9\u4e0d\u540c\u7684executor\u6765\u6267\u884c\u6d4b\u8bd5\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s2.\/oss\/202205\/26\/19a2ebf37b4246a8a2687873d93177bd2d3565.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s5.\/oss\/202205\/26\/f2afb90527627f32585656ed5a8bc7edff6ea0.png\" style=\"width: 1080px;height: 853px\" class=\"aligncenter\"><\/p>\n<h4>\u8ba9\u6027\u80fd\u6d4b\u8bd5\u5728CI\u4e0a\u8dd1\u8d77\u6765-\u96c6\u6210TeamCity<\/h4>\n<p>k6\u5b98\u65b9\u63d0\u4f9b\u4e86\u76ee\u524d\u4e3b\u6d41CI\u5de5\u5177\u7684How to\u6587\u6863\uff0c\u975e\u5e38\u5bb9\u6613\u4e0a\u624b\u3002<\/p>\n<p>\u552f\u4e00\u9700\u8981\u6ce8\u610f\u7684\u70b9\u5c31\u662f\u9700\u8981\u624b\u52a8\u8bbe\u7f6ethresholds\uff0c\u5f53\u6027\u80fd\u7ed3\u679c\u4e0d\u8fbe\u6807\u65f6\uff0ck6\u4f1a\u8fd4\u56de\u975e0\u8ba9CI\u77e5\u9053test\u5931\u8d25\u3002<\/p>\n<h4>\u5c55\u793a\u62a5\u544a-\u96c6\u6210New Relic<\/h4>\n<p>(1) \u6570\u636e\u7684\u91c7\u96c6<\/p>\n<p>k6\u652f\u6301\u591a\u79cd\u6570\u636e\u6570\u636e\u53ef\u89c6\u5316\u5de5\u5177\uff0c\u4f8b\u5982Datadog\uff0cNew Relic\uff0cGrafana\u7b49\uff0c\u52a0\u4e2a\u53c2\u6570\u5c31\u53ef\u4ee5\u8f7b\u677e\u641e\u5b9a\u3002\u6211\u4eec\u7528\u7684\u662fNew Relic\uff0c\u901a\u8fc7K6_STATSD_ENABLE_TAGS=true\u914d\u7f6e\uff0c\u53ef\u4ee5\u65b9\u4fbf\u7684\u901a\u8fc7k6\u63d0\u4f9b\u7684tag\u8fdb\u884c\u6570\u636e\u5206\u7c7b\uff0c\u5206\u7c7b\u7edf\u8ba1\u4e0d\u540cAPI\uff0cJourney\u7684\u6027\u80fd\u6570\u636e\u3002<\/p>\n<p>(2) \u6307\u6807\u7684\u5c55\u793a<\/p>\n<p>\u6307\u6807\u5c55\u793a\u4e3b\u8981\u662f\u5728\u6570\u636e\u53ef\u89c6\u5316\u5e73\u53f0\u4e0a\uff0c\u901a\u8fc7\u81ea\u5b9a\u4e49\u5404\u79cd\u56fe\u8868\u5c55\u793a\u6027\u80fd\u6307\u6807<\/p>\n<p>(3) \u6307\u6807\u7684\u6838\u5bf9<\/p>\n<p>\u8fd9\u91cc\u5176\u5b9e\u662f\u5bf9\u4e0a\u9762\u7684\u6307\u6807\u8fdb\u884c\u6838\u5bf9\uff0c\u4ee5\u4fdd\u8bc1\u6211\u4eec\u8bbe\u7f6e\u7684\u6307\u6807\u662f\u51c6\u786e\u7684\uff0c\u4e3a\u540e\u7eed\u6027\u80fd\u5206\u6790\u505a\u51c6\u5907<\/p>\n<h3>\u6d4b\u8bd5\u6267\u884c&amp;\u7ed3\u679c\u5206\u6790\u53ca\u8c03\u4f18<\/h3>\n<h4>\u6d4b\u8bd5\u6267\u884c<\/h4>\n<p>\u5728\u6267\u884c\u6d4b\u8bd5\u65f6\uff0c\u6211\u4eec\u9700\u8981\u5206\u6790\u51fa\u5f71\u54cd\u6027\u80fd\u7684\u56e0\u7d20\uff0c\u5e76\u5c3d\u91cf\u63a7\u5236\u53d8\u91cf\uff0c\u4ece\u800c\u5bf9\u591a\u6b21\u7684\u6267\u884c\u7ed3\u679c\u8fdb\u884c\u5bf9\u6bd4\u5206\u6790\uff0c\u4f8b\u5982\u90fd\u5728pipeline\u4e0a\u6267\u884c\u6765\u51cf\u5c11\u7f51\u7edc\u5f71\u54cd\uff0c\u5b9a\u671f\u68c0\u67e5\u6570\u636e\u5e93\u6570\u636e\u91cf\uff0c\u5173\u6ce8K8s\u7684pod\u6570\u91cf\u7b49\u7b49\u3002\u7ed3\u5408\u6211\u4eec\u7684\u9879\u76ee\u7279\u70b9\uff0c\u6211\u4eec\u603b\u7ed3\u4e86\u4ee5\u4e0b\u4e00\u4e9b\u56e0\u7d20\uff1a<\/p>\n<p>(1) \u6570\u636e\u5e93\u6570\u636e\u91cf<\/p>\n<p>\u6211\u4eec\u7cfb\u7edf\u4ece\u67b6\u6784\u4e0a\u6765\u6bd4\u8f83\u7b80\u5355\u6e05\u6670\uff0c\u540e\u7aef\u7528\u5230\u4e86AWS DynamoDB\uff0c\u6240\u4ee5\u6570\u636e\u91cf\u4f1a\u5bf9\u6027\u80fd\u6709\u8f83\u5927\u7684\u5f71\u54cd\uff0c\u7279\u522b\u662f\u67e5\u8be2\u7c7b\uff0c\u8ba1\u7b97\u7c7b\u7684API\uff0c\u8fd9\u91cc\u5c31\u9700\u8981\u4e86\u89e3\u7528\u6237\u5404\u4e2a\u7ef4\u5ea6\u7684\u6570\u636e\u91cf\uff0c\u6bd4\u5982\u6bcf\u4e2a\u6708\uff0c\u6bcf\u5929\u7b49\u3002<\/p>\n<p><span>(2) <\/span>\u8bf7\u6c42\u7684body\u5927\u5c0f<\/p>\n<p>\u8fd9\u4e3b\u8981\u662f\u9488\u5bf9post\u548cput\u7c7b\u63a5\u53e3\uff0c\u56e0\u4e3a\u6d89\u53ca\u5230\u6587\u4ef6\u4e0a\u4f20\uff0c\u6240\u4ee5\u6587\u4ef6\u5927\u5c0f\u4e5f\u4f1a\u5bf9\u6027\u80fd\u6709\u8f83\u5927\u5f71\u54cd\uff0c\u9700\u8981\u4e86\u89e3\u6b63\u5e38\u7528\u6237\u4f7f\u7528\u573a\u666f\u4e0b\uff0c\u9644\u4ef6\u7684\u5927\u5c0f\u8303\u56f4<\/p>\n<p><span>(3) <\/span>K8s pod\u6570\u91cf\uff0c\u5f00\u542f\u4e86HPA\u4f1a\u89e6\u53d1Auto Scaling<\/p>\n<p>\u6d4b\u8bd5\u4e2d\u53d1\u73b0\u6027\u80fd\u4e0d\u7a33\u5b9a\uff0c\u540e\u6765\u53d1\u73b0\u662fUAT\u73af\u5883\u5f00\u542f\u4e86HPA\u4f1a\u89e6\u53d1Auto Scaling\uff0c\u6240\u4ee5\u5728\u6267\u884c\u6d4b\u8bd5\u65f6\uff0c\u9700\u8981\u8003\u8651\u4e0d\u540c\u7684\u573a\u666f\uff1a<\/p>\n<ul>\n<li>\u6d4b\u8bd5\u56fa\u5b9apod\u4e0b\u7684\u6027\u80fd\uff0c\u65b9\u4fbf\u4f18\u5316\u5bf9\u6bd4\u6027\u80fd<\/li>\n<li>\u6d4b\u8bd5Auto Scaling\u7684Policy\u6709\u6548\u6027<\/li>\n<\/ul>\n<p><span>(4) <\/span>\u7f51\u7edc\u5f71\u54cd<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u6bd4\u8f83\u901a\u7528\u7684\u95ee\u9898\uff0c\u6d4b\u8bd5\u65f6\u5e94\u6ce8\u610f\u7f51\u7edc\u53d8\u5316\u5bf9\u6027\u80fd\u6307\u6807\u7684\u5f71\u54cd\uff0c\u9632\u6b62\u53d8\u91cf\u592a\u591a\uff0c\u6027\u80fd\u6570\u636e\u5206\u6790\u4e0d\u51c6\u786e<\/p>\n<p><span>(5) <\/span>\u4e0d\u540cAPI\u7684\u6027\u80fd\u5dee\u8ddd\u8f83\u5927<\/p>\n<p>\u8fd9\u91cc\u4e3b\u8981\u662f\u7528\u4f8b\u8bbe\u8ba1\u65f6\u9700\u8981\u8003\u8651\uff0ck6\u4f1a\u7edf\u8ba1\u6240\u6709\u7684\u8bf7\u6c42\u6570\u636e\uff0c\u5bfc\u81f4API\u4e4b\u95f4\u4f1a\u76f8\u4e92\u5f71\u54cd\uff0c\u6570\u636e\u5931\u771f\uff1a<\/p>\n<ul>\n<li>\u6bd4\u5982token\u83b7\u53d6\u7684\u6570\u636e\u4e5f\u4f1a\u88ab\u6536\u96c6\uff0c\u5bfc\u81f4\u5b9e\u9645\u7684\u4e1a\u52a1\u63a5\u53e3\u6570\u636e\u53d7\u5230\u5f71\u54cd\uff1b<\/li>\n<li>\u518d\u8005\u50cfdelete\u7c7b\u7684\u63a5\u53e3\uff0c\u5bf9create\u6709\u4f9d\u8d56\uff0c\u5982\u679c\u628a\u4e24\u4e2aAPI\u4e00\u8d77\u6d4b\u8bd5\uff0ccreate API\u7684\u6027\u80fd\u6570\u636e\u4e0edelete API\u5dee\u8ddd\u8f83\u5927\uff0c\u5bfc\u81f4delete\u63a5\u53e3\u7684\u6570\u636e\u4e25\u91cd\u5931\u771f\u3002\u53ef\u4ee5\u901a\u8fc7tag\u8fdb\u884c\u7b5b\u9009\uff0c\u62ff\u5230\u5355\u4e2aAPI\u7684\u90e8\u5206\u6570\u636e\uff0c\u6bd4\u5982response time, \u8fd9\u79cd\u8fd8\u662f\u6709\u610f\u4e49\u7684\uff0c\u50cf\u662frps\u8fd9\u79cd\u6570\u636e\uff0c\u5982\u679c\u4e24\u4e2a\u4e00\u8d77\u8dd1\u7684\uff0c\u4e3b\u8981\u8fd8\u662f\u53d6\u51b3\u4e8ecreate\uff0c\u8fd9\u6837\u6536\u96c6\u5230\u7684rps\u5bf9delete\u6765\u8bf4\u610f\u4e49\u4e0d\u5927\u4e86\u3002<\/li>\n<\/ul>\n<p><span>(6) <\/span>\u591a\u4e2a\u540e\u7aefAPI\u95f4\u7684\u76f8\u4e92\u5f71\u54cd\uff0c\u4f8b\u5982\u6587\u4ef6\u4e0a\u4f20\u5bf9\u6027\u80fd\u7684\u5f71\u54cd<\/p>\n<p>\u7531\u4e8e\u6211\u4eec\u662f\u6709BFF\u548cBE\uff0cBFF\u4f1a\u7ec4\u5408\u591a\u4e2aBE\uff0c\u6240\u4ee5\u9700\u8981\u8bc6\u522b\u591a\u4e2aBE\u4e4b\u95f4\u7684\u76f8\u4e92\u5f71\u54cd\uff0c\u5c3d\u91cf\u4fdd\u8bc1\u80fd\u51c6\u786e\u7684\u6d4b\u8bd5\u5230\u76ee\u6807\uff0c\u51cf\u5c11\u5176\u4ed6API\u7684\u5f71\u54cd\u3002\u6bd4\u5982\u5728\u51c6\u5907\u5355\u72ec\u6d4b\u8bd5\u67d0\u4e2a\u670d\u52a1\u65f6\uff0c\u53ef\u4ee5\u8003\u8651\u4e0d\u6dfb\u52a0\u6587\u4ef6\uff0c\u907f\u514d\u6587\u4ef6\u670d\u52a1\u7684\u5e72\u6270<\/p>\n<h4>\u7ed3\u679c\u5206\u6790\u53ca\u4f18\u5316<\/h4>\n<p>\u5bf9\u4e8e\u7ed3\u679c\u5206\u6790\u6765\u8bf4\uff0ck6\u81ea\u8eab\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684Metrics\u53ef\u4f9b\u67e5\u770b\uff0c\u5e76\u4e14\u6211\u4eec\u4e5f\u96c6\u6210\u4e86New Relic\uff0c\u56e0\u6b64\u53ef\u7ed3\u5408\u8fd9\u4e24\u8005\u6765\u8fdb\u884c\u6570\u636e\u6536\u96c6\uff0c\u5206\u6790\u53ca\u8c03\u4f18\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s8.\/oss\/202205\/26\/e52276d36e385aee085727bb8e6303095149f3.png\" style=\"width: 936px;height: 714px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: center\">\u539f\u56fe\u94fe\u63a5\uff1ahttps:\/\/k6.io\/docs\/static\/f9df206f5a86e9b4c59d2bdb6a9e351f\/485a2\/new-relic-dashboard.webp<\/p>\n<p>\u5982\u4e0a\u56fe\u6240\u793a\uff0cNew Relic\u53ef\u4ee5\u5c06\u6536\u96c6\u5230\u7684\u6570\u636e\u4ee5\u56fe\u7684\u5f62\u5f0f\u5c55\u793a\u51fa\u6765\uff0c\u5e76\u4e14\u6211\u4eec\u53ef\u4ee5\u6309\u7167\u9700\u6c42\u6765\u5b9a\u5236\u5316Report\uff0c\u8fd9\u91cc\u4e0d\u4ec5\u4ec5\u53ef\u4ee5\u7528k6\u6536\u96c6\u7684\u6570\u636e\uff0c\u8fd8\u53ef\u4ee5\u53e0\u52a0\u4e00\u4e9bAPM\u7684\u6570\u636e\uff0c\u6bd4\u5982CPU\uff0cMemory\uff0cPod\u6570\u91cf\u7b49\u4fe1\u606f\u3002\u901a\u8fc7\u9f20\u6807\u5b9a\u4f4d\u6a2a\u5750\u6807\u4e0a\u7684\u67d0\u4e00\u4e2a\u70b9\uff0c\u53ef\u4ee5\u6e05\u6670\u7684\u770b\u5230\u8be5\u65f6\u523b\u5bf9\u5e94\u7684\u5e76\u53d1\u91cf\uff0c\u603b\u8bf7\u6c42\u6570\uff0c\u54cd\u5e94\u65f6\u95f4\uff0c\u5931\u8d25\u7387\u7b49\u7b49\u6570\u636e\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u5728\u6267\u884c\u6d4b\u8bd5\u65f6\uff0c\u6211\u4eec\u901a\u8fc7\u5728\u63a7\u5236\u53d8\u91cf\u7684\u524d\u63d0\u4e0b\uff0c\u8fdb\u884c\u6a2a\u5411\u5bf9\u6bd4\uff0c\u5c06\u540c\u7c7bAPI\u5728\u76f8\u540c\u7684\u914d\u7f6e\u4e0b\uff0c\u5bf9\u6027\u80fd\u6570\u636e\u8fdb\u884c\u6bd4\u8f83\uff0c\u5982\u679c\u6570\u636e\u76f8\u5dee\u660e\u663e\uff0c\u5219\u53ef\u4ee5\u8fdb\u4e00\u6b65\u8c03\u67e5\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5de5\u5177\u5bf9\u8bf7\u6c42\u8fdb\u884c\u6df1\u5165\u8c03\u67e5\uff0c\u62c6\u89e3\u8bf7\u6c42\u4e2d\u5404\u4e2a\u6a21\u5757\u7684\u8017\u65f6\uff0c\u627e\u5230\u6700\u7ec8\u7684\u539f\u56e0\u3002<\/p>\n<p>\u8fd9\u91cc\u4e3e\u4e24\u4e2a\u4f8b\u5b50\u6765\u8bf4\u660e\u8fd9\u4e2a\u8fc7\u7a0b\u3002<\/p>\n<h4>\u6848\u4f8b1 - \u67d0\u83b7\u53d6\u914d\u7f6e\u7c7b\u4fe1\u606fAPI<\/h4>\n<p>\u6b64API\u903b\u8f91\u6bd4\u8f83\u7b80\u5355\uff0c\u4e3b\u8981\u662f\u8bfb\u53d6\u4e00\u4e9b\u914d\u7f6e\u4fe1\u606f\uff0c\u7136\u540e\u505a\u4e00\u4e9b\u7b80\u5355\u7684\u5904\u7406\u8fd4\u56de\u5373\u53ef\u3002<\/p>\n<p>\u8fd0\u884c\u5b8c\u6d4b\u8bd5\u540e\uff0chttp_req_duration\u7684\u5e73\u5747\u503c\u5927\u6982\u57281s\u5de6\u53f3\uff0c\u5e73\u5747rps\u5728108\u5de6\u53f3\uff0c\u800c\u4e14VU\u6700\u9ad8\u8fbe\u5230\u4e86300\uff0c\u8bf4\u660e\u6b64\u65f6\u5df2\u7ecf\u62c9\u6ee1\u4e86\u7528\u6237\uff0c\u8fd8\u67090.7%\u7684\u9519\u8bef\u3002\u800c\u5176\u4ed6\u9700\u8981\u67e5\u8be2\u6570\u636e\u5e93\u7684API\u540c\u6837\u7684\u8bbe\u7f6e\u4e0b\uff0chttp_req_duration\u53ea\u670923ms\uff0crps\u6709204\uff0cVU\u6700\u9ad8\u624d\u523076\u3002\u8fd9\u4e2aAPI\u53ea\u662f\u53d6\u4e00\u4e9b\u914d\u7f6e\u4fe1\u606f\uff0c\u6ca1\u6709\u5176\u4ed6\u592a\u590d\u6742\u7684\u64cd\u4f5c\uff0c\u4e5f\u4e0d\u7528\u8bbf\u95ee\u6570\u636e\u5e93\uff0c\u663e\u7136\u8fd9\u4e2a\u6027\u80fd\u6570\u636e\u662f\u5f02\u5e38\u7684\uff0c\u4e8e\u662f\u62c9\u7740Dev\u4e00\u8d77\u5148\u6392\u67e5\u4e00\u4e0b\u903b\u8f91\uff0c\u53d1\u73b0\u662f\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9\u7684\u7f13\u5b58\u903b\u8f91\u6709\u95ee\u9898\uff0c\u6bcf\u6b21\u8bf7\u6c42\u90fd\u4f1a\u53bb\u8bfb\u914d\u7f6e\u6587\u4ef6\uff0c\u5bfc\u81f4\u6027\u80fd\u6570\u636e\u5f02\u5e38\u3002<\/p>\n<p>\u5728\u4fee\u6539\u5b8c\u4e4b\u540e\uff0c\u76f8\u540c\u914d\u7f6e\u4e0b\uff0chttp_req_duration\u4e3a12ms\uff0c\u5e73\u5747rps\u4e3a145\uff0cVU\u6700\u9ad8\u4e3a50\uff0c\u9519\u8bef\u7387\u4e3a0\uff0c\u5f88\u663e\u7136\uff0c\u8fd9\u4e2a\u6570\u636e\u8bf4\u660e\u6211\u4eec\u8fd8\u53ef\u4ee5\u7ee7\u7eed\u52a0\u5927Rate\uff0c\u5f53\u628aRate\u52a0\u5230500\u65f6\uff0c\u5e73\u5747\u7684http_req_duration\u4f9d\u65e7\u662f12ms\uff0cVU\u6700\u5927\u4e5f\u624d80\uff0c\u4f9d\u65e7\u6ca1\u6709\u5230\u8fbe\u74f6\u9888\uff0c\u7531\u6b64\u53ef\u89c1\u4fee\u6539\u540e\u6027\u80fd\u63d0\u5347\u975e\u5e38\u660e\u663e\u3002<\/p>\n<h4>\u6848\u4f8b2 - \u67d0getAPI<\/h4>\n<p>\u8fd9\u4e2aAPI\u662f\u4e00\u4e2aget\u7c7b\u578b\u7684API\uff0c\u804c\u8d23\u662f\u53bb\u6570\u636e\u5e93\u4e2d\u83b7\u53d6\u4e00\u4e2a\u503c\uff0c\u6ca1\u6709\u5176\u4ed6\u989d\u5916\u64cd\u4f5c\u3002<\/p>\n<p>\u8fd0\u884c\u5b8c\u6d4b\u8bd5\u540e\uff0chttp_req_duration\u7684\u5e73\u5747\u503c\u5927\u6982\u5728320ms\u5de6\u53f3\uff0c\u6a2a\u5411\u5bf9\u6bd4\u5176\u4ed6get API\u80fd\u591f\u53d1\u73b0duration\u7684\u7ed3\u679c\u662f\u975e\u5e38\u4e0d\u5408\u7406\u7684\u3002\u4f46\u662fk6\u53ea\u7ed9\u51fa\u6700\u540e\u7684\u8fd0\u884c\u7ed3\u679c\uff0c\u6211\u4eec\u65e0\u6cd5\u4ece\u8fd9\u4e9b\u7ed3\u679c\u4e2d\u5f97\u77e5\u5177\u4f53\u7684\u95ee\u9898\u5728\u54ea\u3002\u597d\u5728new relic\u4e0a\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5177\u4f53\u7684API\u4fe1\u606f\uff0c\u5176\u4e2d\u6709\u4e00\u9879\u4e2d\u63d0\u4f9b\u4e86API\u7684\u8be6\u7ec6\u8c03\u7528\u6d41\u7a0b\uff0c\u4ee5\u53ca\u6bcf\u4e00\u6d41\u7a0b\u4e2d\u82b1\u8d39\u7684\u5177\u4f53\u65f6\u95f4\u3002\u7531\u4e8e\u9879\u76ee\u5b89\u5168\u9700\u8981\uff0c\u8fd9\u91cc\u4ee5new relic\u63d0\u4f9b\u7684\u56fe\u4e3a\u4f8b\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s3.\/oss\/202205\/26\/54b8e0582cfcee3c6176685e80ef9e987fd0d3.png\" style=\"width: 936px;height: 454px\" class=\"aligncenter\"><\/p>\n<p style=\"text-align: center\">\u539f\u56fe\u94fe\u63a5\uff1ahttps:\/\/docs.newrelic.com\/static\/distributed-tracing-trace-details-page-1c064ef6a7607f95be583786b6af9251.png<\/p>\n<p>\u4ece\u56fe\u4e2d\uff0c\u53ef\u4ee5\u6e05\u695a\u7684\u770b\u5230API\u7684service\u8c03\u7528\u6d41\u7a0b\u56fe\uff0c\u4ee5\u53ca\u4e0e\u4e0d\u540c\u7684service\u4e92\u76f8call\u7684\u4e2a\u6570\u3002\u5e76\u8fd8\u80fd\u6e05\u695a\u5730\u770b\u5230\u6bcf\u4e00\u6b65\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u4ece\u800c\u627e\u5230\u6700\u8d39\u65f6\u95f4\u7684\u90a3\u4e00\u6b65\u8c03\u7528\u3002<\/p>\n<p>\u6700\u540e\u6839\u636e\u8fd9\u4e2a\u56fe\uff0c\u6211\u4eec\u53d1\u73b0\u539f\u672c\u53ea\u662f\u53bb\u6570\u636e\u5e93\u53d6\u4e00\u4e2a\u503c\u56de\u6765\uff0c\u5374\u7531\u4e8e\u5b9e\u73b0\u65b9\u5f0f\u4e0d\u5bf9\uff0c\u5bfc\u81f4\u4e86\u548c\u6570\u636e\u5e93\u4e4b\u95f4\u4ea7\u751f\u4e86200\u591a\u4e2acall\u3002\u8fd9\u624d\u4f7f\u5f97response time\u9ad8\u8fbe320ms\u3002\u7ecf\u8fc7\u91cd\u65b0\u7f16\u7801\u540e\uff0c\u8be5API\u7684response time\u964d\u5230\u4e8620ms\uff0c\u6027\u80fd\u63d0\u5347\u4e8615\u500d\u3002<\/p>\n<h3>\u5199\u5728\u6700\u540e<\/h3>\n<p>\u6b64\u6b21\u6027\u80fd\u6d4b\u8bd5\u590d\u6742\u5ea6\u8f83\u9ad8\uff0c\u975e\u4e00\u4e24\u4eba\u4e4b\u529b\u80fd\u591f\u5b8c\u6210\uff0c\u4f5c\u4e3aQA\uff0c\u6211\u4eec\u53ef\u4ee5\u4e3b\u5bfc\u4e8b\u60c5\u7684\u53d1\u751f\uff0c\u5e76\u6210\u4e3a\u5176\u4e2d\u7684\u4e3b\u529b\u627f\u62c5\u8005\uff0c\u8981\u53ca\u65f6\u63d0\u51fa\u95ee\u9898\u548c\u5bfb\u6c42\u5e2e\u52a9\uff0c\u901a\u8fc7\u56e2\u961f\u7684\u534f\u4f5c\uff0c\u8ba9\u95ee\u9898\u5c3d\u5feb\u5f97\u5230\u89e3\u51b3\uff0c\u6700\u7ec8\u987a\u5229\u5b8c\u6210\u6027\u80fd\u6d4b\u8bd5\u4efb\u52a1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u9879\u76ee\u7684\u76ee\u6807\u662f\u4e3a\u5ba2\u6237\u4ea4\u4ed8\u4e00\u4e2aToC\u7684APP\uff0c\u5176\u540e\u7aef\u662f\u57fa\u4e8eRESTful\u7684\u5fae\u670d\u52a1\u67b6\u6784\uff0c\u540c\u65f6\u540e\u7aef\u8fd8\u91c7\u7528\u4e86Pro [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":336749,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-336748","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/336748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=336748"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/336748\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/336749"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=336748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=336748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=336748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}