1"use strict";(self.webpackChunklayotto_docusaurus=self.webpackChunklayotto_docusaurus||[]).push([[246],{782:(t,n,e)=>{e.r(n),e.d(n,{assets:()=>c,contentTitle:()=>r,default:()=>h,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var a=e(4848),s=e(8453);const o={},r="\u6267\u884c\u5668 Http API",i={id:"building_blocks/actuator/actuator",title:"\u6267\u884c\u5668 Http API",description:"Layotto Actuator API\u63d0\u4f9b\u5065\u5eb7\u68c0\u67e5\u3001\u67e5\u770b\u8fd0\u884c\u65f6\u5143\u6570\u636e\u7b49\u529f\u80fd\uff0c\u7528\u4e8e\u67e5\u770bLayotto\u548capp\u7684\u5065\u5eb7\u72b6\u51b5\u3001\u8fd0\u884c\u65f6\u5143\u6570\u636e\uff0c\u652f\u6301\u96c6\u6210\u8fdb\u5f00\u6e90\u57fa\u7840\u8bbe\u65bd\uff08\u4f8b\u5982\u53ef\u4ee5\u96c6\u6210\u8fdbk8s\u5065\u5eb7\u68c0\u67e5\uff09",source:"@site/docs/building_blocks/actuator/actuator.md",sourceDirName:"building_blocks/actuator",slug:"/building_blocks/actuator/",permalink:"/layotto/docs/building_blocks/actuator/",draft:!1,unlisted:!1,editUrl:"https://github.com/mosn/layotto/edit/main/docs/docs/building_blocks/actuator/actuator.md",tags:[],version:"current",frontMatter:{},sidebar:"mySidebar",previous:{title:"File API",permalink:"/layotto/docs/building_blocks/file/"},next:{title:"State API",permalink:"/layotto/docs/building_blocks/state/reference"}},c={},l=[{value:"0. \u4ec0\u4e48\u65f6\u5019\u4f7f\u7528Actuator Http API",id:"0-\u4ec0\u4e48\u65f6\u5019\u4f7f\u7528actuator-http-api",level:2},{value:"1. \u5065\u5eb7\u68c0\u67e5API",id:"1-\u5065\u5eb7\u68c0\u67e5api",level:2},{value:"/actuator/health/liveness",id:"actuatorhealthliveness",level:3},{value:"/actuator/health/readiness",id:"actuatorhealthreadiness",level:3},{value:"2. \u67e5\u8be2\u8fd0\u884c\u65f6\u5143\u6570\u636eAPI",id:"2-\u67e5\u8be2\u8fd0\u884c\u65f6\u5143\u6570\u636eapi",level:2},{value:"/actuator/info",id:"actuatorinfo",level:3},{value:"3. API\u8def\u5f84\u89e3\u91ca",id:"3-api\u8def\u5f84\u89e3\u91ca",level:2},{value:"4. API\u4f7f\u7528\u793a\u4f8b",id:"4-api\u4f7f\u7528\u793a\u4f8b",level:2}];function d(t){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...t.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h1,{id:"\u6267\u884c\u5668-http-api",children:"\u6267\u884c\u5668 Http API"}),"\n",(0,a.jsx)(n.p,{children:"Layotto Actuator API\u63d0\u4f9b\u5065\u5eb7\u68c0\u67e5\u3001\u67e5\u770b\u8fd0\u884c\u65f6\u5143\u6570\u636e\u7b49\u529f\u80fd\uff0c\u7528\u4e8e\u67e5\u770bLayotto\u548capp\u7684\u5065\u5eb7\u72b6\u51b5\u3001\u8fd0\u884c\u65f6\u5143\u6570\u636e\uff0c\u652f\u6301\u96c6\u6210\u8fdb\u5f00\u6e90\u57fa\u7840\u8bbe\u65bd\uff08\u4f8b\u5982\u53ef\u4ee5\u96c6\u6210\u8fdbk8s\u5065\u5eb7\u68c0\u67e5\uff09"}),"\n",(0,a.jsx)(n.p,{children:"\u7c7b\u4f3c\u4e8eSpring Boot Actuator\uff0cActuator API\u672a\u6765\u6709\u66f4\u591a\u7684\u60f3\u8c61\u7a7a\u95f4\uff1aMonitoring, Metrics, Auditing, and more."}),"\n",(0,a.jsx)(n.h2,{id:"0-\u4ec0\u4e48\u65f6\u5019\u4f7f\u7528actuator-http-api",children:"0. \u4ec0\u4e48\u65f6\u5019\u4f7f\u7528Actuator Http API"}),"\n",(0,a.jsx)(n.p,{children:"Actuator API\u4e00\u822c\u662f\u7ed9\u8fd0\u7ef4\u7cfb\u7edf\u7528\u7684\uff0c\u6bd4\u5982k8s\u8c03\u7528Actuator API\u76d1\u63a7Layotto\u548cApp\u7684\u72b6\u6001\uff0c\u5982\u679c\u72b6\u6001\u4e0d\u4f73\u5c31\u91cd\u542fPod\u6216\u8005\u6682\u65f6\u628a\u6d41\u91cf\u5207\u8d70\uff1b"}),"\n",(0,a.jsx)(n.p,{children:"\u518d\u6bd4\u5982\u5728\u7ed9SRE\u7528\u7684Dashboard\u4e0a\uff0c\u901a\u8fc7\u8c03\u7528Actuator API\u53ef\u4ee5\u6e05\u695a\u7684\u770b\u5230\u6bcf\u4e2aLayotto\u5b9e\u4f8b\u548cApp\u5185\u90e8\u7684\u5143\u6570\u636e\uff08\u4f8b\u5982\u5f53\u524d\u751f\u6548\u914d\u7f6e\u662f\u4ec0\u4e48\uff09\uff0c\u65b9\u4fbf\u6392\u67e5\u95ee\u9898\u3002"}),"\n",(0,a.jsx)(n.h2,{id:"1-\u5065\u5eb7\u68c0\u67e5api",children:"1. \u5065\u5eb7\u68c0\u67e5API"}),"\n",(0,a.jsx)(n.h3,{id:"actuatorhealthliveness",children:"/actuator/health/liveness"}),"\n",(0,a.jsx)(n.p,{children:'\u7528\u4e8e\u68c0\u67e5Layotto\u548cApp\u7684\u5065\u5eb7\u72b6\u6001\uff0c\u5224\u65ad"\u662f\u5426\u9700\u8981\u91cd\u542f"'}),"\n",(0,a.jsx)(n.p,{children:"GET"}),"\n",(0,a.jsx)(n.p,{children:"\u4e0d\u9700\u8981\u4f20\u53c2"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-json",children:'// http://localhost:8080/actuator/health/liveness\n// HTTP/1.1 200 OK\n\n{\n "status": "UP",\n "components": {\n "livenessProbe": {\n "status": "UP",\n "details":{\n\t\t\t\t \n }\n }\n }\n}\n'})}),"\n",(0,a.jsx)(n.p,{children:"\u8fd4\u56de\u5b57\u6bb5\u8bf4\u660e\uff1a\nHTTP\u72b6\u6001\u7801200\u4ee3\u8868\u6210\u529f\uff0c\u5176\u4ed6(400\u4ee5\u4e0a\u7684\u72b6\u6001\u7801)\u4ee3\u8868\u5931\u8d25"}),"\n",(0,a.jsx)(n.p,{children:"status\u5b57\u6bb5\u6709\u4e09\u79cd\uff1a"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-go",children:'var (\n\t// INIT means it is starting\n\tINIT = Status("INIT")\n\t// UP means it is healthy\n\tUP = Status("UP")\n\t// DOWN means it is unhealthy\n\tDOWN = Status("DOWN")\n)\n'})}),"\n",(0,a.jsxs)(n.p,{children:["\u6ce8\uff1a\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u63a5\u53e3\u53ea\u4f1a\u8fd4\u56deLayotto\u7684\u5065\u5eb7\u72b6\u6001\uff0c\u5982\u679c\u5e0c\u671b\u63a5\u53e3\u4e5f\u8fd4\u56deApp\u7684\u5065\u5eb7\u72b6\u6001\uff0c\u9700\u8981\u5f00\u53d1\u4e00\u4e2a\u56de\u8c03App\u7684\u63d2\u4ef6\u3002\u60a8\u53ef\u4ee5\u53c2\u8003",(0,a.jsx)(n.a,{href:"/layotto/docs/design/actuator/actuator-design-doc",children:"Actuator\u7684\u8bbe\u8ba1\u6587\u6863"})," \uff0c\u6216\u8005\u76f4\u63a5\u8054\u7cfb\u6211\u4eec\uff0c\u4e3a\u60a8\u63d0\u4f9b\u8be6\u7ec6\u7684\u89e3\u91ca\u3002"]}),"\n",(0,a.jsx)(n.h3,{id:"actuatorhealthreadiness",children:"/actuator/health/readiness"}),"\n",(0,a.jsx)(n.p,{children:'\u7528\u4e8e\u68c0\u67e5Layotto\u548cApp\u7684\u5065\u5eb7\u72b6\u6001\uff0c"\u662f\u5426\u9700\u8981\u6682\u65f6\u628a\u6d41\u91cf\u5207\u8d70\u3001\u522b\u8bbf\u95ee\u8fd9\u53f0\u673a\u5668"'}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.strong,{children:"Q: \u548c\u4e0a\u9762\u7684\u63a5\u53e3\u7684\u533a\u522b\u662f?"})}),"\n",(0,a.jsx)(n.p,{children:'A: liveness\u68c0\u67e5\u7528\u4e8e\u68c0\u67e5\u4e00\u4e9b\u4e0d\u53ef\u6062\u590d\u7684\u6545\u969c\uff0c"\u662f\u5426\u9700\u8981\u91cd\u542f"\uff1b\n\u800creadiness\u7528\u4e8e\u68c0\u67e5\u4e00\u4e9b\u4e34\u65f6\u6027\u3001\u53ef\u6062\u590d\u7684\u72b6\u6001\uff0c\u6bd4\u5982\u5e94\u7528\u6b63\u5728\u9884\u70ed\u7f13\u5b58\uff0c\u9700\u8981\u544a\u8bc9\u57fa\u7840\u8bbe\u65bd"\u5148\u522b\u628a\u6d41\u91cf\u5f15\u5230\u6211\u8fd9\u91cc\u6765"\uff0c\u7b49\u8fc7\u4f1a\u9884\u70ed\u597d\u4e86\uff0c\u57fa\u7840\u8bbe\u65bd\u518d\u8c03readiness\u68c0\u67e5\u7684\u63a5\u53e3\uff0c\u4f1a\u5f97\u5230\u7ed3\u679c"\u6211\u51c6\u5907\u597d\u4e86\uff0c\u53ef\u4ee5\u63a5\u5ba2\u4e86"'}),"\n",(0,a.jsx)(n.p,{children:"GET,\u4e0d\u9700\u8981\u4f20\u53c2"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-json",children:'// http://localhost:8080/actuator/health/readiness\n// HTTP/1.1 503 SERVICE UNAVAILABLE\n\n{\n "status": "DOWN",\n "components": {\n "readinessProbe": {\n "status": "DOWN"\n }\n }\n}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["\u6ce8\uff1a\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u63a5\u53e3\u53ea\u4f1a\u8fd4\u56deLayotto\u7684\u5065\u5eb7\u72b6\u6001\uff0c\u5982\u679c\u5e0c\u671b\u63a5\u53e3\u4e5f\u8fd4\u56deApp\u7684\u5065\u5eb7\u72b6\u6001\uff0c\u9700\u8981\u5f00\u53d1\u4e00\u4e2a\u56de\u8c03App\u7684\u63d2\u4ef6\u3002\u60a8\u53ef\u4ee5\u53c2\u8003",(0,a.jsx)(n.a,{href:"/layotto/docs/design/actuator/actuator-design-doc",children:"Actuator\u7684\u8bbe\u8ba1\u6587\u6863"})," \uff0c\u6216\u8005\u76f4\u63a5\u8054\u7cfb\u6211\u4eec\uff0c\u4e3a\u60a8\u63d0\u4f9b\u8be6\u7ec6\u7684\u89e3\u91ca\u3002"]}),"\n",(0,a.jsx)(n.h2,{id:"2-\u67e5\u8be2\u8fd0\u884c\u65f6\u5143\u6570\u636eapi",children:"2. \u67e5\u8be2\u8fd0\u884c\u65f6\u5143\u6570\u636eAPI"}),"\n",(0,a.jsx)(n.h3,{id:"actuatorinfo",children:"/actuator/info"}),"\n",(0,a.jsx)(n.p,{children:"\u7528\u4e8e\u67e5\u8be2Layotto\u548cApp\u7684\u8fd0\u884c\u65f6\u5143\u6570\u636e"}),"\n",(0,a.jsx)(n.p,{children:"GET"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-json",children:'// http://localhost:8080/actuator/health/liveness\n// HTTP/1.1 200 OK\n\n{\n "app" : {\n "version" : "1.0.0",\n "name" : "Layotto"\n }\n}\n'})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.strong,{children:"Q: \u4f1a\u8fd4\u56de\u54ea\u4e9b\u8fd0\u884c\u65f6\u5143\u6570\u636e\uff1f"})}),"\n",(0,a.jsx)(n.p,{children:"\u76ee\u524d\u8fd4\u56de\u7248\u672c\u53f7"}),"\n",(0,a.jsx)(n.p,{children:"\u540e\u7eed\u53ef\u4ee5\u52a0\u4e0a\uff1a"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsx)(n.li,{children:"\u56de\u8c03app"}),"\n",(0,a.jsx)(n.li,{children:"\u8fd0\u884c\u65f6\u914d\u7f6e\u53c2\u6570"}),"\n"]}),"\n",(0,a.jsx)(n.p,{children:"Actuator\u91c7\u7528\u63d2\u4ef6\u5316\u67b6\u6784\uff0c\u60a8\u4e5f\u53ef\u4ee5\u6309\u9700\u6dfb\u52a0\u81ea\u5df1\u7684\u63d2\u4ef6\uff0c\u8ba9API\u8fd4\u56de\u60a8\u5173\u6ce8\u7684\u8fd0\u884c\u65f6\u5143\u6570\u636e"}),"\n",(0,a.jsxs)(n.p,{children:["\u6ce8\uff1a\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u63a5\u53e3\u53ea\u4f1a\u8fd4\u56deLayotto\u7684\u8fd0\u884c\u65f6\u5143\u6570\u636e\uff0c\u5982\u679c\u5e0c\u671b\u63a5\u53e3\u4e5f\u8fd4\u56deApp\u7684\u8fd0\u884c\u65f6\u5143\u6570\u636e\uff0c\u9700\u8981\u5f00\u53d1\u4e00\u4e2a\u56de\u8c03App\u7684\u63d2\u4ef6\u3002\u60a8\u53ef\u4ee5\u53c2\u8003",(0,a.jsx)(n.a,{href:"/layotto/docs/design/actuator/actuator-design-doc",children:"Actuator\u7684\u8bbe\u8ba1\u6587\u6863"})," \uff0c\u6216\u8005\u76f4\u63a5\u8054\u7cfb\u6211\u4eec\uff0c\u4e3a\u60a8\u63d0\u4f9b\u8be6\u7ec6\u7684\u89e3\u91ca\u3002"]}),"\n",(0,a.jsx)(n.h2,{id:"3-api\u8def\u5f84\u89e3\u91ca",children:"3. API\u8def\u5f84\u89e3\u91ca"}),"\n",(0,a.jsx)(n.p,{children:"Actuator API\u7684\u8def\u5f84\u91c7\u7528restful\u98ce\u683c\uff0c\u4e0d\u540c\u7684Endpoint\u6ce8\u518c\u8fdbActuator\u540e\uff0c\u8def\u5f84\u662f"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{children:"/actuator/{endpoint_name}/{params} \n"})}),"\n",(0,a.jsx)(n.p,{children:"\u6bd4\u5982"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{children:"/actuator/health/liveness\n"})}),"\n",(0,a.jsx)(n.p,{children:"\u5176\u4e2dhealth\u6807\u8bc6Endpoint\u7684\u540d\u79f0\u662fhealth\uff0cliveness\u662f\u4f20\u7ed9\u8be5Endpoint\u7684\u53c2\u6570\u3002"}),"\n",(0,a.jsx)(n.p,{children:"\u53c2\u6570\u652f\u6301\u4f20\u591a\u4e2a\uff0c\u5f62\u5982 /a/b/c/d\uff0c\u5177\u4f53\u4f20\u51e0\u4e2a\u3001\u53c2\u6570\u7684\u8bed\u4e49\u7531\u6bcf\u4e2aEndpoint\u81ea\u5df1\u5b9a"}),"\n",(0,a.jsx)(n.p,{children:"\u9ed8\u8ba4\u6ce8\u518c\u7684\u8def\u5f84\u6709\uff1a"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{children:"/actuator/health/liveness\n/actuator/health/readiness\n/actuator/info\n"})}),"\n",(0,a.jsx)(n.h2,{id:"4-api\u4f7f\u7528\u793a\u4f8b",children:"4. API\u4f7f\u7528\u793a\u4f8b"}
1),"\n",(0,a.jsxs)(n.p,{children:["\u60a8\u53ef\u4ee5\u67e5\u770b",(0,a.jsx)(n.a,{href:"/layotto/docs/start/actuator/start",children:"Quick start\u6587\u6863"})]})]})}function h(t={}){const{wrapper:n}={...(0,s.R)(),...t.components};return n?(0,a.jsx)(n,{...t,children:(0,a.jsx)(d,{...t})}):d(t)}},8453:(t,n,e)=>{e.d(n,{R:()=>r,x:()=>i});var a=e(6540);const s={},o=a.createContext(s);function r(t){const n=a.useContext(o);return a.useMemo((function(){return"function"==typeof t?t(n):{...n,...t}}),[n,t])}function i(t){let n;return n=t.disableParentContext?"function"==typeof t.components?t.components(s):t.components||s:r(t.components),a.createElement(o.Provider,{value:n},t.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.