irate<\/strong><\/div>\n\u7531\u4e8e\u4f7f\u7528 rate \u6216\u8005 increase \u51fd\u6570\u53bb\u8ba1\u7b97\u6837\u672c\u7684\u5e73\u5747\u589e\u957f\u901f\u7387\uff0c\u5bb9\u6613\u9677\u5165\u957f\u5c3e\u95ee\u9898\u5f53\u4e2d\uff0c\u5176\u65e0\u6cd5\u53cd\u5e94\u5728\u65f6\u95f4\u7a97\u53e3\u5185\u6837\u672c\u6570\u636e\u7684\u7a81\u53d1\u53d8\u5316\u3002<\/p>\n
\u4f8b\u5982\uff0c\u5bf9\u4e8e\u4e3b\u673a\u800c\u8a00\u5728 2 \u5206\u949f\u7684\u65f6\u95f4\u7a97\u53e3\u5185\uff0c\u53ef\u80fd\u5728\u67d0\u4e00\u4e2a\u7531\u4e8e\u8bbf\u95ee\u91cf\u6216\u8005\u5176\u5b83\u95ee\u9898\u5bfc\u81f4 CPU \u5360\u7528 100%\u7684\u60c5\u51b5\uff0c\u4f46\u662f\u901a\u8fc7\u8ba1\u7b97\u5728\u65f6\u95f4\u7a97\u53e3\u5185\u7684\u5e73\u5747\u589e\u957f\u7387\u5374\u65e0\u6cd5\u53cd\u5e94\u51fa\u8be5\u95ee\u9898\u3002<\/p>\n
\u4e3a\u4e86\u89e3\u51b3\u8be5\u95ee\u9898\uff0cPromQL \u63d0\u4f9b\u4e86\u53e6\u5916\u4e00\u4e2a\u7075\u654f\u5ea6\u66f4\u9ad8\u7684\u51fd\u6570irate(v range-vector)\u3002irate \u540c\u6837\u7528\u4e8e\u8ba1\u7b97\u533a\u95f4\u5411\u91cf\u7684\u8ba1\u7b97\u7387\uff0c\u4f46\u662f\u5176\u53cd\u5e94\u51fa\u7684\u662f\u77ac\u65f6\u589e\u957f\u7387\u3002<\/p>\n
irate \u51fd\u6570\u662f\u901a\u8fc7\u533a\u95f4\u5411\u91cf\u4e2d\u6700\u540e\u4e24\u4e2a\u6837\u672c\u6570\u636e\u6765\u8ba1\u7b97\u533a\u95f4\u5411\u91cf\u7684\u589e\u957f\u901f\u7387\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u907f\u514d\u5728\u65f6\u95f4\u7a97\u53e3\u8303\u56f4\u5185\u7684\u957f\u5c3e\u95ee\u9898\uff0c\u5e76\u4e14\u4f53\u73b0\u51fa\u66f4\u597d\u7684\u7075\u654f\u5ea6\uff0c\u901a\u8fc7 irate \u51fd\u6570\u7ed8\u5236\u7684\u56fe\u6807\u80fd\u591f\u66f4\u597d\u7684\u53cd\u5e94\u6837\u672c\u6570\u636e\u7684\u77ac\u65f6\u53d8\u5316\u72b6\u6001\u3002\u90a3\u65e2\u7136\u662f\u4f7f\u7528\u6700\u540e\u4e24\u4e2a\u70b9\u8ba1\u7b97\uff0c\u90a3\u4e3a\u4ec0\u4e48\u8fd8\u8981\u6307\u5b9a\u7c7b\u4f3c\u4e8e [1m] \u7684\u65f6\u95f4\u8303\u56f4\u5462?\u8fd9\u4e2a [1m] \u4e0d\u662f\u7528\u6765\u8ba1\u7b97\u7684\uff0cirate \u5728\u8ba1\u7b97\u7684\u65f6\u5019\u4f1a\u6700\u591a\u5411\u524d\u5728 [1m] \u8303\u56f4\u5185\u627e\u70b9\uff0c\u5982\u679c\u8d85\u8fc7 [1m] \u6ca1\u6709\u627e\u5230\u6570\u636e\u70b9\uff0c\u8fd9\u4e2a\u70b9\u7684\u8ba1\u7b97\u5c31\u653e\u5f03\u4e86\u3002<\/p>\n
<\/p>\n
\u7531\u4e8e rate() \u63d0\u4f9b\u4e86\u66f4\u5e73\u6ed1\u7684\u7ed3\u679c\uff0c\u56e0\u6b64\u5728\u957f\u671f\u8d8b\u52bf\u5206\u6790\u6216\u8005\u544a\u8b66\u4e2d\u66f4\u63a8\u8350\u4f7f\u7528 rate \u51fd\u6570\uff0c\u56e0\u4e3a\u5f53\u901f\u7387\u53ea\u51fa\u73b0\u4e00\u4e2a\u77ed\u6682\u7684\u5cf0\u503c\u65f6\uff0c\u4e0d\u5e94\u8be5\u89e6\u53d1\u8be5\u62a5\u8b66\u3002<\/p>\n
\u4f7f\u7528 irate() \u51fd\u6570\u4e0a\u9762\u7684\u8868\u8fbe\u5f0f\u4f1a\u51fa\u73b0\u4e00\u4e9b\u77ed\u6682\u4e0b\u964d\u7684\u56fe\u5f62\uff1a<\/p>\n
<\/p>\n
\u9664\u4e86\u8ba1\u7b97\u6bcf\u79d2\u901f\u7387\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528 increase() \u51fd\u6570\u67e5\u8be2\u6307\u5b9a\u65f6\u95f4\u8303\u56f4\u5185\u7684\u603b\u589e\u91cf\uff0c\u5b83\u57fa\u672c\u4e0a\u76f8\u5f53\u4e8e\u901f\u7387\u4e58\u4ee5\u65f6\u95f4\u8303\u56f4\u9009\u62e9\u5668\u4e2d\u7684\u79d2\u6570\uff1a<\/p>\n
increase(demo_api_request_duration_seconds_count{job=\"demo\"}[1h]) <\/pre>\n\u6bd4\u5982\u4e0a\u9762\u8868\u8fbe\u5f0f\u7684\u7ed3\u679c\u548c\u4f7f\u7528 rate() \u51fd\u6570\u8ba1\u7b97\u7684\u7ed3\u679c\u6574\u4f53\u56fe\u5f62\u8d8b\u52bf\u90fd\u662f\u4e00\u6837\u7684\uff0c\u53ea\u662f Y \u8f74\u7684\u6570\u636e\u4e0d\u4e00\u6837\u800c\u5df2\uff0c\u4e00\u4e2a\u8868\u793a\u6570\u91cf\uff0c\u4e00\u4e2a\u8868\u793a\u767e\u5206\u6bd4\u3002rate()\u3001irate() \u548c increase() \u51fd\u6570\u53ea\u80fd\u8f93\u51fa\u975e\u8d1f\u503c\u7684\u7ed3\u679c\uff0c\u5bf9\u4e8e\u8ddf\u8e2a\u4e00\u4e2a\u53ef\u4ee5\u4e0a\u5347\u6216\u4e0b\u964d\u7684\u503c\u7684\u6307\u6807(\u5982\u6e29\u5ea6\u3001\u5185\u5b58\u6216\u78c1\u76d8\u7a7a\u95f4)\uff0c\u53ef\u4ee5\u4f7f\u7528 delta() \u548c deriv() \u51fd\u6570\u6765\u4ee3\u66ff\u3002<\/p>\n
deriv() \u51fd\u6570\u53ef\u4ee5\u8ba1\u7b97\u4e00\u4e2a\u533a\u95f4\u5411\u91cf\u4e2d\u5404\u4e2a\u65f6\u95f4\u5e8f\u5217\u4e8c\u9636\u5bfc\u6570\uff0c\u4f7f\u7528\u7b80\u5355\u7ebf\u6027\u56de\u5f52\uff0cderiv(v range-vector) \u7684\u53c2\u6570\u662f\u4e00\u4e2a\u533a\u95f4\u5411\u91cf\uff0c\u8fd4\u56de\u4e00\u4e2a\u77ac\u65f6\u5411\u91cf\uff0c\u8fd9\u4e2a\u51fd\u6570\u4e00\u822c\u53ea\u7528\u5728 Gauge \u7c7b\u578b\u7684\u65f6\u95f4\u5e8f\u5217\u4e0a\u3002\u4f8b\u5982\uff0c\u8981\u8ba1\u7b97\u5728 15 \u5206\u949f\u7684\u7a97\u53e3\u4e0b\uff0c\u6bcf\u79d2\u949f\u78c1\u76d8\u4f7f\u7528\u91cf\u4e0a\u5347\u6216\u4e0b\u964d\u4e86\u591a\u5c11\uff1a<\/p>\n
<\/p>\n
\u8fd8\u6709\u53e6\u5916\u4e00\u4e2a predict_linear() \u51fd\u6570\u53ef\u4ee5\u9884\u6d4b\u4e00\u4e2a Gauge \u7c7b\u578b\u7684\u6307\u6807\u5728\u672a\u6765\u6307\u5b9a\u4e00\u6bb5\u65f6\u95f4\u5185\u7684\u503c\uff0c\u4f8b\u5982\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u8fc7\u53bb 15 \u5206\u949f\u7684\u53d8\u5316\u60c5\u51b5\uff0c\u6765\u9884\u6d4b\u4e00\u4e2a\u5c0f\u65f6\u540e\u7684\u78c1\u76d8\u4f7f\u7528\u91cf\u662f\u591a\u5c11\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u6240\u793a\u7684\u8868\u8fbe\u5f0f\u6765\u67e5\u8be2\uff1a<\/p>\n
predict_linear(demo_disk_usage_bytes{job=\"demo\"}[15m], 3600) <\/pre>\n<\/p>\n
\u8fd9\u4e2a\u51fd\u6570\u53ef\u4ee5\u7528\u4e8e\u62a5\u8b66\uff0c\u544a\u8bc9\u6211\u4eec\u78c1\u76d8\u662f\u5426\u4f1a\u5728\u51e0\u4e2a\u5c0f\u65f6\u5019\u5185\u7528\u5b8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u901a\u5e38\u6765\u8bf4\u76f4\u63a5\u7ed8\u5236\u4e00\u4e2a\u539f\u59cb\u7684 Counter \u7c7b\u578b\u7684\u6307\u6807\u6570\u636e\u7528\u5904\u4e0d\u5927\uff0c\u56e0\u4e3a\u5b83\u4eec\u4f1a\u4e00\u76f4\u589e\u52a0\uff0c\u4e00\u822c\u6765\u8bf4\u662f\u4e0d\u4f1a\u53bb\u76f4\u63a5\u5173 […]<\/p>\n","protected":false},"author":317,"featured_media":153461,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-228297","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/228297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/317"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=228297"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/228297\/revisions"}],"predecessor-version":[{"id":228309,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/228297\/revisions\/228309"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/153461"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=228297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=228297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=228297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}