引入ChaosMonkey参考:https://mp.csdn.net/mp_blog/creation/editor/130152869
暴露接口需要引入actuator
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
然后就可以访问ChaosMonkey的接口了
访问示例:
GET localhost:9001/actuator/chaosmonkey
响应
{
"chaosMonkeyProperties": {
"enabled": true
},
"assaultProperties": {
"level": 3,
"latencyRangeStart": 5000,
"latencyRangeEnd": 10000,
"latencyActive": true,
"exceptionsActive": true,
"exception": {
"type": null,
"arguments": null
},
"killApplicationActive": true,
"memoryActive": false,
"memoryMillisecondsHoldFilledMemory": 90000,
"memoryMillisecondsWaitNextIncrease": 1000,
"memoryFillIncrementFraction": 0.15,
"memoryFillTargetFraction": 0.25,
"runtimeAssaultCronExpression": "OFF",
"watchedCustomServices": null,
"frozen": false,
"proxyTargetClass": true,
"proxiedInterfaces": [],
"targetSource": {
"target": {
"level": 3,
"latencyRangeStart": 5000,
"latencyRangeEnd": 10000,
"latencyActive": true,
"exceptionsActive": true,
"exception": {
"type": null,
"arguments": null
},
"killApplicationActive": true,
"memoryActive": false,
"memoryMillisecondsHoldFilledMemory": 90000,
"memoryMillisecondsWaitNextIncrease": 1000,
"memoryFillIncrementFraction": 0.15,
"memoryFillTargetFraction": 0.25,
"runtimeAssaultCronExpression": "OFF",
"watchedCustomServices": null
},
"static": true,
"targetClass": "de.codecentric.spring.boot.chaos.monkey.configuration.AssaultProperties"
},
"targetClass": "de.codecentric.spring.boot.chaos.monkey.configuration.AssaultProperties",
"advisors": [
{
"order": 2147483647,
"advice": {},
"pointcut": {
"classFilter": {},
"methodMatcher": {
"runtime": false
}
},
"perInstance": true
}
],
"preFiltered": false,
"exposeProxy": false
},
"watcherProperties": {
"controller": false,
"restController": true,
"service": true,
"repository": false,
"component": false
}
}