cx-slos

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SLO Management Skill

SLO管理技能

An SLO (Service Level Objective) defines a reliability target for a service — e.g. "99.9% of requests succeed over 28 days". Use this skill to inspect SLO definitions, judge whether they are healthy, and manage their lifecycle.
SLO(服务水平目标)为服务定义了可靠性目标——例如“28天内99.9%的请求成功”。使用此技能可查看SLO定义、判断其是否正常,并管理其生命周期。

CLI Commands

CLI命令

CommandPurpose
cx slos list
List all SLO definitions
cx slos get <id>
Get a single SLO by ID
cx slos create --from-file <path>
Create an SLO from a JSON definition [requires
--yes
]
cx slos update --from-file <path>
Replace an SLO definition from JSON [requires
--yes
]
cx slos delete <id>
Delete an SLO [requires
--yes
]
  • All commands support
    -o json
    for structured output and
    -p <profile>
    (repeatable) for multi-profile fan-out.
  • create
    /
    update
    read from
    --from-file <path>
    , or
    -
    for stdin (the default).
  • create
    ,
    update
    , and
    delete
    are write operations and require
    --yes
    in non-interactive / agent mode.
命令用途
cx slos list
列出所有SLO定义
cx slos get <id>
通过ID获取单个SLO
cx slos create --from-file <path>
从JSON定义创建SLO [需要
--yes
参数]
cx slos update --from-file <path>
从JSON替换SLO定义 [需要
--yes
参数]
cx slos delete <id>
删除SLO [需要
--yes
参数]
  • 所有命令支持
    -o json
    以输出结构化数据,支持
    -p <profile>
    (可重复使用)实现多配置文件扩展。
  • create
    /
    update
    --from-file <path>
    读取数据,或使用
    -
    从标准输入读取(默认方式)。
  • create
    update
    delete
    为写入操作,在非交互/Agent模式下需要
    --yes
    参数。

SLO Definition

SLO定义

The fields surfaced on every SLO:
FieldMeaning
name
Human-readable SLO name
description
Optional description
targetThresholdPercentage
The objective, e.g.
99.9
sloType
SLO_TYPE_REQUEST
(request-based) or
SLO_TYPE_WINDOW
(window-based)
sloTimeFrame
Rolling window, e.g.
SLO_TIME_FRAME_7_DAYS
,
SLO_TIME_FRAME_28_DAYS
productType
The pillar the SLO is computed from, e.g.
SLO_PRODUCT_TYPE_APM
每个SLO包含以下字段:
字段含义
name
便于人类阅读的SLO名称
description
可选描述信息
targetThresholdPercentage
目标值,例如
99.9
sloType
SLO_TYPE_REQUEST
(基于请求)或
SLO_TYPE_WINDOW
(基于时间窗口)
sloTimeFrame
滚动时间窗口,例如
SLO_TIME_FRAME_7_DAYS
SLO_TIME_FRAME_28_DAYS
productType
计算SLO的支柱类型,例如
SLO_PRODUCT_TYPE_APM

Monitoring SLO Health

监控SLO健康状态

bash
undefined
bash
undefined

All SLOs with their target and window

查看所有SLO的目标值和时间窗口

cx slos list -o json | jq '[.[] | {name, targetThresholdPercentage, sloType, sloTimeFrame}]'
cx slos list -o json | jq '[.[] | {name, targetThresholdPercentage, sloType, sloTimeFrame}]'

Inspect a single SLO in full

查看单个SLO的完整信息

cx slos get <slo-id> -o json

Compare the live attainment against `targetThresholdPercentage` to judge whether
the SLO is healthy or burning error budget. A **request-based** SLO measures the
fraction of good events; a **window-based** SLO measures the fraction of good time
windows. After triage, pivot to the `cx-telemetry-querying` skill to find the root
cause of a breach in logs, spans, or metrics.
cx slos get <slo-id> -o json

将实时达标率与`targetThresholdPercentage`对比,判断SLO是否正常或是否在消耗错误预算。**基于请求的SLO**衡量正常事件的占比;**基于时间窗口的SLO**衡量正常时间窗口的占比。完成分类后,可切换至`cx-telemetry-querying`技能,在日志、追踪和指标中查找违规的根本原因。

Creating and Updating SLOs

创建和更新SLO

The safest way to author an SLO is to round-trip an existing one — template from the exact field shape that
get
returns rather than hand-writing JSON:
bash
undefined
编写SLO定义最安全的方式是复用现有SLO——以
get
命令返回的精确字段结构为模板,而非手动编写JSON:
bash
undefined

Template from an existing SLO, edit, then create

从现有SLO生成模板,编辑后创建新SLO

cx slos get <existing-slo-id> -o json > slo.json
cx slos get <existing-slo-id> -o json > slo.json

Edit slo.json: change name, targetThresholdPercentage, sloType, sloTimeFrame, etc.

编辑slo.json:修改名称、targetThresholdPercentage、sloType、sloTimeFrame等字段

cx slos create --from-file slo.json --yes
cx slos create --from-file slo.json --yes

Replace an existing definition

替换现有SLO定义

cx slos update --from-file slo.json --yes

`update` and `delete` report the alert IDs they affect (`effectedSloAlertIds`), so
review that list — changing or removing an SLO can disable the alerts attached to
it.
cx slos update --from-file slo.json --yes

`update`和`delete`会报告受影响的告警ID(`effectedSloAlertIds`),请查看该列表——修改或删除SLO可能会禁用与其关联的告警。

Key Principles

核心原则

  • Check attainment vs. target, not just existence — an SLO at 99.91% against a 99.9% target has almost no error budget left and needs attention before it breaches.
  • Round-trip definitions — template create/update payloads from
    cx slos get
    rather than hand-writing JSON, to keep the exact field shape the API expects.
  • create
    /
    update
    /
    delete
    need
    --yes
    in agent / non-interactive mode.
  • Watch affected alerts
    update
    /
    delete
    return
    effectedSloAlertIds
    ; deleting an SLO can silence its alerts.
  • Multi-profile fan-out with
    -p <profile>
    (repeatable) to compare SLOs across environments.
  • 对比达标率与目标值,而非仅检查存在性——目标值为99.9%的SLO若达标率为99.91%,则剩余错误预算已所剩无几,需在违规前引起重视。
  • 复用定义模板——以
    cx slos get
    的输出为模板创建/更新负载,而非手动编写JSON,确保字段结构符合API要求。
  • 在Agent/非交互模式下,
    create
    /
    update
    /
    delete
    需要
    --yes
    参数。
  • 关注受影响的告警——
    update
    /
    delete
    会返回
    effectedSloAlertIds
    ;删除SLO可能会静默其关联的告警。
  • 使用
    -p <profile>
    (可重复使用)实现多配置文件扩展,跨环境对比SLO。

Related Skills

相关技能

  • cx-alerts
    — the alert definitions that fire when an SLO's error budget burns.
  • cx-telemetry-querying
    — investigate the logs, spans, and metrics behind an SLO breach.
  • cx-cases
    — triage the cases that group the alert events raised against a service.
  • cx-alerts
    ——当SLO错误预算耗尽时触发的告警定义。
  • cx-telemetry-querying
    ——调查SLO违规背后的日志、追踪和指标。
  • cx-cases
    ——分类处理针对服务触发的告警事件所关联的工单。