Updated on 2025-08-29 GMT+08:00

Configuring a Fault Injection Policy

Fault injection can simulate an invoking failure, which is mainly used for function verification and fault scenario demonstration. This policy applies only to microservices accessed through Java chassis.

Prerequisites

You have created a microservice by referring to Creating a Microservice. After the microservice starts, the service instance is registered with the corresponding service based on the configurations in the YAML file. If the microservice is not created in advance or has been deleted, the microservice is automatically created when the service instance is registered.

Configuring Fault Injection

  1. Click the target engine.
  2. Choose Microservice Governance.

    • For engines with security authentication disabled, go to 4.
    • For engines with security authentication enabled, if the login VDC user is the user imported in Importing an IAM Account, go to 4. For other users, go to 3.

  3. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  4. Click the target microservice. Click Fault Injection.
  5. Click New and select a proper policy. The following table describes the configuration items of fault injection.

    Figure 1 Configuring fault injection (delayed)
    Figure 2 Configuring fault injection (fault)

    Parameter

    Description

    Injection Object

    Microservices for which fault injection is required. You can specify a method for this configuration item.

    Type

    Type of the fault injected to the microservice.

    • Delayed
    • Fault

    Protocol

    Protocol for accessing the microservice when latency or fault occurs.

    • Rest
    • Highway

    Occurrence Probability

    Probability of latency or fault occurrence.

    Delay Time

    Duration of the latency during microservice access. This parameter is required when Type is set to Delayed.

    HTTP Error Code

    HTTP error code during microservice access. This parameter is required when Type is set to Fault. This error code is an HTTP error code.

  6. Click OK.