v1

latestOpenAPI 3.0.02026-07-142351,1971.3 MB
Service Level Objectives

Update an SLO

Update the specified service level objective object.

put/api/v1/slo/{slo_id}

Path parameters

slo_idstring required

The ID of the service level objective object.

Request body

created_atinteger

Creation timestamp (UNIX time in seconds)

Always included in service level objective responses.

descriptionstring nullable

A user-defined description of the service level objective.

Always included in service level objective responses (but may be null). Optional in create/update requests.

groupsstring[]

A list of (up to 100) monitor groups that narrow the scope of a monitor service level objective.

Included in service level objective responses if it is not empty. Optional in create/update requests for monitor service level objectives, but may only be used when then length of the monitor_ids field is one.

idstring

A unique identifier for the service level objective object.

Always included in service level objective responses.

modified_atinteger

Modification timestamp (UNIX time in seconds)

Always included in service level objective responses.

monitor_idsinteger[]

A list of monitor ids that defines the scope of a monitor service level objective. Required if type is monitor.

monitor_tagsstring[]

The union of monitor tags for all monitors referenced by the monitor_ids field. Always included in service level objective responses for monitor-based service level objectives (but may be empty). Ignored in create/update requests. Does not affect which monitors are included in the service level objective (that is determined entirely by the monitor_ids field).

namestring required

The name of the service level objective object.

tagsstring[]

A list of tags associated with this service level objective. Always included in service level objective responses (but may be empty). Optional in create/update requests.

target_thresholdnumber double

The target threshold such that when the service level indicator is above this threshold over the given timeframe, the objective is being met.

timeframe'7d' | '30d' | '90d' | 'custom'

The SLO time window options. Note that "custom" is not a valid option for creating or updating SLOs. It is only used when querying SLO history over custom timeframes.

type'metric' | 'monitor' | 'time_slice' required

The type of the service level objective.

warning_thresholdnumber double

The optional warning threshold such that when the service level indicator is below this value for the given threshold, but above the target threshold, the objective appears in a "warning" state. This value must be greater than the target threshold.

Example request

{
  "groups": [
    "env:prod",
    "role:mysql"
  ],
  "name": "Custom Metric SLO",
  "query": {
    "denominator": "sum:my.custom.metric{*}.as_count()",
    "numerator": "sum:my.custom.metric{type:good}.as_count()"
  },
  "sli_specification": {
    "time_slice": {
      "comparator": "<",
      "query": {
        "formulas": [
          {
            "formula": "query2/query1"
          }
        ],
        "queries": [
          {
            "data_source": "metrics",
            "name": "query1",
            "query": "sum:trace.servlet.request.hits{*} by {env}.as_count()"
          },
          {
            "data_source": "metrics",
            "name": "query2",
            "query": "sum:trace.servlet.request.errors{*} by {env}.as_count()"
          }
        ]
      },
      "threshold": 5
    }
  },
  "tags": [
    "env:prod",
    "app:core"
  ],
  "target_threshold": 99.9,
  "thresholds": [
    {
      "target": 95,
      "timeframe": "7d"
    },
    {
      "target": 95,
      "timeframe": "30d",
      "warning": 97
    }
  ],
  "timeframe": "30d",
  "type": "metric",
  "warning_threshold": 99.95
}

Response

OK

errorsstring[]

An array of error messages. Each endpoint documents how/whether this field is used.

Example response

{
  "data": [
    {
      "groups": [
        "env:prod",
        "role:mysql"
      ],
      "name": "Custom Metric SLO",
      "query": {
        "denominator": "sum:my.custom.metric{*}.as_count()",
        "numerator": "sum:my.custom.metric{type:good}.as_count()"
      },
      "sli_specification": {
        "time_slice": {
          "comparator": "<",
          "query": {
            "formulas": [
              {
                "formula": "query2/query1"
              }
            ],
            "queries": [
              {
                "data_source": "metrics",
                "name": "query1",
                "query": "sum:trace.servlet.request.hits{*} by {env}.as_count()"
              },
              {
                "data_source": "metrics",
                "name": "query2",
                "query": "sum:trace.servlet.request.errors{*} by {env}.as_count()"
              }
            ]
          },
          "threshold": 5
        }
      },
      "tags": [
        "env:prod",
        "app:core"
      ],
      "target_threshold": 99.9,
      "thresholds": [
        {
          "target": 95,
          "timeframe": "7d"
        },
        {
          "target": 95,
          "timeframe": "30d",
          "warning": 97
        }
      ],
      "timeframe": "30d",
      "type": "metric",
      "warning_threshold": 99.95
    }
  ]
}