Always included in service level objective responses.
creator
object
Object describing the creator of the shared element.
email
string
Email of the creator.
handle
string
Handle of the creator.
name
string
Name of the creator.
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
[string]
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.
id
string
A unique identifier for the service level objective object.
Always included in service level objective responses.
modified_at
int64
Modification timestamp (UNIX time in seconds)
Always included in service level objective responses.
monitor_ids
[integer]
A list of monitor ids that defines the scope of a monitor service level
objective. Required if type is monitor.
monitor_tags
[string]
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).
name [required]
string
The name of the service level objective object.
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.
denominator [required]
string
A Datadog metric query for total (valid) events.
numerator [required]
string
A Datadog metric query for good events.
sli_specification
<oneOf>
A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only.
Option 1
object
A time-slice SLI specification.
time_slice [required]
object
The time-slice condition, composed of 3 parts: 1. the metric timeseries query, 2. the comparator,
and 3. the threshold. Optionally, a fourth part, the query interval, can be provided.
comparator [required]
enum
The comparator used to compare the SLI value to the threshold.
Allowed enum values: >,>=,<,<=
query [required]
object
The queries and formula used to calculate the SLI value.
formulas [required]
[object]
A list that contains exactly one formula, as only a single formula may be used in a time-slice SLO.
formula [required]
string
The formula string, which is an expression involving named queries.
queries [required]
[ <oneOf>]
A list of queries that are used to calculate the SLI value.
Option 1
object
A formula and functions metrics query.
aggregator
enum
The aggregation methods available for metrics queries.
Allowed enum values: avg,min,max,sum,last,area,l2norm,percentile
cross_org_uuids
[string]
The source organization UUID for cross organization queries. Feature in Private Beta.
data_source [required]
enum
Data source for metrics queries.
Allowed enum values: metrics
name [required]
string
Name of the query for use in formulas.
query [required]
string
Metrics query definition.
semantic_mode
enum
Semantic mode for metrics queries. This determines how metrics from different sources are combined or displayed.
Allowed enum values: combined,native
query_interval_seconds
enum
The interval used when querying data, which defines the size of a time slice.
Two values are allowed: 60 (1 minute) and 300 (5 minutes).
If not provided, the value defaults to 300 (5 minutes).
Allowed enum values: 60,300
threshold [required]
double
The threshold value to which each SLI value will be compared.
Option 2
object
A metric SLI specification.
count [required]
<oneOf>
A count-based (metric) SLI specification, composed of three parts: the good events formula,
the bad or total events formula, and the underlying queries.
Exactly one of total_events_formula or bad_events_formula must be provided.
Option 1
object
SLO count definition using a total events formula alongside a good events formula.
good_events_formula [required]
object
A formula that specifies how to combine the results of multiple queries.
formula [required]
string
The formula string, which is an expression involving named queries.
queries [required]
[ <oneOf>]
Option 1
object
A formula and functions metrics query.
aggregator
enum
The aggregation methods available for metrics queries.
Allowed enum values: avg,min,max,sum,last,area,l2norm,percentile
cross_org_uuids
[string]
The source organization UUID for cross organization queries. Feature in Private Beta.
data_source [required]
enum
Data source for metrics queries.
Allowed enum values: metrics
name [required]
string
Name of the query for use in formulas.
query [required]
string
Metrics query definition.
semantic_mode
enum
Semantic mode for metrics queries. This determines how metrics from different sources are combined or displayed.
Allowed enum values: combined,native
total_events_formula [required]
object
The total events formula. Bad events queries can be defined using the bad_events_formula field as an alternative. Only one of total_events_formula or bad_events_formula must be provided.
formula [required]
string
The formula string, which is an expression involving named queries.
Option 2
object
SLO count definition using a bad events formula alongside a good events formula.
bad_events_formula [required]
object
The bad events formula (recommended). Total events queries can be defined using the total_events_formula field as an alternative. Only one of total_events_formula or bad_events_formula must be provided.
formula [required]
string
The formula string, which is an expression involving named queries.
good_events_formula [required]
object
A formula that specifies how to combine the results of multiple queries.
formula [required]
string
The formula string, which is an expression involving named queries.
queries [required]
[ <oneOf>]
Option 1
object
A formula and functions metrics query.
aggregator
enum
The aggregation methods available for metrics queries.
Allowed enum values: avg,min,max,sum,last,area,l2norm,percentile
cross_org_uuids
[string]
The source organization UUID for cross organization queries. Feature in Private Beta.
data_source [required]
enum
Data source for metrics queries.
Allowed enum values: metrics
name [required]
string
Name of the query for use in formulas.
query [required]
string
Metrics query definition.
semantic_mode
enum
Semantic mode for metrics queries. This determines how metrics from different sources are combined or displayed.
Allowed enum values: combined,native
tags
[string]
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
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 [required]
[object]
The thresholds (timeframes and associated targets) for this service level
objective object.
target [required]
double
The target value for the service level indicator within the corresponding
timeframe.
target_display
string
A string representation of the target that indicates its precision.
It uses trailing zeros to show significant decimal places (for example 98.00).
Always included in service level objective responses. Ignored in
create/update requests.
timeframe [required]
enum
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.
Allowed enum values: 7d,30d,90d,custom
warning
double
The warning value for the service level objective.
warning_display
string
A string representation of the warning target (see the description of
the target_display field for details).
Included in service level objective responses if a warning target exists.
Ignored in create/update requests.
timeframe
enum
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.
Allowed enum values: 7d,30d,90d,custom
type [required]
enum
The type of the service level objective.
Allowed enum values: metric,monitor,time_slice
warning_threshold
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.
A response with one or more service level objective.
Expand All
항목
유형
설명
data
[object]
An array of service level objective objects.
created_at
int64
Creation timestamp (UNIX time in seconds)
Always included in service level objective responses.
creator
object
Object describing the creator of the shared element.
email
string
Email of the creator.
handle
string
Handle of the creator.
name
string
Name of the creator.
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
[string]
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.
id
string
A unique identifier for the service level objective object.
Always included in service level objective responses.
modified_at
int64
Modification timestamp (UNIX time in seconds)
Always included in service level objective responses.
monitor_ids
[integer]
A list of monitor ids that defines the scope of a monitor service level
objective. Required if type is monitor.
monitor_tags
[string]
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).
name [required]
string
The name of the service level objective object.
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.
denominator [required]
string
A Datadog metric query for total (valid) events.
numerator [required]
string
A Datadog metric query for good events.
sli_specification
<oneOf>
A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only.
Option 1
object
A time-slice SLI specification.
time_slice [required]
object
The time-slice condition, composed of 3 parts: 1. the metric timeseries query, 2. the comparator,
and 3. the threshold. Optionally, a fourth part, the query interval, can be provided.
comparator [required]
enum
The comparator used to compare the SLI value to the threshold.
Allowed enum values: >,>=,<,<=
query [required]
object
The queries and formula used to calculate the SLI value.
formulas [required]
[object]
A list that contains exactly one formula, as only a single formula may be used in a time-slice SLO.
formula [required]
string
The formula string, which is an expression involving named queries.
queries [required]
[ <oneOf>]
A list of queries that are used to calculate the SLI value.
Option 1
object
A formula and functions metrics query.
aggregator
enum
The aggregation methods available for metrics queries.
Allowed enum values: avg,min,max,sum,last,area,l2norm,percentile
cross_org_uuids
[string]
The source organization UUID for cross organization queries. Feature in Private Beta.
data_source [required]
enum
Data source for metrics queries.
Allowed enum values: metrics
name [required]
string
Name of the query for use in formulas.
query [required]
string
Metrics query definition.
semantic_mode
enum
Semantic mode for metrics queries. This determines how metrics from different sources are combined or displayed.
Allowed enum values: combined,native
query_interval_seconds
enum
The interval used when querying data, which defines the size of a time slice.
Two values are allowed: 60 (1 minute) and 300 (5 minutes).
If not provided, the value defaults to 300 (5 minutes).
Allowed enum values: 60,300
threshold [required]
double
The threshold value to which each SLI value will be compared.
Option 2
object
A metric SLI specification.
count [required]
<oneOf>
A count-based (metric) SLI specification, composed of three parts: the good events formula,
the bad or total events formula, and the underlying queries.
Exactly one of total_events_formula or bad_events_formula must be provided.
Option 1
object
SLO count definition using a total events formula alongside a good events formula.
good_events_formula [required]
object
A formula that specifies how to combine the results of multiple queries.
formula [required]
string
The formula string, which is an expression involving named queries.
queries [required]
[ <oneOf>]
Option 1
object
A formula and functions metrics query.
aggregator
enum
The aggregation methods available for metrics queries.
Allowed enum values: avg,min,max,sum,last,area,l2norm,percentile
cross_org_uuids
[string]
The source organization UUID for cross organization queries. Feature in Private Beta.
data_source [required]
enum
Data source for metrics queries.
Allowed enum values: metrics
name [required]
string
Name of the query for use in formulas.
query [required]
string
Metrics query definition.
semantic_mode
enum
Semantic mode for metrics queries. This determines how metrics from different sources are combined or displayed.
Allowed enum values: combined,native
total_events_formula [required]
object
The total events formula. Bad events queries can be defined using the bad_events_formula field as an alternative. Only one of total_events_formula or bad_events_formula must be provided.
formula [required]
string
The formula string, which is an expression involving named queries.
Option 2
object
SLO count definition using a bad events formula alongside a good events formula.
bad_events_formula [required]
object
The bad events formula (recommended). Total events queries can be defined using the total_events_formula field as an alternative. Only one of total_events_formula or bad_events_formula must be provided.
formula [required]
string
The formula string, which is an expression involving named queries.
good_events_formula [required]
object
A formula that specifies how to combine the results of multiple queries.
formula [required]
string
The formula string, which is an expression involving named queries.
queries [required]
[ <oneOf>]
Option 1
object
A formula and functions metrics query.
aggregator
enum
The aggregation methods available for metrics queries.
Allowed enum values: avg,min,max,sum,last,area,l2norm,percentile
cross_org_uuids
[string]
The source organization UUID for cross organization queries. Feature in Private Beta.
data_source [required]
enum
Data source for metrics queries.
Allowed enum values: metrics
name [required]
string
Name of the query for use in formulas.
query [required]
string
Metrics query definition.
semantic_mode
enum
Semantic mode for metrics queries. This determines how metrics from different sources are combined or displayed.
Allowed enum values: combined,native
tags
[string]
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
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 [required]
[object]
The thresholds (timeframes and associated targets) for this service level
objective object.
target [required]
double
The target value for the service level indicator within the corresponding
timeframe.
target_display
string
A string representation of the target that indicates its precision.
It uses trailing zeros to show significant decimal places (for example 98.00).
Always included in service level objective responses. Ignored in
create/update requests.
timeframe [required]
enum
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.
Allowed enum values: 7d,30d,90d,custom
warning
double
The warning value for the service level objective.
warning_display
string
A string representation of the warning target (see the description of
the target_display field for details).
Included in service level objective responses if a warning target exists.
Ignored in create/update requests.
timeframe
enum
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.
Allowed enum values: 7d,30d,90d,custom
type [required]
enum
The type of the service level objective.
Allowed enum values: metric,monitor,time_slice
warning_threshold
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.
errors
[string]
An array of error messages. Each endpoint documents how/whether this field is
used.
metadata
object
The metadata object containing additional information about the list of SLOs.
page
object
The object containing information about the pages of the list of SLOs.
total_count
int64
The total number of resources that could be retrieved ignoring the parameters and filters in the request.
total_filtered_count
int64
The total number of resources that match the parameters and filters in the request. This attribute can be used by a client to determine the total number of pages.
// Update an SLO returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){// there is a valid "slo" in the systemSloData0ID:=os.Getenv("SLO_DATA_0_ID")SloData0Name:=os.Getenv("SLO_DATA_0_NAME")body:=datadogV1.ServiceLevelObjective{Type:datadogV1.SLOTYPE_METRIC,Name:SloData0Name,Thresholds:[]datadogV1.SLOThreshold{{Target:97.0,Timeframe:datadogV1.SLOTIMEFRAME_SEVEN_DAYS,Warning:datadog.PtrFloat64(98.0),},},Timeframe:datadogV1.SLOTIMEFRAME_SEVEN_DAYS.Ptr(),TargetThreshold:datadog.PtrFloat64(97.0),WarningThreshold:datadog.PtrFloat64(98),Query:&datadogV1.ServiceLevelObjectiveQuery{Numerator:"sum:httpservice.hits{code:2xx}.as_count()",Denominator:"sum:httpservice.hits{!code:3xx}.as_count()",},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewServiceLevelObjectivesApi(apiClient)resp,r,err:=api.UpdateSLO(ctx,SloData0ID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceLevelObjectivesApi.UpdateSLO`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceLevelObjectivesApi.UpdateSLO`:\n%s\n",responseContent)}
// Update an SLO returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.ServiceLevelObjectivesApi;importcom.datadog.api.client.v1.model.SLOListResponse;importcom.datadog.api.client.v1.model.SLOThreshold;importcom.datadog.api.client.v1.model.SLOTimeframe;importcom.datadog.api.client.v1.model.SLOType;importcom.datadog.api.client.v1.model.ServiceLevelObjective;importcom.datadog.api.client.v1.model.ServiceLevelObjectiveQuery;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();ServiceLevelObjectivesApiapiInstance=newServiceLevelObjectivesApi(defaultClient);// there is a valid "slo" in the systemStringSLO_DATA_0_ID=System.getenv("SLO_DATA_0_ID");StringSLO_DATA_0_NAME=System.getenv("SLO_DATA_0_NAME");ServiceLevelObjectivebody=newServiceLevelObjective().type(SLOType.METRIC).name(SLO_DATA_0_NAME).thresholds(Collections.singletonList(newSLOThreshold().target(97.0).timeframe(SLOTimeframe.SEVEN_DAYS).warning(98.0))).timeframe(SLOTimeframe.SEVEN_DAYS).targetThreshold(97.0).warningThreshold(98.0).query(newServiceLevelObjectiveQuery().numerator("sum:httpservice.hits{code:2xx}.as_count()").denominator("sum:httpservice.hits{!code:3xx}.as_count()"));try{SLOListResponseresult=apiInstance.updateSLO(SLO_DATA_0_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceLevelObjectivesApi#updateSLO");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update an SLO returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.service_level_objectives_apiimportServiceLevelObjectivesApifromdatadog_api_client.v1.model.service_level_objectiveimportServiceLevelObjectivefromdatadog_api_client.v1.model.service_level_objective_queryimportServiceLevelObjectiveQueryfromdatadog_api_client.v1.model.slo_thresholdimportSLOThresholdfromdatadog_api_client.v1.model.slo_timeframeimportSLOTimeframefromdatadog_api_client.v1.model.slo_typeimportSLOType# there is a valid "slo" in the systemSLO_DATA_0_ID=environ["SLO_DATA_0_ID"]SLO_DATA_0_NAME=environ["SLO_DATA_0_NAME"]body=ServiceLevelObjective(type=SLOType.METRIC,name=SLO_DATA_0_NAME,thresholds=[SLOThreshold(target=97.0,timeframe=SLOTimeframe.SEVEN_DAYS,warning=98.0,),],timeframe=SLOTimeframe.SEVEN_DAYS,target_threshold=97.0,warning_threshold=98.0,query=ServiceLevelObjectiveQuery(numerator="sum:httpservice.hits{code:2xx}.as_count()",denominator="sum:httpservice.hits{!code:3xx}.as_count()",),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=ServiceLevelObjectivesApi(api_client)response=api_instance.update_slo(slo_id=SLO_DATA_0_ID,body=body)print(response)
# Update an SLO returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::ServiceLevelObjectivesAPI.new# there is a valid "slo" in the systemSLO_DATA_0_ID=ENV["SLO_DATA_0_ID"]SLO_DATA_0_NAME=ENV["SLO_DATA_0_NAME"]body=DatadogAPIClient::V1::ServiceLevelObjective.new({type:DatadogAPIClient::V1::SLOType::METRIC,name:SLO_DATA_0_NAME,thresholds:[DatadogAPIClient::V1::SLOThreshold.new({target:97.0,timeframe:DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,warning:98.0,}),],timeframe:DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,target_threshold:97.0,warning_threshold:98,query:DatadogAPIClient::V1::ServiceLevelObjectiveQuery.new({numerator:"sum:httpservice.hits{code:2xx}.as_count()",denominator:"sum:httpservice.hits{!code:3xx}.as_count()",}),})papi_instance.update_slo(SLO_DATA_0_ID,body)
// Update an SLO returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_service_level_objectives::ServiceLevelObjectivesAPI;usedatadog_api_client::datadogV1::model::SLOThreshold;usedatadog_api_client::datadogV1::model::SLOTimeframe;usedatadog_api_client::datadogV1::model::SLOType;usedatadog_api_client::datadogV1::model::ServiceLevelObjective;usedatadog_api_client::datadogV1::model::ServiceLevelObjectiveQuery;#[tokio::main]asyncfnmain(){// there is a valid "slo" in the system
letslo_data_0_id=std::env::var("SLO_DATA_0_ID").unwrap();letslo_data_0_name=std::env::var("SLO_DATA_0_NAME").unwrap();letbody=ServiceLevelObjective::new(slo_data_0_name.clone(),vec![SLOThreshold::new(97.0,SLOTimeframe::SEVEN_DAYS).warning(98.0asf64)],SLOType::METRIC,).query(ServiceLevelObjectiveQuery::new("sum:httpservice.hits{!code:3xx}.as_count()".to_string(),"sum:httpservice.hits{code:2xx}.as_count()".to_string(),)).target_threshold(97.0asf64).timeframe(SLOTimeframe::SEVEN_DAYS).warning_threshold(98.0asf64);letconfiguration=datadog::Configuration::new();letapi=ServiceLevelObjectivesAPI::with_config(configuration);letresp=api.update_slo(slo_data_0_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update an SLO returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.ServiceLevelObjectivesApi(configuration);// there is a valid "slo" in the system
constSLO_DATA_0_ID=process.env.SLO_DATA_0_IDasstring;constSLO_DATA_0_NAME=process.env.SLO_DATA_0_NAMEasstring;constparams: v1.ServiceLevelObjectivesApiUpdateSLORequest={body:{type:"metric",name: SLO_DATA_0_NAME,thresholds:[{target: 97.0,timeframe:"7d",warning: 98.0,},],timeframe:"7d",targetThreshold: 97.0,warningThreshold: 98,query:{numerator:"sum:httpservice.hits{code:2xx}.as_count()",denominator:"sum:httpservice.hits{!code:3xx}.as_count()",},},sloId: SLO_DATA_0_ID,};apiInstance.updateSLO(params).then((data: v1.SLOListResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));