Skip to main content

Metric Alerts

Metric alerts are implemented on the alert policy system of Tencent Cloud Observability Platform (TCOP). When a resource metric of a CloudBase environment becomes abnormal (for example, the error rate of a cloud function rises, slow database queries surge, or CloudRun 5xx errors increase), an alert notification is triggered automatically.

Scope​

Alert policies are created and managed in Tencent Cloud Observability Platform. The CloudBase console provides a shortcut entry to it.

Access​

  1. Sign in to the CloudBase platform and select the target environment.
  2. Select Log Monitoring in the left navigation pane.
  3. Select the Alert Policy tab at the top of the page and click Go to Observability Platform.

Configuration​

Complete the policy configuration in Tencent Cloud Observability Platform:

  1. Create a new alert policy in the observability platform.

  2. In "Configure alert policy - Policy type", select the type that matches the alert target. Policy types are not all under CloudBase:

    Alert targetPolicy type
    Cloud functionsCloud function
    PostgreSQL database (dedicated)PostgreSQL
    Other CloudBase resources (database, CloudRun, static hosting, gateway, and so on)CloudBase
  3. Configure the alert conditions: metric, statistical period, comparison operator, threshold, and duration.

  4. Configure the notification channel (receiver group and notification template).

  5. Enable the policy.

Note

The policy type must match the alert target; otherwise the policy cannot hit the monitoring data of the resource.

Common Scenarios​

ScenarioSuggested metric (CLI metric name)Description
Rising cloud function error rateFunctionErrorNumber of function errors per unit time
Cloud function timeoutsFunctionTimeoutNumber of execution timeouts
Surge of slow database queriesDbCostTime100msNumber of requests taking over 100ms
CloudRun service errorsTkeHttpErrorServiceNumber of HTTP errors such as 404 and 500
Static hosting capacityStaticFsSizePkgStorage capacity (MB)
Environment traffic limitEnvQPSAllTotal environment QPS

Metric names and meanings can be queried with the CloudBase CLI:

# List monitoring metrics supported by all resource types
tcb monitor schema

# Query the error count of a cloud function
tcb monitor function helloWorld --metric-name FunctionError

For the full command reference, see Monitoring Metrics.

More Flexible Usage​

Besides the console, you can query metrics and manage alert policies with the CloudBase CLI, which fits better into automated workflows.

Advanced operations on alert policies (creating, modifying, and deleting policies, querying alert history, and more) are performed through common cloud APIs:

tcb api monitor CreateAlarmPolicy --body '{ ... }'

See Platform Alerts for details.

Notes​

  • Metric data is reported with some delay. Do not set the statistical period or duration too short, to avoid false alerts.
  • Configure a reasonable notification frequency to avoid alert storms.
  • After log recording is disabled, no new logs are generated, but configured metric alerts still trigger based on monitoring data.