Service Mesh (ASM) lets you define service level objectives (SLOs) and alert rules declaratively through a ServiceLevelObjective custom resource definition (CRD).
The field reference below is organized by hierarchy: metadata > spec > slos[] > sli / alerting.
YAML example
The following manifest defines an availability SLO for the httpbin service in the default namespace. The objective is 99.9% and the SLO takes effect over a 30-day period, with both page-level and ticket-level alerts.
apiVersion: istio.alibabacloud.com/v1beta1
kind: ServiceLevelObjective
metadata:
name: asm-slo-default-httpbin # Format: asm-slo-{namespace}-{service}
namespace: default # Must match the target service namespace
spec:
service: httpbin # Target service name
period: 30d # Period of time during which the SLO takes effect: 30d, 28d, 14d, or 7d
labels:
owner: "finance-team" # Global label, propagated to all generated recording rules
slos:
- name: asm-slo2 # Unique SLO name within this CRD
objective: "99.9" # Target percentage as a string
labels:
description: "service availability description"
sli:
plugin:
id: availability # Plugin type: availability or latency
options: # Plugin-specific options
filter: request_protocol="http" # PromQL label filter
alerting:
name: asm-alert # Alert rule name
labels:
category: "availability"
annotations:
summary: "High error rate on requests"
pageAlert: # High-severity, page-level alert
labels:
severity: "10"
ticketAlert: # Low-severity, ticket-level alert
labels:
channel: "channel - call"
The following table summarizes the key fields. For complete field descriptions, see CRD field reference.
| Field | Description |
|---|
namespace | Namespace of the custom resource. Must match the namespace of the target service. |
service | Target service name. |
period | Period of time during which the SLO takes effect. Valid values: 30d, 28d, 14d, 7d. |
objective | Target percentage as a string. Valid range: (0, 100]. |
plugin | Defines the SLI type and options. Set id to availability or latency, then configure the corresponding options. See Plugin fields. |
CRD field reference
metadata fields
| Field | Type | Required | Description | Example |
|---|
name | String | Yes | Custom resource name. Format: asm-slo-{namespace}-{service}. | asm-slo-default-httpbin |
namespace | String | Yes | Custom resource namespace. Must match the namespace of the target service. | default |
labels | Object | No | Auto-populated by the backend. Do not set manually. The system adds two labels: asm-target-namespace (the service namespace) and asm-target-service (the service name, same as spec.service). | labels:
asm-target-namespace: default
asm-target-service: httpbin
|
spec fields
| Field | Type | Required | Description | Example |
|---|
service | String | Yes | Target service name. | httpbin |
period | String | Yes | Period of time during which the SLO takes effect. Valid values: 30d (30 days), 28d, 14d, 7d. | 30d |
labels | Object | No | Global label. Propagated to the labels field of every recording rule generated by the SLOs in this CRD. | labels:
global: "some-label"
|
slos | Array | Yes | One or more SLO definitions. At least one entry is required. | - |
slos[] fields
Each entry in the slos array defines a single SLO with its objective, SLI configuration, and alerting rules.
| Field | Type | Required | Description | Example |
|---|
name | String | Yes | SLO name. | asm-slo |
objective | String | Yes | Target percentage as a string parsable to a floating-point number. Valid range: (0, 100]. | "99.9" |
labels | Object | No | SLO-level label. Propagated to the labels field of every recording rule generated by this SLO. | labels:
recordlabel: aaa
|
sli | Object | Yes | Service level indicator (SLI) configuration. See sli fields. | - |
alerting | Object | Yes | Alert rule configuration. See alerting fields. | - |
sli fields
The sli object contains a single field: plugin.
| Field | Type | Required | Description | Example |
|---|
plugin | Object | Yes | Plugin configuration that defines how the SLI is measured. See Plugin fields. | - |
Plugin fields
The plugin determines the SLI measurement type. Set id to select the plugin, then configure the corresponding options.
| Field | Type | Required | Description | Example |
|---|
id | String | Yes | Plugin type. Valid values: availability (service availability), latency (service latency). | latency |
options | Map | Conditional | Plugin options. Required when the selected plugin has required fields. For example, latency requires bucket. See the options tables below. | options:
bucket: "300"
|
Options for availability
When id is set to availability, the following options are available:
| Field | Type | Required | Description | Example |
|---|
filter | String | No | PromQL label filter. Prometheus calculates metrics only for requests that match this filter. | request_protocol="http" |
Options for latency
When id is set to latency, the following options are available:
| Field | Type | Required | Description | Example |
|---|
bucket | String | Yes | Latency objective, as a string parsable to an integer. | "300" |
filter | String | No | PromQL label filter. Prometheus calculates metrics only for requests that match this filter. | request_protocol="http" |
exclude_errors | Boolean | No | Whether to exclude error requests from latency calculations. Default: false. When true, requests with a 5XX response code are excluded. When false, all requests are included. | false |
alerting fields
| Field | Type | Required | Description | Example |
|---|
name | String | Yes | Alert rule name. | asm-alert |
labels | Map | No | Labels attached to the alert rule. | labels:
alertlabel: bbb
|
annotations | Map | No | Annotations attached to the alert rule. | annotations:
alertanno: ccc
|
pageAlert | Object | No | Page-level high-severity alert configuration. See pageAlert fields. | - |
ticketAlert | Object | No | Ticket-level low-severity alert configuration. See ticketAlert fields. | - |
pageAlert fields
| Field | Type | Required | Description | Example |
|---|
disable | Boolean | No | Whether to enable this alert. Default: true (enabled). Set to false to disable. | false |
labels | Map | No | Labels attached to this alert. | labels:
pagelabel: ddd
|
annotations | Map | No | Annotations attached to this alert. | annotations:
pageanno: eee
|
ticketAlert fields
| Field | Type | Required | Description | Example |
|---|
disable | Boolean | No | Whether to enable this alert. Default: true (enabled). Set to false to disable. | false |
labels | Map | No | Labels attached to this alert. | labels:
pagelabel: ddd
|
annotations | Map | No | Annotations attached to this alert. | annotations:
pageanno: eee
|