slos
Creates, updates, deletes, gets or lists a slos resource.
Overview
| Name | slos |
| Type | Resource |
| Id | datadog.service_management.slos |
Fields
The following fields are returned by SELECT queries:
- get_slo
- list_slos
- check_can_delete_slo
| Name | Datatype | Description |
|---|---|---|
id | string | A unique identifier for the service level objective object. Always included in service level objective responses. |
name | string | The name of the service level objective object. (example: Custom Metric SLO) |
configured_alert_ids | array | A list of SLO monitors IDs that reference this SLO. This field is returned only when with_configured_alert_ids parameter is true in query. |
created_at | integer (int64) | Creation timestamp (UNIX time in seconds) Always included in service level objective responses. |
creator | object | Object describing the creator of the shared element. |
description | string | 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. |
groups | array | A list of (up to 20) 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. |
modified_at | integer (int64) | Modification timestamp (UNIX time in seconds) Always included in service level objective responses. |
monitor_ids | array | A list of monitor ids that defines the scope of a monitor service level objective. Required if type is monitor. |
monitor_tags | array | The union of monitor tags for all monitors referenced by the monitor_ids field. Always included in service level objective responses for monitor 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). |
query | object | A count-based (metric) SLO query. This field is superseded by sli_specification but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator to be used because this will sum up all request counts instead of averaging them, or taking the max or min of all of those requests. |
sli_specification | object | A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only. |
tags | array | 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_threshold | number (double) | The target threshold such that when the service level indicator is above this threshold over the given timeframe, the objective is being met. |
thresholds | array | The thresholds (timeframes and associated targets) for this service level objective object. |
timeframe | string | 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. (7d, 30d, 90d, custom) (example: 30d) |
type | string | The type of the service level objective. (metric, monitor, time_slice) (example: metric) |
warning_threshold | number (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. |
| Name | Datatype | Description |
|---|---|---|
id | string | A unique identifier for the service level objective object. Always included in service level objective responses. |
name | string | The name of the service level objective object. (example: Custom Metric SLO) |
created_at | integer (int64) | Creation timestamp (UNIX time in seconds) Always included in service level objective responses. |
creator | object | Object describing the creator of the shared element. |
description | string | 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. |
groups | array | 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. |
modified_at | integer (int64) | Modification timestamp (UNIX time in seconds) Always included in service level objective responses. |
monitor_ids | array | A list of monitor ids that defines the scope of a monitor service level objective. Required if type is monitor. |
monitor_tags | array | 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). |
query | object | A count-based (metric) SLO query. This field is superseded by sli_specification but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator to be used because this will sum up all request counts instead of averaging them, or taking the max or min of all of those requests. |
sli_specification | object | A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only. |
tags | array | 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_threshold | number (double) | The target threshold such that when the service level indicator is above this threshold over the given timeframe, the objective is being met. |
thresholds | array | The thresholds (timeframes and associated targets) for this service level objective object. |
timeframe | string | 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. (7d, 30d, 90d, custom) (example: 30d) |
type | string | The type of the service level objective. (metric, monitor, time_slice) (example: metric) |
warning_threshold | number (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. |
| Name | Datatype | Description |
|---|---|---|
ok | array | An array of SLO IDs that can be safely deleted. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_slo | select | slo_id | with_configured_alert_ids | Get a service level objective object. |
list_slos | select | ids, query, tags_query, metrics_query, limit, offset, is_deleted | Get a list of service level objective objects for your organization. | |
check_can_delete_slo | select | ids | Check if an SLO can be safely deleted. For example,<br />assure an SLO can be deleted without disrupting a dashboard. | |
create_slo | insert | name, thresholds, type | Create a service level objective object. | |
update_slo | replace | slo_id, name, thresholds, type | Update the specified service level objective object. | |
delete_slo | delete | slo_id | force | Permanently delete the specified service level objective object.<br /><br />If an SLO is used in a dashboard, the DELETE /v1/slo/ endpoint returns<br />a 409 conflict error because the SLO is referenced in a dashboard. |
delete_slotimeframe_in_bulk | exec | Delete (or partially delete) multiple service level objective objects.<br /><br />This endpoint facilitates deletion of one or more thresholds for one or more<br />service level objective objects. If all thresholds are deleted, the service level<br />objective object is deleted as well. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
ids | string | A comma separated list of the IDs of the service level objectives objects. (example: id1, id2, id3) |
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
slo_id | string | The ID of the service level objective. |
force | string | Delete the monitor even if it's referenced by other resources (for example SLO, composite monitor). |
ids | string | A comma separated list of the IDs of the service level objectives objects. (example: id1, id2, id3) |
is_deleted | boolean | Whether to return only deleted service level objective objects. (example: true) |
limit | integer (int64) | The number of SLOs to return in the response. |
metrics_query | string | The query string to filter results based on SLO numerator and denominator. (example: aws.elb.request_count) |
offset | integer (int64) | The specific offset to use as the beginning of the returned response. |
query | string | The query string to filter results based on SLO names. (example: monitor) |
tags_query | string | The query string to filter results based on a single SLO tag. (example: env:prod) |
with_configured_alert_ids | boolean | Get the IDs of SLO monitors that reference this SLO. (example: true) |
SELECT examples
- get_slo
- list_slos
- check_can_delete_slo
Get a service level objective object.
SELECT
id,
name,
configured_alert_ids,
created_at,
creator,
description,
groups,
modified_at,
monitor_ids,
monitor_tags,
query,
sli_specification,
tags,
target_threshold,
thresholds,
timeframe,
type,
warning_threshold
FROM datadog.service_management.slos
WHERE slo_id = '{{ slo_id }}' -- required
AND with_configured_alert_ids = '{{ with_configured_alert_ids }}'
;
Get a list of service level objective objects for your organization.
SELECT
id,
name,
created_at,
creator,
description,
groups,
modified_at,
monitor_ids,
monitor_tags,
query,
sli_specification,
tags,
target_threshold,
thresholds,
timeframe,
type,
warning_threshold
FROM datadog.service_management.slos
WHERE ids = '{{ ids }}'
AND query = '{{ query }}'
AND tags_query = '{{ tags_query }}'
AND metrics_query = '{{ metrics_query }}'
AND limit = '{{ limit }}'
AND offset = '{{ offset }}'
AND is_deleted = '{{ is_deleted }}'
;
Check if an SLO can be safely deleted. For example,<br />assure an SLO can be deleted without disrupting a dashboard.
SELECT
ok
FROM datadog.service_management.slos
WHERE ids = '{{ ids }}' -- required
;
INSERT examples
- create_slo
- Manifest
Create a service level objective object.
INSERT INTO datadog.service_management.slos (
description,
groups,
monitor_ids,
name,
query,
sli_specification,
tags,
target_threshold,
thresholds,
timeframe,
type,
warning_threshold
)
SELECT
'{{ description }}',
'{{ groups }}',
'{{ monitor_ids }}',
'{{ name }}' /* required */,
'{{ query }}',
'{{ sli_specification }}',
'{{ tags }}',
{{ target_threshold }},
'{{ thresholds }}' /* required */,
'{{ timeframe }}',
'{{ type }}' /* required */,
{{ warning_threshold }}
RETURNING
data,
errors,
metadata
;
# Description fields are for documentation purposes
- name: slos
props:
- name: description
value: "{{ description }}"
description: |
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.
- name: groups
value:
- "{{ groups }}"
description: |
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.
- name: monitor_ids
value:
- {{ monitor_ids }}
description: |
A list of monitor IDs that defines the scope of a monitor service level
objective. **Required if type is `monitor`**.
- name: name
value: "{{ name }}"
description: |
The name of the service level objective object.
- name: query
description: |
A count-based (metric) SLO query. This field is superseded by `sli_specification` but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator
to be used because this will sum up all request counts instead of averaging them, or taking the max or
min of all of those requests.
value:
denominator: "{{ denominator }}"
numerator: "{{ numerator }}"
- name: sli_specification
description: |
A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only.
value:
time_slice:
comparator: "{{ comparator }}"
query:
formulas:
- formula: "{{ formula }}"
queries:
- aggregator: "{{ aggregator }}"
cross_org_uuids: "{{ cross_org_uuids }}"
data_source: "{{ data_source }}"
name: "{{ name }}"
query: "{{ query }}"
semantic_mode: "{{ semantic_mode }}"
query_interval_seconds: {{ query_interval_seconds }}
threshold: {{ threshold }}
count:
good_events_formula:
formula: "{{ formula }}"
queries:
- aggregator: "{{ aggregator }}"
cross_org_uuids: "{{ cross_org_uuids }}"
data_source: "{{ data_source }}"
name: "{{ name }}"
query: "{{ query }}"
semantic_mode: "{{ semantic_mode }}"
total_events_formula:
formula: "{{ formula }}"
bad_events_formula:
formula: "{{ formula }}"
- name: tags
value:
- "{{ tags }}"
description: |
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.
- name: target_threshold
value: {{ target_threshold }}
description: |
The target threshold such that when the service level indicator is above this
threshold over the given timeframe, the objective is being met.
- name: thresholds
description: |
The thresholds (timeframes and associated targets) for this service level
objective object.
value:
- target: {{ target }}
target_display: "{{ target_display }}"
timeframe: "{{ timeframe }}"
warning: {{ warning }}
warning_display: "{{ warning_display }}"
- name: timeframe
value: "{{ timeframe }}"
description: |
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.
valid_values: ['7d', '30d', '90d', 'custom']
- name: type
value: "{{ type }}"
description: |
The type of the service level objective.
valid_values: ['metric', 'monitor', 'time_slice']
- name: warning_threshold
value: {{ warning_threshold }}
description: |
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.
REPLACE examples
- update_slo
Update the specified service level objective object.
REPLACE datadog.service_management.slos
SET
description = '{{ description }}',
groups = '{{ groups }}',
monitor_ids = '{{ monitor_ids }}',
monitor_tags = '{{ monitor_tags }}',
name = '{{ name }}',
query = '{{ query }}',
sli_specification = '{{ sli_specification }}',
tags = '{{ tags }}',
target_threshold = {{ target_threshold }},
thresholds = '{{ thresholds }}',
timeframe = '{{ timeframe }}',
type = '{{ type }}',
warning_threshold = {{ warning_threshold }}
WHERE
slo_id = '{{ slo_id }}' --required
AND name = '{{ name }}' --required
AND thresholds = '{{ thresholds }}' --required
AND type = '{{ type }}' --required
RETURNING
data,
errors,
metadata;
DELETE examples
- delete_slo
Permanently delete the specified service level objective object.<br /><br />If an SLO is used in a dashboard, the DELETE /v1/slo/ endpoint returns<br />a 409 conflict error because the SLO is referenced in a dashboard.
DELETE FROM datadog.service_management.slos
WHERE slo_id = '{{ slo_id }}' --required
AND force = '{{ force }}'
;
Lifecycle Methods
EXEC variables use wire (API) names.
- delete_slotimeframe_in_bulk
Delete (or partially delete) multiple service level objective objects.<br /><br />This endpoint facilitates deletion of one or more thresholds for one or more<br />service level objective objects. If all thresholds are deleted, the service level<br />objective object is deleted as well.
EXEC datadog.service_management.slos.delete_slotimeframe_in_bulk
;