All Products
Search
Document Center

:CreateQualityRule

最終更新日:Nov 29, 2023

Creates 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 CreateQualityRule

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

BlockType Integer Yes 0

The strength type of the monitoring rule. Valid values: 0 and 1. The value 0 indicates that the monitoring rule is a weak rule. The value 1 indicates that the monitoring rule is a strong rule.

EntityId Long Yes 15224

The ID of the partition filter expression.

Comment String No Check

The description of the monitoring rule.

Checker Integer Yes 9

The ID of the checker.

ExpectValue String No 0

The expected value.

Trend String No abs

The trend of the monitoring result. Valid values:

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

The method used to collect sample data. If you want to use a custom SQL statement as a sampling method, set this parameter to user_defined.

Operator String No >

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

Note If you set Checker to 9, you must configure Operator.
ProjectName String Yes autotest

The name of the compute engine instance or data source.

Property String No table_id

The fields that you want to monitor. If you want to monitor all fields in a table and check the table rows, set this parameter to table_count. If you want to monitor all fields in a table and check the table size, set this parameter to table_size.

PropertyType String No bigint

The data type of the fields that you want to monitor. If you want to monitor all fields in a table, set this parameter to table. If you want to monitor only a specific field, set this parameter to bigint.

RuleType Integer Yes 0

The type of the monitoring rule. Valid values: 0, 1, and 2. The value 0 indicates that the monitoring rule is created by the system. The value 1 indicates that the monitoring rule is created by a user. The value 2 indicates that the monitoring rule is a workspace-level rule.

WhereCondition String No table_id>1

The filter condition or custom SQL statement.

CriticalThreshold String No 20

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 10

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 template.

RuleName String Yes 1234

The name of the monitoring rule.

PredictType Integer Yes 0

Specifies whether the monitoring rule is a dynamic threshold rule. Valid values: 0 and 2. The value 0 indicates that the monitoring rule is not a dynamic threshold rule. The value 2 indicates that the monitoring rule is a dynamic threshold rule.

ProjectId Long Yes 10000

The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Management page to obtain the workspace ID.

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 String 12345

The ID of the monitoring rule that you created.

ErrorMessage String You have no permission.

The error message.

RequestId String ecb967ec-c137-48****

The request ID.

ErrorCode String 401

The error code.

Success Boolean true

Indicates whether the request was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateQualityRule
&BlockType=0
&EntityId=15224
&Comment=Check
&Checker=9
&ExpectValue=0
&Trend=abs
&MethodName=count/table_count
&Operator=>
&ProjectName=autotest
&Property=table_id
&PropertyType=bigint
&RuleType=0
&WhereCondition=table_id>1
&CriticalThreshold=20
&WarningThreshold=10
&TemplateId=7
&RuleName=1234
&PredictType=0
&ProjectId=10000
&TaskSetting=x=a,y=b
&<Common request parameters>

Sample success responses

XML format

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

<CreateQualityRuleResponse>
    <HttpStatusCode>200</HttpStatusCode>
    <Data>12345</Data>
    <ErrorMessage>You have no permission.</ErrorMessage>
    <RequestId>ecb967ec-c137-48****</RequestId>
    <ErrorCode>401</ErrorCode>
    <Success>true</Success>
</CreateQualityRuleResponse>

JSON format

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

{
  "HttpStatusCode" : 200,
  "Data" : 12345,
  "ErrorMessage" : "You have no permission.",
  "RequestId" : "ecb967ec-c137-48****",
  "ErrorCode" : 401,
  "Success" : true
}

Error codes

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