AlertRuleQuery

名称

类型

描述

示例值

object

告警规则的查询配置。 该配置对象所包含的字段取决于查询类型(type 字段),不同的数据查询类型适用的字段不同。

duration

integer

适用查询类型:PROMQL_QUERY。

告警数据持续时间,单位:秒。

60

expr

string

适用查询类型:PROMQL_QUERY。

查询表达式(promQL)

sum(sum(max_over_time(kube_pod_status_phase{phase=~\"Pending\",job=\"_kube-state-metrics\"}[5m])) by (pod)) > 1000

groupFieldList

array

适用查询类型:SLS_MULTI_QUERY。

分组字段名列表

string

分组字段名

host_name

groupType

string

适用查询类型:SLS_MULTI_QUERY。

分组类型,取值类型:

  • none: 不分组

  • label: 标签自动

  • custom: 标签自定义

label

queries

array

适用查询类型:SLS_MULTI_QUERY、APM_MULTI_QUERY。

子查询列表

对于 SLS_MULTI_QUERY 查询类型,最多包含 3 个子查询,且子查询的数量和顺序必须与 datasource.dsList 中的子数据源配置匹配。

object

子查询。

duration

integer

适用查询类型:ARMS_MULTI_QUERY。

告警(数据)持续时间。

120

end

integer

适用查询类型: SLS_MULTI_QUERY。

时间偏移结束时间(相对)。

如果指定了 start、end,则不指定 window。

0

expr

string

适用查询类型: APM_MULTI_QUERY、SLS_MULTI_QUERY。

查询表达式

  • 对于 APM_MULTI_QUERY,该字段非必须,为预定义指标生成的 promQL(用于预览数据)。

  • 对于 SLS_MULTI_QUERY,该字段为 SQL 查询语句。

sum by (rpc,acs_arms_service_id,pid,rpcType) (sum_over_time_lorc(arms_app_requests_count_ign_destid_endpoint_parent_ppid_prpc{callKind=~\"http|rpc|custom_entry|server|consumer\",pid=\"gaddp9ap8q@cb005ffdf44b8ac\",source=\"apm\"}[1m]))

start

integer

适用查询类型: SLS_MULTI_QUERY。

SLS 查询的时间偏移开始时间(相对)。

如果指定了 start、end,则不指定 window。 例如:start=15, timeUnit=minute,表示 15 分钟前

15

timeUnit

string

适用查询类型: SLS_MULTI_QUERY。

start 和 end、window 参数的时间单位: day/hour/minute/second

hour

window

integer

适用查询类型: SLS_MULTI_QUERY。

整点时间查询区间。 如果指定了 window 则不应指定 start、end。

1

apmAlertMetricId

string

适用查询类型:APM_MULTI_QUERY。

APM 预定义指标的 ID。

appstat.jvm.ThreadNewCount

apmFilters

array

适用查询类型:ARMS_MULTI_QUERY。

APM 指标的维度过滤项配置。 必须与 apmAlertMetricId 配合使用。

object

dim

string

APM 指标中为维度

rpcType

type

string

过滤操作类型:

  • eq: 等于

  • neq:不等于

  • match:正则匹配

  • nmatch:正则不匹配

eq

value

string

与过滤操作对应的取值。

h3ji7a0y9i@2ac80e27fdfd0a2

apmGroupBy

array

适用查询类型:ARMS_MULTI_QUERY。

查询的聚合维度列表,即按指标的哪些维度进行聚合。

string

指标的聚合维度

rpcType

firstJoin AlertRuleSlsQueryJoin

适用查询类型: SLS_MULTI_QUERY。

子查询 1(queries[0])和子查询 2(queries[1])结果的集合连接操作配置。

type

string

查询类型。

取值范围:

  • PROMQL_QUERY: promQL 查询

  • SLS_MULTI_QUERY: SLS 查询

  • APM_MULTI_QUERY: APM 查询

  • CMS_BASIC_QUERY: 基础云监控查询

不同的查询类型,查询对象中的有效字段不同,具体见各字段描述中的"适用查询类型"描述。

查询类型需要数据源类型匹配,对应关系如下:

  • Prometheus 数据源(PROMETHEUS_DS): PROMQL_QUERY

  • APM 数据源(APM_DS): APM_MULTI_QUERY

  • SLS 数据源(SLS_MULTI_DS):SLS_MULTI_QUERY

  • 基础云监控数据源(CMS_BASIC_DS):CMS_BASIC_QUERY

PROMQL_QUERY

secondJoin AlertRuleSlsQueryJoin

适用查询类型:SLS_MULTI_QUERY。

子查询 2(queries[2])和子查询 3(queries[3])结果的集合连接操作配置。

checkAfterDataComplete

boolean

适用查询类型: PROMQL_QUERY。

是否数据完整后再执行告警检测。

true

relationType

string

适用查询类型: CMS_BASIC_QUERY。

规则查询的资源范围,允许以下取值:

  • USER:用户 uid 下全部资源

  • GROUP: 应用分组

  • INSTANCE:指定实例列表

USER

groupId

string

适用查询类型:CMS_BASIC_QUERY。

关联应用分组 id,仅在 relationType=GROUP 时有效。

23423

namespace

string

适用查询类型:CMS_BASIC_QUERY。

指标的命名空间

acs_ecs_dashboard

dimensions

array

适用查询类型: CMS_BASIC_QUERY。

资源的过滤维度列表。

object

基础云监控的资源过滤维度

string

维度取值

i-f8zbbutcvfpx7gn457pi

serviceIds

array

服务 id 列表。

string

服务 id。

i-bp1234567890abcdef

entityFilter

object

资源过滤器,用于筛选目标资源。

domain

string

资源类型域。

rum

type

string

资源类型。

apm

filters

array

过滤条件列表,用于进一步筛选资源。

object

过滤条件对象。

field

string

字段

instanceId

operator

string

比较运算符。

=

value

string

匹配的值。

wait_throw

domain

string

资源所属的领域。

rum

metricSet

string

监控指标集合。

cpu_usage

metric

string

指标名。

memory