All Products
Search
Document Center

DataWorks:UpdateQualityRule

Last Updated:Nov 27, 2023

Updates a monitoring rule.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes UpdateQualityRule

The operation that you want to perform. Set the value to UpdateQualityRule.

BlockType Integer No 0

The strength of the monitoring rule. The strength of a monitoring rule indicates the importance of the rule. Valid values:

  • 1: The monitoring rule is a strong rule.
  • 0: The monitoring rule is a weak rule.

    You can specify whether a monitoring rule is a strong rule based on your business requirements. If a strong rule is used and a critical alert is triggered, nodes are blocked.

EntityId Long No 123

The ID of the partition filter expression. You can call the ListQualityRules operation to obtain the ID of the partition filter expression.

Comment String No Check the number of table rows

The description of the monitoring rule.

Checker Integer Yes 9

The ID of the checker. You can call the ListQualityRules operation to obtain the ID of the checker.

ExpectValue String No 300

The expected value of the monitoring rule.

Id Long Yes 1234

The ID of the monitoring rule. You can call the ListQualityRules operation to obtain the ID of the monitoring rule.

Trend String No up

The trend of the monitoring result. Valid values:

  • up: increasing
  • down: decreasing
  • abs: absolute value
MethodName String Yes table_count

The method that is used to collect sample data, such as avg, count, sum, min, max, count_distinct, user_defined, table_count, table_size, table_dt_load_count, table_dt_refuseload_count, null_value, null_value/table_count, (table_count-count_distinct)/table_count, or table_count-count_distinct.

Operator String No >

The comparison operator, such as >, >=, =, ≠, <, or <=.

ProjectName String Yes autotest

The name of the compute engine instance or data source. You can log on to the DataWorks console and go to the Workspace Management page to obtain the name.

Property String Yes id

The name of the field.

PropertyType String No bigint

The data type of the field.

RuleType Integer No 0

The type of the monitoring rule. Valid values:

  • 0: The monitoring rule is created by the system.
  • 1: The monitoring rule is created by a user.
  • 2: The monitoring rule is a workspace-level rule.
WhereCondition String No dt=$[yyyymmdd]

The filter condition or custom SQL statement that is used for monitoring.

CriticalThreshold String No 10

The threshold for a critical alert. The threshold indicates the deviation of the monitoring result from the expected value. You can customize this threshold based on your business requirements. If a strong rule is used and a critical alert is triggered, nodes are blocked.

WarningThreshold String No 5

The threshold for a warning alert. The threshold indicates the deviation of the monitoring result from the expected value. You can customize this threshold based on your business requirements.

TemplateId Integer No 7

The ID of the monitoring template that is used to create the monitoring rule. You can call the ListQualityRules operation to obtain the ID of the monitoring template.

RuleName String No 123

The name of the monitoring rule.

PredictType Integer No 0

Specifies whether the threshold is a dynamic threshold. Valid values:

  • 0: The threshold is not a dynamic threshold.
  • 2: The threshold is a dynamic threshold.
OpenSwitch Boolean No true

Specifies whether to enable the monitoring rule in the production environment. Valid values:

  • true: The monitoring rule is triggered when the associated auto triggered node that generates the output data starts to run.
  • false: The monitoring rule is not triggered when the associated auto triggered node that generates the output data starts to run.
ProjectId Long No 26

The ID of the workspace.

TaskSetting String No x=a,y=b

The variable settings inserted before the custom rule. Format: x=a,y=b.

Response parameters

Parameter

Type

Example

Description

HttpStatusCode Integer 200

The HTTP status code.

Data Boolean true

Indicates whether the monitoring rule is updated.

ErrorMessage String You have no permission.

The error message.

RequestId String 576b9457-2cf5-4****

The request ID. You can troubleshoot issues based on the ID.

ErrorCode String 0

The error code.

Success Boolean true

Indicates whether the request was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UpdateQualityRule
&BlockType=0
&EntityId=123
&Comment=Check the number of table rows
&Checker=9
&ExpectValue=300
&Id=1234
&Trend=up
&MethodName=table_count
&Operator=>
&ProjectName=autotest
&Property=id
&PropertyType=bigint
&RuleType=0
&WhereCondition=dt=$[yyyymmdd]
&CriticalThreshold=10
&WarningThreshold=5
&TemplateId=7
&RuleName=123
&PredictType=0
&OpenSwitch=true
&ProjectId=26
&TaskSetting=x=a,y=b
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UpdateQualityRuleResponse>
    <HttpStatusCode>200</HttpStatusCode>
    <Data>true</Data>
    <ErrorMessage>You have no permission.</ErrorMessage>
    <RequestId>576b9457-2cf5-4****</RequestId>
    <ErrorCode>0</ErrorCode>
    <Success>true</Success>
</UpdateQualityRuleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "HttpStatusCode" : 200,
  "Data" : true,
  "ErrorMessage" : "You have no permission.",
  "RequestId" : "576b9457-2cf5-4****",
  "ErrorCode" : 0,
  "Success" : true
}

Error codes

For a list of error codes, see Service error codes.