Status Check in Workflow
note
Chaos Mesh does not yet support creating StatusCheck
nodes on Chaos Dashboard, so you could only create StatusCheck
nodes using YAML for now.
Chaos Mesh only support the HTTP
type to execute a status check.
A StatusCheck
node sends GET
or POST
HTTP requests to the specific URL, with custom headers and body, and then determines the result of the request by the conditions in the criteria
field.
In the configuration, you can see a StatusCheck
node with HTTP
type. The deadline
field specifies that this node could be executed for a maximum of 20 seconds. The mode
field specifies that this node will execute status checks continuously. The intervalSeconds
field specifies a repetition interval of 1 second. The timeoutSeconds
field specifies the timeout for each execution.
When Workflow runs to this StatusCheck
node, the specified status check would be executed every second. The status check uses the GET
method to send an HTTP request to the URL http://123.123.123.123
. If the response is returned within 1 second and the status code is 200
, this execution succeeds, otherwise it fails.
The StatusCheck
node has failureThreshold
and successThreshold
two fields:
- When the number of consecutive failed
execution results
exceeds thefailureThreshold
, thestatus check result
is considered to be aFailure
. - When the number of consecutive successful
execution results
exceeds thesuccessThreshold
, the is considered to be aSuccess
.
In the configuration, the StatusCheck
node will execute status checks continuously:
- When the
execution result
isSuccess
for 1 or more consecutive times, thestatus check result
is considered to be aSuccess
. - When the
execution result
isFailure
for 3 or more consecutive times, thestatus check result
is considered to be aFailure
.
note
In the following sections, status check fails
refers to that status check result
is Failure
, rather than a single execution result
is Failure
.
When the Status Check is unsuccessful, abort the Workflow
note
The StatusCheck
node only supports aborting the workflow automatically when the status check is unsuccessful. It could not pause or resume the workflow.
When executing chaos experiments, the application system might become unhealthy
, this function can be used to restore the application system by quickly ending chaos experiments. To enable the workflow to abort automatically when the status check fails, you can set the abortWithStatusCheck
field to true
on the StatusCheck
node.
- When the
StatusCheck
node timeout is exceeded, and thestatus check result
is not successful. For example,successThreshold
is 1,failureThreshold
is 3, and when the timeout is exceeded, there are 2 consecutive failures and 0 successes. Although it does not meet the condition for “status check fails”, it is also considered to be unsuccessful in this case.
When the mode
field is Continuous
, it means this StatusCheck
node will execute status checks continuously until the node times out or the status check fails.
In the configuration, the StatusCheck
node will execute status checks every second, and exit when any of the following conditions are met:
- The status check fails, i.e. 3 or more consecutive failed
execution results
- Trigger the node timeout after 20 seconds
One time Status Check
When the mode
field is Synchronous
, it means that this StatusCheck
node will exit immediately when the status check result
is clear, or when the node times out.
In the configuration, the StatusCheck
node will execute status checks every second, and exit when any of the following conditions are met:
- The status check succeeds, i.e. 1 or more consecutive successful
execution results
- The status check fails, i.e. 3 or more consecutive failed
execution results
- Trigger the node timeout after 20 seconds
Similarities:
- The node and the
HTTP Request Task
node (theTask
node that executes HTTP requests) are a node type of Workflow. - The
StatusCheck
node and theHTTP Request Task
node can obtain information about external systems through HTTP requests.
- The
HTTP Request Task
node could only send an HTTP once, and cannot send HTTP requests continuously.
For more information about Workflow and Template, refer to Create Chaos Mesh Workflow.