All Products
Search
Document Center

Microservices Engine:UpdateCircuitBreakerRule

Last Updated:Nov 20, 2024

Updates a circuit breaking rule.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
mse:UpdateCircuitBreakerRuleupdate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NamespacestringYes

The microservice namespace to which the application belongs.

default
AppNamestringYes

The name of the application.

spring-cloud-a
ThresholdfloatNo

A percentage threshold for triggering circuit breaking. Valid values: 0-1. These values represent 0% to 100%.

0.8
EnablebooleanNo

Specifies whether to enable the rule.

Valid values:

  • true

  • false

true
AppIdstringNo

The ID of the application.

hkhon1po62@c3df23522bXXXXX
StrategyintegerNo

The threshold type.

Valid values:

  • 0

    :

    slow call proportion

  • 1

    :

    abnormal proportion

0
RetryTimeoutMsintegerNo

The period in which circuit breaking is implemented. Unit: milliseconds. If circuit breaking is implemented on the requests for the route, the calls to all the requests for the route fail in the configured circuit breaking period. The value must be an integral multiple of 1,000. Default value: 10000. This value indicates 10 seconds.

10000
StatIntervalMsintegerNo

The length of the time window. Unit: milliseconds. The valid range is from 1 second to 120 minutes. The default value is 20000. This value indicates 20 seconds.

20000
MaxAllowedRtMsintegerNo

The maximum response time (RT). Unit: milliseconds. If the RT of a request is greater than the value of this parameter, a slow call is counted. If you set Strategy to 0, you must specify this parameter.

200
MinRequestAmountintegerNo

The minimum number of requests to trigger circuit breaking. If the number of requests in the current time window is less than the value of this parameter, circuit breaking is not triggered even if the circuit breaking rule is met. Default value: 10.

10
HalfOpenBaseAmountPerStepintegerNo

The minimum number of requests that can be passed in each step after circuit breaking recovers. Default value: 1.

5
HalfOpenRecoveryStepNumintegerNo

The number of circuit breaking recovery steps. Default value: 1.

1
RuleIdlongYes

The rule ID.

1
AcceptLanguagestringNo

The language of the response. Valid values: zh-CN and en-US. Default value: zh-CN. The value zh-CN indicates Chinese, and the value en-US indicates English.

zh

Response parameters

ParameterTypeDescriptionExample
object
Messagestring

The returned message.

OK
RequestIdstring

The request ID.

EE5C32A1-BC0E-4B79-817C-103E4EDF****
Codestring

The response code.

200
Dataobject

The details of the rule.

Namespacestring

The microservice namespace to which the application belongs.

default
Idlong

The ID of the rule.

1
AppNamestring

The name of the application.

spring-cloud-a
Resourcestring

The name of the interface to which the rule is applicable. The interface name must be the same as the name on the interface details page in the console.

/a
Strategyinteger

The threshold type.

Valid values:

  • 0

    :

    slow call proportion

  • 1

    :

    abnormal proportion

0
Thresholdfloat

A percentage threshold for triggering circuit breaking. Valid values: 0-1. These values represent 0% to 100%.

0.8
Enableboolean

Indicates whether the rule is enabled.

true
RetryTimeoutMsinteger

The period in which circuit breaking is implemented. Unit: milliseconds. If circuit breaking is implemented on the requests for the route, the calls to all the requests for the route fail in the configured circuit breaking period.

10000
StatIntervalMsinteger

The length of the time window. Unit: milliseconds. The valid range is from 1 second to 120 minutes.

20000
AppIdstring

The ID of the application.

hkhon1po62@c3df23522bXXXXX
MaxAllowedRtMsinteger

The maximum RT. Unit: milliseconds. If the RT of a request is greater than the value of this parameter, a slow call is counted. If you set Strategy to 0, you must specify this parameter.

200
MinRequestAmountinteger

The minimum number of requests to trigger circuit breaking. If the number of requests in the current time window is less than the value of this parameter, circuit breaking is not triggered even if the circuit breaking rule is met.

10
HalfOpenBaseAmountPerStepinteger

The minimum number of requests that can be passed in each step after circuit breaking recovers.

5
HalfOpenRecoveryStepNuminteger

The number of circuit breaking recovery steps.

1
Successboolean

Indicates whether the request was successful.

Valid values:

  • true

    :

    The request was successful.

  • false

    :

    The request failed.

true

Examples

Sample success responses

JSONformat

{
  "Message": "OK",
  "RequestId": "EE5C32A1-BC0E-4B79-817C-103E4EDF****",
  "Code": "200",
  "Data": {
    "Namespace": "default",
    "Id": 1,
    "AppName": "spring-cloud-a",
    "Resource": "/a",
    "Strategy": 0,
    "Threshold": 0.8,
    "Enable": true,
    "RetryTimeoutMs": 10000,
    "StatIntervalMs": 20000,
    "AppId": "hkhon1po62@c3df23522bXXXXX",
    "MaxAllowedRtMs": 200,
    "MinRequestAmount": 10,
    "HalfOpenBaseAmountPerStep": 5,
    "HalfOpenRecoveryStepNum": 1
  },
  "Success": true
}

Error codes

HTTP status codeError codeError messageDescription
400IllegalRequestInvalid request:%sInvalid request: %s
400InvalidParameterParameter error:%sRequest parameter error: %s
403NoPermissionYou are not authorized to perform this operation:%sYou do not have the permission to use this interface:%s
404NotFoundNot found:%sThe resource does not exist:%s
500InternalErrorConsole error. Try again later:%sConsole error. Try again later: %s

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history