前面文章讲解了springboot搭建一个web项目的简单过程,下面看看spring提供的监控控件
pom.xml配置: <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
配置属性 ## INFO
info:
app:
name: @project.artifactId@
encoding: @project.build.sourceEncoding@
java:
source: @java.version@
target: @java.version@
management:
security:
enabled: false
HTTP方法 | 路径 | 描述 | 鉴权 |
---|
GET | /autoconfig | 查看自动配置的使用情况 | true | GET | /configprops | 查看配置属性,包括默认配置 | true | GET | /beans | 查看bean及其关系列表 | true | GET | /dump | 打印线程栈 | true | GET | /env | 查看所有环境变量 | true | GET | /env/{name} | 查看具体变量值 | true | GET | /health | 查看应用健康指标 | false | GET | /info | 查看应用信息(需要自己在application.properties里头添加信息,比如info.contact.email=easonjim@163.com) | false | GET | /mappings | 查看所有url映射 | true | GET | /metrics | 查看应用基本指标 | true | GET | /metrics/{name} | 查看具体指标 | true | POST | /shutdown | 关闭应用(要真正生效,得配置文件开启endpoints.shutdown.enabled: true) | true | GET | /trace | 查看基本追踪信息 |
|
http://localhost:8000/info
{ "app":{ "name":"provider-user", "encoding":"UTF-8", "java":{ "source":"1.7.0_55", "target":"1.7.0_55" } } } http://localhost:8000/trace
[ { "timestamp":1535943279273, "info":{ "method":"GET", "path":"/health", "headers":{ "request":{ "host":"localhost:8000", "connection":"keep-alive", "upgrade-insecure-requests":"1", "user-agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36", "accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "accept-encoding":"gzip, deflate, sdch, br", "accept-language":"zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4", "cookie":"bdshare_firstime=1493111478313; Hm_lvt_4ec7c28bb3e194e92cfa520e9496dca8=1509611604,1510885154; Hm_lvt_f2138c9b3c7f1aed1c03e35419de52f3=1535610836" }, "response":{ "X-Application-Context":"application:8000", "Content-Type":"application/vnd.spring-boot.actuator.v1+json;charset=UTF-8", "Transfer-Encoding":"chunked", "Date":"Mon, 03 Sep 2018 02:54:39 GMT", "status":"200" } }, "timeTaken":"43" } }, { "timestamp":1535943196023, "info":{ "method":"GET", "path":"/", "headers":{ "request":{ "host":"localhost:8000", "connection":"keep-alive", "upgrade-insecure-requests":"1", "user-agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36", "accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "accept-encoding":"gzip, deflate, sdch, br", "accept-language":"zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4", "cookie":"bdshare_firstime=1493111478313; Hm_lvt_4ec7c28bb3e194e92cfa520e9496dca8=1509611604,1510885154; Hm_lvt_f2138c9b3c7f1aed1c03e35419de52f3=1535610836" }, "response":{ "X-Application-Context":"application:8000", "status":"404" } }, "timeTaken":"25" } } ]
http://localhost:8000/metrics
{ "mem":348943, "mem.free":121697, "processors":4, "instance.uptime":2349941, "uptime":2359023, "systemload.average":-1, "heap.committed":278528, "heap.init":129024, "heap.used":156830, "heap":1829888, "nonheap.committed":72000, "nonheap.init":2496, "nonheap.used":70417, "nonheap":0, "threads.peak":25, "threads.daemon":21, "threads.totalStarted":29, "threads":23, "classes":9638, "classes.loaded":9638, "classes.unloaded":0, "gc.ps_scavenge.count":9, "gc.ps_scavenge.time":250, "gc.ps_marksweep.count":2, "gc.ps_marksweep.time":186, "httpsessions.max":-1, "httpsessions.active":0, "datasource.primary.active":0, "datasource.primary.usage":0, "gauge.response.env":20, "gauge.response.health":52, "gauge.response.star-star":34, "gauge.response.info":77, "gauge.response.id":28, "gauge.response.star-star.favicon.ico":29, "counter.status.200.star-star.favicon.ico":1, "counter.status.200.info":1, "counter.status.404.star-star":1, "counter.status.200.health":1, "counter.status.200.id":1, "counter.status.400.id":1, "counter.status.200.env":1 }
http://localhost:8000/env { "profiles":[
], "server.ports":{ "local.server.port":8000 }, "servletContextInitParams":{
}, "systemProperties":{ "java.runtime.name":"Java(TM) SE Runtime Environment", "sun.boot.library.path":"E:\workhome\jdk1.8.0_45\jre\bin", "java.vm.version":"25.45-b02", "java.vm.vendor":"Oracle Corporation", "java.vendor.url":"http://java.oracle.com/", "path.separator":";", "java.vm.name":"Java HotSpot(TM) 64-Bit Server VM", "file.encoding.pkg":"sun.io", "user.country":"CN", "user.script":"", "sun.java.launcher":"SUN_STANDARD", "sun.os.patch.level":"Service Pack 1", "PID":"7240", "java.vm.specification.name":"Java Virtual Machine Specification", "user.dir":"E:\workhome\workspaceLuna201808\provider-user", "java.runtime.version":"1.8.0_45-b14", "java.awt.graphicsenv":"sun.awt.Win32GraphicsEnvironment", "org.jboss.logging.provider":"slf4j", "java.endorsed.dirs":"E:\workhome\jdk1.8.0_45\jre\lib\endorsed", "os.arch":"amd64", "java.io.tmpdir":"D:\Users\conca\AppData\Local\Temp\", "line.separator":"
", "java.vm.specification.vendor":"Oracle Corporation", "user.variant":"", "os.name":"Windows 7", "sun.jnu.encoding":"GBK", "spring.beaninfo.ignore":"true", "java.library.path":"E:\workhome\jdk1.8.0_45\bin;D:\Windows\Sun\Java\bin;D:\Windows\system32;D:\Windows;E:/workhome/jdk1.7.0_55/bin/../jre/bin/server;E:/workhome/jdk1.7.0_55/bin/../jre/bin;E:/workhome/jdk1.7.0_55/bin/../jre/lib/amd64;E:\workhome\jdk1.7.0_55\bin;E:\workhome\jdk1.7.0_55\jre\bin;D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;E:\workhome\apache-maven-3.1.1\bin;D:\Program Files\TortoiseSVN\bin;E:\Program Files\nodejs\;D:\Program Files\Git\cmd;D:\Users\conca\AppData\Roaming\npm;D:\Program Files\Docker Toolbox;E:\workhome\eclipse-jee-luna-201808\eclipse;;.", "java.specification.name":"Java Platform API Specification", "java.class.version":"52.0", "sun.management.compiler":"HotSpot 64-Bit Tiered Compilers", "os.version":"6.1", "user.home":"D:\Users\conca", "catalina.useNaming":"false", "user.timezone":"Asia/Shanghai", "java.awt.printerjob":"sun.awt.windows.WPrinterJob", "file.encoding":"UTF-8", "java.specification.version":"1.8", "catalina.home":"D:\Users\conca\AppData\Local\Temp\tomcat.7551578353821345390.8000", "java.class.path":"E:\workhome\workspaceLuna201808\provider-user\target\classes;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-starter-web\1.5.9.RELEASE\spring-boot-starter-web-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-starter\1.5.9.RELEASE\spring-boot-starter-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot\1.5.9.RELEASE\spring-boot-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-autoconfigure\1.5.9.RELEASE\spring-boot-autoconfigure-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-starter-logging\1.5.9.RELEASE\spring-boot-starter-logging-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;E:\workhome\MavenRepositories\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;E:\workhome\MavenRepositories\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;E:\workhome\MavenRepositories\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;E:\workhome\MavenRepositories\org\springframework\spring-core\4.3.13.RELEASE\spring-core-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-starter-tomcat\1.5.9.RELEASE\spring-boot-starter-tomcat-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\apache\tomcat\embed\tomcat-embed-core\8.5.23\tomcat-embed-core-8.5.23.jar;E:\workhome\MavenRepositories\org\apache\tomcat\tomcat-annotations-api\8.5.23\tomcat-annotations-api-8.5.23.jar;E:\workhome\MavenRepositories\org\apache\tomcat\embed\tomcat-embed-el\8.5.23\tomcat-embed-el-8.5.23.jar;E:\workhome\MavenRepositories\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.23\tomcat-embed-websocket-8.5.23.jar;E:\workhome\MavenRepositories\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;E:\workhome\MavenRepositories\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;E:\workhome\MavenRepositories\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;E:\workhome\MavenRepositories\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;E:\workhome\MavenRepositories\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;E:\workhome\MavenRepositories\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;E:\workhome\MavenRepositories\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;E:\workhome\MavenRepositories\org\springframework\spring-web\4.3.13.RELEASE\spring-web-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\spring-aop\4.3.13.RELEASE\spring-aop-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\spring-beans\4.3.13.RELEASE\spring-beans-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\spring-context\4.3.13.RELEASE\spring-context-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\spring-webmvc\4.3.13.RELEASE\spring-webmvc-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\spring-expression\4.3.13.RELEASE\spring-expression-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-starter-data-jpa\1.5.9.RELEASE\spring-boot-starter-data-jpa-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-starter-aop\1.5.9.RELEASE\spring-boot-starter-aop-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-starter-jdbc\1.5.9.RELEASE\spring-boot-starter-jdbc-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\apache\tomcat\tomcat-jdbc\8.5.23\tomcat-jdbc-8.5.23.jar;E:\workhome\MavenRepositories\org\apache\tomcat\tomcat-juli\8.5.23\tomcat-juli-8.5.23.jar;E:\workhome\MavenRepositories\org\springframework\spring-jdbc\4.3.13.RELEASE\spring-jdbc-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\hibernate\hibernate-core\5.0.12.Final\hibernate-core-5.0.12.Final.jar;E:\workhome\MavenRepositories\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar;E:\workhome\MavenRepositories\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;E:\workhome\MavenRepositories\antlr\antlr\2.7.7\antlr-2.7.7.jar;E:\workhome\MavenRepositories\org\jboss\jandex\2.0.0.Final\jandex-2.0.0.Final.jar;E:\workhome\MavenRepositories\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;E:\workhome\MavenRepositories\org\hibernate\common\hibernate-commons-annotations\5.0.1.Final\hibernate-commons-annotations-5.0.1.Final.jar;E:\workhome\MavenRepositories\org\hibernate\hibernate-entitymanager\5.0.12.Final\hibernate-entitymanager-5.0.12.Final.jar;E:\workhome\MavenRepositories\javax\transaction\javax.transaction-api\1.2\javax.transaction-api-1.2.jar;E:\workhome\MavenRepositories\org\springframework\data\spring-data-jpa\1.11.9.RELEASE\spring-data-jpa-1.11.9.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\data\spring-data-commons\1.13.9.RELEASE\spring-data-commons-1.13.9.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\spring-orm\4.3.13.RELEASE\spring-orm-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\spring-tx\4.3.13.RELEASE\spring-tx-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;E:\workhome\MavenRepositories\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;E:\workhome\MavenRepositories\org\springframework\spring-aspects\4.3.13.RELEASE\spring-aspects-4.3.13.RELEASE.jar;E:\workhome\MavenRepositories\com\h2database\h2\1.4.196\h2-1.4.196.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-starter-actuator\1.5.9.RELEASE\spring-boot-starter-actuator-1.5.9.RELEASE.jar;E:\workhome\MavenRepositories\org\springframework\boot\spring-boot-actuator\1.5.9.RELEASE\spring-boot-actuator-1.5.9.RELEASE.jar", "user.name":"conca", "java.vm.specification.version":"1.8", "sun.java.command":"com.cookqq.provider.App", "java.home":"E:\workhome\jdk1.8.0_45\jre", "sun.arch.data.model":"64", "user.language":"zh", "java.specification.vendor":"Oracle Corporation", "awt.toolkit":"sun.awt.windows.WToolkit", "java.vm.info":"mixed mode", "java.version":"1.8.0_45", "java.ext.dirs":"E:\workhome\jdk1.8.0_45\jre\lib\ext;D:\Windows\Sun\Java\lib\ext", "sun.boot.class.path":"E:\workhome\jdk1.8.0_45\jre\lib\resources.jar;E:\workhome\jdk1.8.0_45\jre\lib\rt.jar;E:\workhome\jdk1.8.0_45\jre\lib\sunrsasign.jar;E:\workhome\jdk1.8.0_45\jre\lib\jsse.jar;E:\workhome\jdk1.8.0_45\jre\lib\jce.jar;E:\workhome\jdk1.8.0_45\jre\lib\charsets.jar;E:\workhome\jdk1.8.0_45\jre\lib\jfr.jar;E:\workhome\jdk1.8.0_45\jre\classes", "java.awt.headless":"true", "java.vendor":"Oracle Corporation", "catalina.base":"D:\Users\conca\AppData\Local\Temp\tomcat.7551578353821345390.8000", "file.separator":"\", "java.vendor.url.bug":"http://bugreport.sun.com/bugreport/", "sun.io.unicode.encoding":"UnicodeLittle", "sun.cpu.endian":"little", "sun.desktop":"windows", "sun.cpu.isalist":"amd64" }, "systemEnvironment":{ "NO_PROXY":"192.168.99.100", "PROCESSOR_LEVEL":"6", "FP_NO_HOST_CHECK":"NO", "SESSIONNAME":"Console", "ALLUSERSPROFILE":"D:\ProgramData", "PROCESSOR_ARCHITECTURE":"AMD64", "PSModulePath":"D:\Windows\system32\WindowsPowerShell\v1.0\Modules\", "SystemDrive":"D:", "MOZ_PLUGIN_PATH":"D:\Program Files (x86)\Foxit Software\Foxit Reader\plugins\", "USERNAME":"conca", "ProgramFiles(x86)":"D:\Program Files (x86)", "PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC", "COMPOSE_CONVERT_WINDOWS_PATHS":"true", "ProgramData":"D:\ProgramData", "ProgramW6432":"D:\Program Files", "HOMEPATH":"\Users\conca", "PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 58 Stepping 9, GenuineIntel", "M2_HOME":"E:\workhome\apache-maven-3.1.1", "ProgramFiles":"D:\Program Files", "PUBLIC":"D:\Users\Public", "windir":"D:\Windows", "VBOX_INSTALL_PATH":"D:\Program Files\Oracle\VirtualBox\", "=::":"::\", "MACHINE_STORAGE_PATH":"E:\workhome\docker", "LOCALAPPDATA":"D:\Users\conca\AppData\Local", "DOCKER_HOST":"tcp://192.168.99.100:2376", "USERDOMAIN":"conca-PC", "LOGONSERVER":"\\CONCA-PC", "JAVA_HOME":"E:\workhome\jdk1.7.0_55", "asl.log":"Destination=file", "APPDATA":"D:\Users\conca\AppData\Roaming", "DOCKER_MACHINE_NAME":"default", "DOCKER_CERT_PATH":"E:\workhome\docker\machines\default", "windows_tracing_logfile":"D:\BVTBin\Tests\installpackage\csilogfile.log", "VBOX_MSI_INSTALL_PATH":"D:\Program Files\Oracle\VirtualBox\", "CommonProgramFiles":"D:\Program Files\Common Files", "Path":"E:/workhome/jdk1.7.0_55/bin/../jre/bin/server;E:/workhome/jdk1.7.0_55/bin/../jre/bin;E:/workhome/jdk1.7.0_55/bin/../jre/lib/amd64;E:\workhome\jdk1.7.0_55\bin;E:\workhome\jdk1.7.0_55\jre\bin;D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;E:\workhome\apache-maven-3.1.1\bin;D:\Program Files\TortoiseSVN\bin;E:\Program Files\nodejs\;D:\Program Files\Git\cmd;D:\Users\conca\AppData\Roaming\npm;D:\Program Files\Docker Toolbox;E:\workhome\eclipse-jee-luna-201808\eclipse;", "OS":"Windows_NT", "windows_tracing_flags":"3", "COMPUTERNAME":"CONCA-PC", "PROCESSOR_REVISION":"3a09", "CLASSPATH":".;E:\workhome\jdk1.7.0_55\lib\dt.jar;E:\workhome\jdk1.7.0_55\lib\tools.jar;", "CommonProgramW6432":"D:\Program Files\Common Files", "ComSpec":"D:\Windows\system32\cmd.exe", "DOCKER_TLS_VERIFY":"1", "SystemRoot":"D:\Windows", "TEMP":"D:\Users\conca\AppData\Local\Temp", "HOMEDRIVE":"D:", "USERPROFILE":"D:\Users\conca", "TMP":"D:\Users\conca\AppData\Local\Temp", "CommonProgramFiles(x86)":"D:\Program Files (x86)\Common Files", "NUMBER_OF_PROCESSORS":"4", "DOCKER_TOOLBOX_INSTALL_PATH":"D:\Program Files\Docker Toolbox" }, "applicationConfig: [classpath:/application.yml]":{ "server.port":8000, "spring.jpa.generate-ddl":false, "spring.jpa.show-sql":true, "spring.jpa.hibernate.ddl-auto":"none", "spring.datasource.platform":"h2", "spring.datasource.schema":"classpath:schema.sql", "spring.datasource.data":"classpath:data.sql", "logging.level.root":"INFO", "logging.level.org.hibernate":"INFO", "logging.level.org.hibernate.type.descriptor.sql.BasicBinder":"TRACE", "logging.level.org.hibernate.type.descriptor.sql.BasicExtractor":"TRACE", "info.app.name":"provider-user", "info.app.encoding":"UTF-8", "info.app.java.source":"1.7.0_55", "info.app.java.target":"1.7.0_55", "management.security.enabled":false } }
|