Fault injection is a method to imitate the scenario in which a specific fault occurs. You can inject a fault into an application to test how the consumer applications process this fault. If a consumer application cannot properly process the fault, you can optimize the consumer application to improve its stability. This topic describes how to create a fault injection rule for a multi-language application.

Create a fault injection rule

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Microservices Governance > Service Mesh.
  3. In the left-side navigation tree of the Service Mesh page, click Fault Injection.
  4. Select a region in the top navigation bar. Select a microservice namespace from the drop-down list next to Fault Injection and click Create rule.
  5. In the Create fault injection rule panel, set the parameters and click OK.
    Create a fault injection rule in EDAS

    The following table describes the parameters.

    Parameter Description
    Microservice Space The region and microservice namespace where the application resides.
    Rule name The name of the fault injection rule, such as fault-example.
    Application The application for which you want to inject a fault.
    Tag The tag that implements tag-based routing.
    Status Specifies whether to enable the fault injection rule.
    • On: enables the rule after it is created.
    • Off: disables the rule after it is created. To enable the rule, find the rule on the Fault Injection page and click Open in the Operation column.
    Protocol type The type of the application framework. Default value: Service Mesh.
    Traffic sources The one or more consumer applications that send requests. You can select All or specify specific applications.
    Note The fault can be injected based on the percentage that you set only if the consumer application that sends a request is specified for this parameter.
    Fault type The type of the fault that you want to inject. Valid values: Abort type and Delay type.
    Abnormal status code The HTTP status code to return for a requestif the fault is injected into a consumer application. Valid values: 200 to 599. This parameter is available only if you set the Fault type parameter to Abort type.
    Fixed delay time The latency to send a request if the fault is injected into a consumer application. Unit: milliseconds. This parameter is available only if you set the Fault type parameter to Delay type.
    Percentage The possibility that the fault is injected into a consumer application.
    After the fault injection rule is created and enabled, check whether the rule takes effect.

Related operations

After you create a fault injection rule, you can click Edit, Close, or Open in the Operation column to manage the rule. If the fault injection rule is no longer required, you can click Delete to delete the rule.