Class CfnServiceLevelObjective
- All Implemented Interfaces:
IInspectable
,ITaggableV2
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
Use SLOs to set and track specific target levels for the reliability and availability of your applications and services. SLOs use service level indicators (SLIs) to calculate whether the application is performing at the level that you want.
Create an SLO to set a target for a service or operation’s availability or latency. CloudWatch measures this target frequently you can find whether it has been breached.
The target performance quality that is defined for an SLO is the attainment goal . An attainment goal is the percentage of time or requests that the SLI is expected to meet the threshold over each time interval. For example, an attainment goal of 99.9% means that within your interval, you are targeting 99.9% of the periods to be in healthy state.
When you create an SLO, you specify whether it is a period-based SLO or a request-based SLO . Each type of SLO has a different way of evaluating your application's performance against its attainment goal.
- A period-based SLO uses defined periods of time within a specified total time interval. For each period of time, Application Signals determines whether the application met its goal. The attainment rate is calculated as the
number of good periods/number of total periods
.
For example, for a period-based SLO, meeting an attainment goal of 99.9% means that within your interval, your application must meet its performance goal during at least 99.9% of the time periods.
- A request-based SLO doesn't use pre-defined periods of time. Instead, the SLO measures
number of good requests/number of total requests
during the interval. At any time, you can find the ratio of good requests to total requests for the interval up to the time stamp that you specify, and measure that ratio against the goal set in your SLO.
After you have created an SLO, you can retrieve error budget reports for it. An error budget is the amount of time or amount of requests that your application can be non-compliant with the SLO's goal, and still have your application meet the goal.
- For a period-based SLO, the error budget starts at a number defined by the highest number of periods that can fail to meet the threshold, while still meeting the overall goal. The remaining error budget decreases with every failed period that is recorded. The error budget within one interval can never increase.
For example, an SLO with a threshold that 99.95% of requests must be completed under 2000ms every month translates to an error budget of 21.9 minutes of downtime per month.
- For a request-based SLO, the remaining error budget is dynamic and can increase or decrease, depending on the ratio of good requests to total requests.
When you call this operation, Application Signals creates the AWSServiceRoleForCloudWatchApplicationSignals service-linked role, if it doesn't already exist in your account. This service- linked role has the following permissions:
xray:GetServiceGraph
logs:StartQuery
logs:GetQueryResults
cloudwatch:GetMetricData
cloudwatch:ListMetrics
tag:GetResources
autoscaling:DescribeAutoScalingGroups
You can easily set SLO targets for your applications that are discovered by Application Signals, using critical metrics such as latency and availability. You can also set SLOs against any CloudWatch metric or math expression that produces a time series.
You cannot change from a period-based SLO to a request-based SLO, or change from a request-based SLO to a period-based SLO.
For more information about SLOs, see Service level objectives (SLOs) .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.applicationsignals.*; CfnServiceLevelObjective cfnServiceLevelObjective = CfnServiceLevelObjective.Builder.create(this, "MyCfnServiceLevelObjective") .name("name") // the properties below are optional .description("description") .goal(GoalProperty.builder() .attainmentGoal(123) .interval(IntervalProperty.builder() .calendarInterval(CalendarIntervalProperty.builder() .duration(123) .durationUnit("durationUnit") .startTime(123) .build()) .rollingInterval(RollingIntervalProperty.builder() .duration(123) .durationUnit("durationUnit") .build()) .build()) .warningThreshold(123) .build()) .requestBasedSli(RequestBasedSliProperty.builder() .requestBasedSliMetric(RequestBasedSliMetricProperty.builder() .keyAttributes(Map.of( "keyAttributesKey", "keyAttributes")) .metricType("metricType") .monitoredRequestCountMetric(MonitoredRequestCountMetricProperty.builder() .badCountMetric(List.of(MetricDataQueryProperty.builder() .id("id") // the properties below are optional .accountId("accountId") .expression("expression") .metricStat(MetricStatProperty.builder() .metric(MetricProperty.builder() .dimensions(List.of(DimensionProperty.builder() .name("name") .value("value") .build())) .metricName("metricName") .namespace("namespace") .build()) .period(123) .stat("stat") // the properties below are optional .unit("unit") .build()) .returnData(false) .build())) .goodCountMetric(List.of(MetricDataQueryProperty.builder() .id("id") // the properties below are optional .accountId("accountId") .expression("expression") .metricStat(MetricStatProperty.builder() .metric(MetricProperty.builder() .dimensions(List.of(DimensionProperty.builder() .name("name") .value("value") .build())) .metricName("metricName") .namespace("namespace") .build()) .period(123) .stat("stat") // the properties below are optional .unit("unit") .build()) .returnData(false) .build())) .build()) .operationName("operationName") .totalRequestCountMetric(List.of(MetricDataQueryProperty.builder() .id("id") // the properties below are optional .accountId("accountId") .expression("expression") .metricStat(MetricStatProperty.builder() .metric(MetricProperty.builder() .dimensions(List.of(DimensionProperty.builder() .name("name") .value("value") .build())) .metricName("metricName") .namespace("namespace") .build()) .period(123) .stat("stat") // the properties below are optional .unit("unit") .build()) .returnData(false) .build())) .build()) // the properties below are optional .comparisonOperator("comparisonOperator") .metricThreshold(123) .build()) .sli(SliProperty.builder() .comparisonOperator("comparisonOperator") .metricThreshold(123) .sliMetric(SliMetricProperty.builder() .keyAttributes(Map.of( "keyAttributesKey", "keyAttributes")) .metricDataQueries(List.of(MetricDataQueryProperty.builder() .id("id") // the properties below are optional .accountId("accountId") .expression("expression") .metricStat(MetricStatProperty.builder() .metric(MetricProperty.builder() .dimensions(List.of(DimensionProperty.builder() .name("name") .value("value") .build())) .metricName("metricName") .namespace("namespace") .build()) .period(123) .stat("stat") // the properties below are optional .unit("unit") .build()) .returnData(false) .build())) .metricType("metricType") .operationName("operationName") .periodSeconds(123) .statistic("statistic") .build()) .build()) .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .build();
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A fluent builder forCfnServiceLevelObjective
.static interface
If the interval for this service level objective is a calendar interval, this structure contains the interval specifications.static interface
A dimension is a name/value pair that is part of the identity of a metric.static interface
This structure contains the attributes that determine the goal of an SLO.static interface
The time period used to evaluate the SLO.static interface
Use this structure to define a metric or metric math expression that you want to use as for a service level objective.static interface
This structure defines the metric used for a service level indicator, including the metric name, namespace, and dimensions.static interface
This structure defines the metric to be used as the service level indicator, along with the statistics, period, and unit.static interface
This structure defines the metric that is used as the "good request" or "bad request" value for a request-based SLO.static interface
This structure contains the information about the metric that is used for a request-based SLO.static interface
This structure contains information about the performance metric that a request-based SLO monitors.static interface
If the interval for this SLO is a rolling interval, this structure contains the interval specifications.static interface
Use this structure to specify the metric to be used for the SLO.static interface
This structure specifies the information about the service and the performance metric that an SLO is to monitor.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnServiceLevelObjective
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnServiceLevelObjective
(software.amazon.jsii.JsiiObjectRef objRef) CfnServiceLevelObjective
(software.constructs.Construct scope, String id, CfnServiceLevelObjectiveProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe ARN of this SLO.The date and time that this SLO was created.Displays whether this is a period-based SLO or a request-based SLO.The time that this SLO was most recently updated.Tag Manager which manages the tags for this resource.An optional description for this SLO.getGoal()
This structure contains the attributes that determine the goal of an SLO.getName()
A name for this SLO.A structure containing information about the performance metric that this SLO monitors, if this is a request-based SLO.getSli()
A structure containing information about the performance metric that this SLO monitors, if this is a period-based SLO.getTags()
A list of key-value pairs to associate with the SLO.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setDescription
(String value) An optional description for this SLO.void
setGoal
(IResolvable value) This structure contains the attributes that determine the goal of an SLO.void
This structure contains the attributes that determine the goal of an SLO.void
A name for this SLO.void
setRequestBasedSli
(IResolvable value) A structure containing information about the performance metric that this SLO monitors, if this is a request-based SLO.void
A structure containing information about the performance metric that this SLO monitors, if this is a request-based SLO.void
setSli
(IResolvable value) A structure containing information about the performance metric that this SLO monitors, if this is a period-based SLO.void
A structure containing information about the performance metric that this SLO monitors, if this is a period-based SLO.void
A list of key-value pairs to associate with the SLO.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnServiceLevelObjective
protected CfnServiceLevelObjective(software.amazon.jsii.JsiiObjectRef objRef) -
CfnServiceLevelObjective
protected CfnServiceLevelObjective(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnServiceLevelObjective
@Stability(Stable) public CfnServiceLevelObjective(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnServiceLevelObjectiveProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrArn
The ARN of this SLO. -
getAttrCreatedTime
The date and time that this SLO was created. -
getAttrEvaluationType
Displays whether this is a period-based SLO or a request-based SLO. -
getAttrLastUpdatedTime
The time that this SLO was most recently updated. -
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManager
in interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getName
A name for this SLO. -
setName
A name for this SLO. -
getDescription
An optional description for this SLO. -
setDescription
An optional description for this SLO. -
getGoal
This structure contains the attributes that determine the goal of an SLO. -
setGoal
This structure contains the attributes that determine the goal of an SLO. -
setGoal
This structure contains the attributes that determine the goal of an SLO. -
getRequestBasedSli
A structure containing information about the performance metric that this SLO monitors, if this is a request-based SLO. -
setRequestBasedSli
A structure containing information about the performance metric that this SLO monitors, if this is a request-based SLO. -
setRequestBasedSli
@Stability(Stable) public void setRequestBasedSli(@Nullable CfnServiceLevelObjective.RequestBasedSliProperty value) A structure containing information about the performance metric that this SLO monitors, if this is a request-based SLO. -
getSli
A structure containing information about the performance metric that this SLO monitors, if this is a period-based SLO. -
setSli
A structure containing information about the performance metric that this SLO monitors, if this is a period-based SLO. -
setSli
A structure containing information about the performance metric that this SLO monitors, if this is a period-based SLO. -
getTags
A list of key-value pairs to associate with the SLO. -
setTags
A list of key-value pairs to associate with the SLO.
-