All Products
Search
Document Center

Alibaba Cloud Service Mesh:Description of SLO CRD fields

Last Updated:Jun 05, 2023

Service Mesh (ASM) allows you to configure service level objectives (SLOs) and alert rules by creating custom resource definitions (CRDs). This simplifies your configuration process. This topic describes fields in an SLO CRD.

Sample file

The following sample file shows you how to configure an SLO for the httpbin application service in the default namespace to specify the service availability. In the file, the objective is 99.9% and the period of time during which the SLO takes effect is 30 days. Two severity levels of alerts are configured: pageAlert and ticketAlert. Custom labels and annotations are added to alerts.

apiVersion: istio.alibabacloud.com/v1beta1
kind: ServiceLevelObjective
metadata:
  name: asm-slo-default-httpbin
  namespace: default # Namespace to which the custom resource belongs 
spec:
  service: httpbin # Name of the application for which you want to configure an SLO 
  period: 30d # Period of time during which the SLO takes effect 
  labels:
    owner: "finance-team"
  slos:
  - name: asm-slo2 # Name of the SLO 
    objective: "99.9" # Objective 
    labels:
      description: "service availability description"
    sli:
      plugin:
        id: availability # Type of the plug-in 
        options: # Options of the plug-in 
          filter: request_protocol="http"
    alerting:
      name: asm-alert # Name of the alert rule 
      labels:
        category: "availability"
      annotations:
        summary: "High error rate on requests"
      pageAlert:
        labels:
          severity: "10"
      ticketAlert:
        labels:
          channel: "channel - call"

The following table describes some of the fields in the YAML file. For more information, see Description of CRD fields.

Field

Description

namespace

The namespace to which the custom resource belongs, which is also the namespace where the application for which you want to configure an SLO resides.

service

The name of the application.

period

The period of time during which the SLO takes effect. The unit is d, which indicates days. Valid values: 30d, 28d, 14d, and 7d.

objective

The objective.

plugin

  • id: The type of the plug-in.

  • options: The options of the plug-in. Skip this field if no option is available.

For more information about this field, see plugin field in this topic.

Description of CRD fields

metadata fields

Field

Type

Required

Description

Example

name

String

Yes

The name of the custom resource. Format: asm-slo-{Namespace where the application for which you want to configure an SLO resides}-{Name of the application}.

asm-slo-default-httpbin

namespace

String

Yes

The namespace to which the custom resource belongs. The value must be the same as the namespace where the application for which you want to configure an SLO resides.

default

labels

Object

No

You do not need to specify this field. The backend automatically populates two values for the label selector to use.

  • asm-target-namespace: The namespace where the application resides.

  • asm-target-service: The name of the application. The name is the same as the value of service in the spec field.

labels: asm-target-namespace: default asm-target-service: httpbin

spec fields

Field

Type

Required

Description

Example

service

String

Yes

The name of the application.

httpbin

period

String

Yes

The period of time during which the SLO takes effect. Valid values: 30d, 28d, 14d, and 7d. 30d indicates 30 days.

30d

labels

Object

No

The global label. The labels field of each Recording Rules generated by the SLO in the slos field contains this label.

labels: global: "some-label"

slos

Array [definitions of SLOs]

Yes

The SLOs that you want to configure. You must configure at least one SLO.

-

slos fields

Field

Type

Required

Description

Example

name

String

Yes

The name of the SLO.

asm-slo

objective

String

Yes

The objective. The value must be a string that can be parsed as a floating-point number that is greater than 0 and less than or equal to 100.

"99.9"

labels

Object

No

The SLO label. The label will be attached to the labels field of each Recording Rules generated by the SLO.

labels: recordlabel: aaa

sli

Object [definition of the SLI]

Yes

The configuration of the service level indicator (SLI).

-

alerting

Object [definition of the alert rule]

Yes

The configuration of the alert rule.

-

sli fields

Field

Type

Required

Description

Example

plugin

Object [definition of the plug-in]

Yes

The plug-in configuration.

-

plugin fields

Field

Type

Required

Description

Example

id

String

Yes

The ID of the plug-in. Valid values:

  • availability: The SLO plug-in that specifies service availability.

  • latency: The SLO plug-in that specifies service latency.

latency

options

Map

No

Note

Required if options contains required fields.

The options of the plug-in. The plug-in options vary depending on the plug-in ID.

options: bucket: "300"

Different plug-in IDs correspond to different plug-in options.

  • The following table describes the options field when id is availability.

    Field

    Type

    Required

    Description

    Example

    filter

    String

    No

    The label filter. Prometheus only calculates the metrics of applications that contain the specified label. The usage of this field is the same as that of promQL.

    request_protocol="http"

  • The following table describes the options field when id is latency.

    Field

    Type

    Required

    Description

    Example

    bucket

    String

    Yes

    The latency objective. The value is a string that can be directly converted to an integer.

    "300"

    filter

    String

    No

    The label filter. Prometheus only calculates the metrics of applications that contain the specified label. The usage of this parameter is the same as that of promQL.

    request_protocol="http"

    exclude_errors

    Bool

    No

    Specifies whether to filter out error requests. Default value: false.

    • true: Prometheus calculates the latency based on the requests except those with a response code of 5XX.

    • false: Prometheus calculates the latency based on all the requests including error ones.

    false

alerting fields

Field

Type

Required

Description

Example

name

String

Yes

The name of the alert rule.

asm-alert

labels

Map

No

The label of the alert rule.

labels: alertlabel: bbb

annotations

Map

No

The alert annotations.

annotations: alertanno: ccc

pageAlert

Object

No

The configuration of Page-level high-severity alerts.

-

ticketAlert

Object

No

The configuration of Ticket-level low-severity alerts.

-

pageAlert fields

Field

Type

Required

Description

Example

disable

Bool

No

Specifies whether to enable this alert rule. The default value is true, which indicates that the alert rule is enabled.

false

labels

Map

No

The label of the alert rule.

labels: pagelabel: ddd

annotations

Map

No

The alert annotations.

annotations: pageanno: eee

ticketAlert fields

Field

Type

Required

Description

Example

disable

Bool

No

Specifies whether to enable this alert rule. The default value is true, which indicates that the alert rule is enabled.

false

labels

Map

No

The label of the alert rule.

labels: pagelabel: ddd

annotations

Map

No

The alert annotations.

annotations: pageanno: eee