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
- Sign in to the CloudBase platform and select the target environment.
- Select Log Monitoring in the left navigation pane.
- 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:
-
Create a new alert policy in the observability platform.
-
In "Configure alert policy - Policy type", select the type that matches the alert target. Policy types are not all under CloudBase:
Alert target Policy type Cloud functions Cloud function PostgreSQL database (dedicated) PostgreSQL Other CloudBase resources (database, CloudRun, static hosting, gateway, and so on) CloudBase -
Configure the alert conditions: metric, statistical period, comparison operator, threshold, and duration.
-
Configure the notification channel (receiver group and notification template).
-
Enable the policy.
The policy type must match the alert target; otherwise the policy cannot hit the monitoring data of the resource.
Common Scenarios
| Scenario | Suggested metric (CLI metric name) | Description |
|---|---|---|
| Rising cloud function error rate | FunctionError | Number of function errors per unit time |
| Cloud function timeouts | FunctionTimeout | Number of execution timeouts |
| Surge of slow database queries | DbCostTime100ms | Number of requests taking over 100ms |
| CloudRun service errors | TkeHttpErrorService | Number of HTTP errors such as 404 and 500 |
| Static hosting capacity | StaticFsSizePkg | Storage capacity (MB) |
| Environment traffic limit | EnvQPSAll | Total 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.
Related Documentation
- Operations Monitoring: View the metric curves behind an alert.
- Log Management: Trace a single invocation after an alert is triggered.