Skip to main content

slos

Creates, updates, deletes, gets or lists a slos resource.

Overview

Nameslos
TypeResource
Iddatadog.service_management.slos

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringA unique identifier for the service level objective object. Always included in service level objective responses.
namestringThe name of the service level objective object. (example: Custom Metric SLO)
configured_alert_idsarrayA 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_atinteger (int64)Creation timestamp (UNIX time in seconds) Always included in service level objective responses.
creatorobjectObject describing the creator of the shared element.
descriptionstringA user-defined description of the service level objective. Always included in service level objective responses (but may be null). Optional in create/update requests.
groupsarrayA 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_atinteger (int64)Modification timestamp (UNIX time in seconds) Always included in service level objective responses.
monitor_idsarrayA list of monitor ids that defines the scope of a monitor service level objective. Required if type is monitor.
monitor_tagsarrayThe 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).
queryobjectA 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_specificationobjectA generic SLI specification. This is used for time-slice and count-based (metric) SLOs only.
tagsarrayA 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.
thresholdsarrayThe thresholds (timeframes and associated targets) for this service level objective object.
timeframestringThe 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)
typestringThe type of the service level objective. (metric, monitor, time_slice) (example: metric)
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.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_sloselectslo_idwith_configured_alert_idsGet a service level objective object.
list_slosselectids, query, tags_query, metrics_query, limit, offset, is_deletedGet a list of service level objective objects for your organization.
check_can_delete_sloselectidsCheck if an SLO can be safely deleted. For example,<br />assure an SLO can be deleted without disrupting a dashboard.
create_sloinsertname, thresholds, typeCreate a service level objective object.
update_sloreplaceslo_id, name, thresholds, typeUpdate the specified service level objective object.
delete_slodeleteslo_idforcePermanently 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_bulkexecDelete (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.

NameDatatypeDescription
idsstringA comma separated list of the IDs of the service level objectives objects. (example: id1, id2, id3)
sitestringThe 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_idstringThe ID of the service level objective.
forcestringDelete the monitor even if it's referenced by other resources (for example SLO, composite monitor).
idsstringA comma separated list of the IDs of the service level objectives objects. (example: id1, id2, id3)
is_deletedbooleanWhether to return only deleted service level objective objects. (example: true)
limitinteger (int64)The number of SLOs to return in the response.
metrics_querystringThe query string to filter results based on SLO numerator and denominator. (example: aws.elb.request_count)
offsetinteger (int64)The specific offset to use as the beginning of the returned response.
querystringThe query string to filter results based on SLO names. (example: monitor)
tags_querystringThe query string to filter results based on a single SLO tag. (example: env:prod)
with_configured_alert_idsbooleanGet the IDs of SLO monitors that reference this SLO. (example: true)

SELECT examples

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 }}'
;

INSERT examples

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
;

REPLACE examples

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

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 (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
;