Help Center> Data Lake Insight> User Guide> SQL Inspector> Creating a SQL Inspection Rule
Updated on 2024-07-11 GMT+08:00

Creating a SQL Inspection Rule

Scenario

You can create SQL inspection rules for specified SQL queues on the SQL Inspector page. The system will prompt, block, or perform circuit breaking on SQL requests that trigger the rules.

When creating or modifying a SQL inspection rule, evaluate the appropriateness of enabling the rules and setting the threshold based on the service scenario. This will help avoid the negative impact of unreasonable inspection rules blocking or performing circuit breaking on relevant SQL requests on the services.

Notes and Constraints

  • SQL inspection is only supported by Spark 3.3 or later.

    For SQL queues, check the Spark engine version on the SparkUI page.

  • Only one inspection rule can be created for an action or a queue.
  • Each rule can be associated with 50 SQL queues.
  • A maximum of 1,000 rules can be created for a project.

Procedure

  1. Log in to the DLI management console.
  2. In the navigation pane on the left, choose Global Configuration > SQL Inspector.
  3. On the displayed SQL Inspector page, click Create Rule in the upper right corner. In the Create Rule dialog box, set parameters based on the table below.
    Table 1 Parameters for creating a SQL inspection rule

    Parameter

    Description

    Rule Name

    Name of a SQL inspection rule

    System Rules

    Select an inspection rule. For details about the system inspection rules supported by DLI, see Creating a SQL Inspection Rule.

    Queues

    Select the queues the rules are bound to.

    Description

    Enter a rule description.

    Rule Action

    Actions that the current SQL inspection rule supports.

    SQL rules support the following types of actions:

    • Info: Record logs and provide a hint for handling the SQL request. If the rule has parameters, you need to configure the threshold.
    • Block: Intercept the SQL request that meets the rule. If the rule has parameters, you need to configure the threshold.
    • Circuit Breaker: Perform circuit breaking on the SQL request that meets the inspection rules. If the rule has parameters, you need to configure the threshold.
  4. Click OK.

    View the added inspection rule on the SQL Inspector page. The rule takes effect dynamically.

    To modify a rule, click Modify in its Operation column.