Traffic shaping & alerts

更新时间:
复制 MD 格式

Configure traffic shaping and alerts for APIs in your service project to control request rates and monitor API health.

Limits

  • Alert configuration is not supported for APIs in the development environment.

  • If the call pattern of an API is switched from synchronous call to asynchronous invocation, the alert rules for average call duration will not take effect. If the alert rules remain unchanged and the call pattern is switched from asynchronous invocation to synchronous call, the corresponding alert rules will still take effect.

Permission description

Super administrators, project administrators, and O&M personnel can configure traffic shaping and alerts for APIs.

Configure traffic shaping

  1. In the top menu bar of the Dataphin home page, choose Service > API O&M.

  2. In the navigation pane on the left, click Traffic Shaping & Alerts. On the API O&M page, find the desired API and click Rate Limiting in the Actions column.

  3. In the API Traffic Shaping Configuration dialog box, configure the parameters.

    Parameter

    Description

    Traffic Shaping Status

    Enable or disable traffic shaping.

    Time Unit

    Select the time unit for traffic shaping. If the network is configured as Alibaba Cloud API Gateway, the supported units are sec, min, hour, and day.

    API Traffic Limit

    The maximum number of allowed requests within the specified time unit. For example, if your enterprise purchased 500 queries per second and you select sec as the Time Unit, set this value to 500 or less.

    APP Traffic Limit

    The maximum number of allowed requests from downstream apps. The following rules apply:

    • The App Traffic Limit applies to all apps under the API.

    • The App Traffic Limit must be less than or equal to the API Traffic Limit.

    • The API Traffic Limit has a higher priority than the App Traffic Limit. For example, if the API Traffic Limit is 1,000 queries per second, and the traffic limits for App1, App2, and App3 are 500 queries per second each, the sum of the app traffic limits exceeds the API traffic limit. However, the upper limit of traffic is still the API traffic limit.

    • When the App Traffic Limit is greater than the API Traffic Limit, the system displays an error message.

    Add App

    Click Add App to set the Application and Traffic Limit. The following rules apply:

    • The Traffic Limit for a specific app must be less than or equal to the API Traffic Limit.

    • When the Traffic Limit for a specific app is greater than the API Traffic Limit, the system displays an error message.

  4. Click OK to complete the traffic shaping configuration for the API.

    When the request count within a time window reaches the limit, the system protects itself by queuing, waiting, or downgrading.

Configure alerts

  1. On the API O&M page, click Alert in the Actions column of the target API.

  2. On the API Alert page, configure the API alert information.

    Parameter

    Description

    Metric

    The API monitoring metric for the alert rule. Available metrics:

    • Call Count: The total number of API calls within the specified time period.

    • Error Rate: The total number of API call errors divided by the total number of API calls within the specified time period.

    • Average Call Duration: This metric is supported only for synchronous calls. It is calculated as the total duration of API calls divided by the total number of API calls within the specified time period.

    Time Unit

    The time window for measuring API calls. Options: 1min, 5min, 10min, 30min, and 60min.

    Operator

    The comparison operator for evaluating the metric against the Threshold. Options: =, >=, <=, <, >, and !=.

    Threshold

    The metric value that triggers the alert.

    Notification Method

    The delivery channel for alert notifications.

    Notification Recipient

    The users who receive alert notifications.

    Silence Period

    The cooldown interval after an alert is sent. During this period, duplicate notifications for the same alert rule are suppressed.

  3. Click OK to complete the alert configuration for the API.

    When an API call triggers an alert rule, the system sends a notification so you can identify and resolve the issue promptly.