# RequestBasedSliMetricProperty

This structure contains the information about the metric that is used for a request-based SLO.

- Source: Generated at build time
- Type last changed: v2.258.0 · 4 Jun 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_applicationsignals as applicationsignals } from 'aws-cdk-lib';
const requestBasedSliMetricProperty: applicationsignals.CfnServiceLevelObjective.RequestBasedSliMetricProperty = {
  compositeSliConfig: {
    selectionConfig: {
      type: 'type',

      // the properties below are optional
      pattern: 'pattern',
    },

    // the properties below are optional
    compositeSliComponents: [{
      operationName: 'operationName',
    }],
  },
  dependencyConfig: {
    dependencyKeyAttributes: {
      dependencyKeyAttributesKey: 'dependencyKeyAttributes',
    },
    dependencyOperationName: 'dependencyOperationName',
  },
  keyAttributes: {
    keyAttributesKey: 'keyAttributes',
  },
  metricName: 'metricName',
  metricSource: {
    metricSourceKeyAttributes: {
      metricSourceKeyAttributesKey: 'metricSourceKeyAttributes',
    },

    // the properties below are optional
    metricSourceAttributes: {
      metricSourceAttributesKey: 'metricSourceAttributes',
    },
  },
  metricType: 'metricType',
  monitoredRequestCountMetric: {
    badCountMetric: [{
      id: 'id',

      // the properties below are optional
      accountId: 'accountId',
      expression: 'expression',
      metricStat: {
        metric: {
          dimensions: [{
            name: 'name',
            value: 'value',
          }],
          metricName: 'metricName',
          namespace: 'namespace',
        },
        period: 123,
        stat: 'stat',

        // the properties below are optional
        unit: 'unit',
      },
      returnData: false,
    }],
    goodCountMetric: [{
      id: 'id',

      // the properties below are optional
      accountId: 'accountId',
      expression: 'expression',
      metricStat: {
        metric: {
          dimensions: [{
            name: 'name',
            value: 'value',
          }],
          metricName: 'metricName',
          namespace: 'namespace',
        },
        period: 123,
        stat: 'stat',

        // the properties below are optional
        unit: 'unit',
      },
      returnData: false,
    }],
  },
  operationName: 'operationName',
  totalRequestCountMetric: [{
    id: 'id',

    // the properties below are optional
    accountId: 'accountId',
    expression: 'expression',
    metricStat: {
      metric: {
        dimensions: [{
          name: 'name',
          value: 'value',
        }],
        metricName: 'metricName',
        namespace: 'namespace',
      },
      period: 123,
      stat: 'stat',

      // the properties below are optional
      unit: 'unit',
    },
    returnData: false,
  }],
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_applicationsignals as applicationsignals

request_based_sli_metric_property = applicationsignals.CfnServiceLevelObjective.RequestBasedSliMetricProperty(
    composite_sli_config=applicationsignals.CfnServiceLevelObjective.CompositeSliConfigProperty(
        selection_config=applicationsignals.CfnServiceLevelObjective.SelectionConfigProperty(
            type="type",

            # the properties below are optional
            pattern="pattern"
        ),

        # the properties below are optional
        composite_sli_components=[applicationsignals.CfnServiceLevelObjective.CompositeSliComponentProperty(
            operation_name="operationName"
        )]
    ),
    dependency_config=applicationsignals.CfnServiceLevelObjective.DependencyConfigProperty(
        dependency_key_attributes={
            "dependency_key_attributes_key": "dependencyKeyAttributes"
        },
        dependency_operation_name="dependencyOperationName"
    ),
    key_attributes={
        "key_attributes_key": "keyAttributes"
    },
    metric_name="metricName",
    metric_source=applicationsignals.CfnServiceLevelObjective.MetricSourceProperty(
        metric_source_key_attributes={
            "metric_source_key_attributes_key": "metricSourceKeyAttributes"
        },

        # the properties below are optional
        metric_source_attributes={
            "metric_source_attributes_key": "metricSourceAttributes"
        }
    ),
    metric_type="metricType",
    monitored_request_count_metric=applicationsignals.CfnServiceLevelObjective.MonitoredRequestCountMetricProperty(
        bad_count_metric=[applicationsignals.CfnServiceLevelObjective.MetricDataQueryProperty(
            id="id",

            # the properties below are optional
            account_id="accountId",
            expression="expression",
            metric_stat=applicationsignals.CfnServiceLevelObjective.MetricStatProperty(
                metric=applicationsignals.CfnServiceLevelObjective.MetricProperty(
                    dimensions=[applicationsignals.CfnServiceLevelObjective.DimensionProperty(
                        name="name",
                        value="value"
                    )],
                    metric_name="metricName",
                    namespace="namespace"
                ),
                period=123,
                stat="stat",

                # the properties below are optional
                unit="unit"
            ),
            return_data=False
        )],
        good_count_metric=[applicationsignals.CfnServiceLevelObjective.MetricDataQueryProperty(
            id="id",

            # the properties below are optional
            account_id="accountId",
            expression="expression",
            metric_stat=applicationsignals.CfnServiceLevelObjective.MetricStatProperty(
                metric=applicationsignals.CfnServiceLevelObjective.MetricProperty(
                    dimensions=[applicationsignals.CfnServiceLevelObjective.DimensionProperty(
                        name="name",
                        value="value"
                    )],
                    metric_name="metricName",
                    namespace="namespace"
                ),
                period=123,
                stat="stat",

                # the properties below are optional
                unit="unit"
            ),
            return_data=False
        )]
    ),
    operation_name="operationName",
    total_request_count_metric=[applicationsignals.CfnServiceLevelObjective.MetricDataQueryProperty(
        id="id",

        # the properties below are optional
        account_id="accountId",
        expression="expression",
        metric_stat=applicationsignals.CfnServiceLevelObjective.MetricStatProperty(
            metric=applicationsignals.CfnServiceLevelObjective.MetricProperty(
                dimensions=[applicationsignals.CfnServiceLevelObjective.DimensionProperty(
                    name="name",
                    value="value"
                )],
                metric_name="metricName",
                namespace="namespace"
            ),
            period=123,
            stat="stat",

            # the properties below are optional
            unit="unit"
        ),
        return_data=False
    )]
)
```

Java:

```java
// 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.*;

RequestBasedSliMetricProperty requestBasedSliMetricProperty = RequestBasedSliMetricProperty.builder()
        .compositeSliConfig(CompositeSliConfigProperty.builder()
                .selectionConfig(SelectionConfigProperty.builder()
                        .type("type")

                        // the properties below are optional
                        .pattern("pattern")
                        .build())

                // the properties below are optional
                .compositeSliComponents(List.of(CompositeSliComponentProperty.builder()
                        .operationName("operationName")
                        .build()))
                .build())
        .dependencyConfig(DependencyConfigProperty.builder()
                .dependencyKeyAttributes(Map.of(
                        "dependencyKeyAttributesKey", "dependencyKeyAttributes"))
                .dependencyOperationName("dependencyOperationName")
                .build())
        .keyAttributes(Map.of(
                "keyAttributesKey", "keyAttributes"))
        .metricName("metricName")
        .metricSource(MetricSourceProperty.builder()
                .metricSourceKeyAttributes(Map.of(
                        "metricSourceKeyAttributesKey", "metricSourceKeyAttributes"))

                // the properties below are optional
                .metricSourceAttributes(Map.of(
                        "metricSourceAttributesKey", "metricSourceAttributes"))
                .build())
        .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();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ApplicationSignals;

var requestBasedSliMetricProperty = new RequestBasedSliMetricProperty {
    CompositeSliConfig = new CompositeSliConfigProperty {
        SelectionConfig = new SelectionConfigProperty {
            Type = "type",

            // the properties below are optional
            Pattern = "pattern"
        },

        // the properties below are optional
        CompositeSliComponents = new [] { new CompositeSliComponentProperty {
            OperationName = "operationName"
        } }
    },
    DependencyConfig = new DependencyConfigProperty {
        DependencyKeyAttributes = new Dictionary<string, string> {
            { "dependencyKeyAttributesKey", "dependencyKeyAttributes" }
        },
        DependencyOperationName = "dependencyOperationName"
    },
    KeyAttributes = new Dictionary<string, string> {
        { "keyAttributesKey", "keyAttributes" }
    },
    MetricName = "metricName",
    MetricSource = new MetricSourceProperty {
        MetricSourceKeyAttributes = new Dictionary<string, string> {
            { "metricSourceKeyAttributesKey", "metricSourceKeyAttributes" }
        },

        // the properties below are optional
        MetricSourceAttributes = new Dictionary<string, string> {
            { "metricSourceAttributesKey", "metricSourceAttributes" }
        }
    },
    MetricType = "metricType",
    MonitoredRequestCountMetric = new MonitoredRequestCountMetricProperty {
        BadCountMetric = new [] { new MetricDataQueryProperty {
            Id = "id",

            // the properties below are optional
            AccountId = "accountId",
            Expression = "expression",
            MetricStat = new MetricStatProperty {
                Metric = new MetricProperty {
                    Dimensions = new [] { new DimensionProperty {
                        Name = "name",
                        Value = "value"
                    } },
                    MetricName = "metricName",
                    Namespace = "namespace"
                },
                Period = 123,
                Stat = "stat",

                // the properties below are optional
                Unit = "unit"
            },
            ReturnData = false
        } },
        GoodCountMetric = new [] { new MetricDataQueryProperty {
            Id = "id",

            // the properties below are optional
            AccountId = "accountId",
            Expression = "expression",
            MetricStat = new MetricStatProperty {
                Metric = new MetricProperty {
                    Dimensions = new [] { new DimensionProperty {
                        Name = "name",
                        Value = "value"
                    } },
                    MetricName = "metricName",
                    Namespace = "namespace"
                },
                Period = 123,
                Stat = "stat",

                // the properties below are optional
                Unit = "unit"
            },
            ReturnData = false
        } }
    },
    OperationName = "operationName",
    TotalRequestCountMetric = new [] { new MetricDataQueryProperty {
        Id = "id",

        // the properties below are optional
        AccountId = "accountId",
        Expression = "expression",
        MetricStat = new MetricStatProperty {
            Metric = new MetricProperty {
                Dimensions = new [] { new DimensionProperty {
                    Name = "name",
                    Value = "value"
                } },
                MetricName = "metricName",
                Namespace = "namespace"
            },
            Period = 123,
            Stat = "stat",

            // the properties below are optional
            Unit = "unit"
        },
        ReturnData = false
    } }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

requestBasedSliMetricProperty := &RequestBasedSliMetricProperty{
	CompositeSliConfig: &CompositeSliConfigProperty{
		SelectionConfig: &SelectionConfigProperty{
			Type: jsii.String("type"),

			// the properties below are optional
			Pattern: jsii.String("pattern"),
		},

		// the properties below are optional
		CompositeSliComponents: []interface{}{
			&CompositeSliComponentProperty{
				OperationName: jsii.String("operationName"),
			},
		},
	},
	DependencyConfig: &DependencyConfigProperty{
		DependencyKeyAttributes: map[string]*string{
			"dependencyKeyAttributesKey": jsii.String("dependencyKeyAttributes"),
		},
		DependencyOperationName: jsii.String("dependencyOperationName"),
	},
	KeyAttributes: map[string]*string{
		"keyAttributesKey": jsii.String("keyAttributes"),
	},
	MetricName: jsii.String("metricName"),
	MetricSource: &MetricSourceProperty{
		MetricSourceKeyAttributes: map[string]*string{
			"metricSourceKeyAttributesKey": jsii.String("metricSourceKeyAttributes"),
		},

		// the properties below are optional
		MetricSourceAttributes: map[string]*string{
			"metricSourceAttributesKey": jsii.String("metricSourceAttributes"),
		},
	},
	MetricType: jsii.String("metricType"),
	MonitoredRequestCountMetric: &MonitoredRequestCountMetricProperty{
		BadCountMetric: []interface{}{
			&MetricDataQueryProperty{
				Id: jsii.String("id"),

				// the properties below are optional
				AccountId: jsii.String("accountId"),
				Expression: jsii.String("expression"),
				MetricStat: &MetricStatProperty{
					Metric: &MetricProperty{
						Dimensions: []interface{}{
							&DimensionProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
						MetricName: jsii.String("metricName"),
						Namespace: jsii.String("namespace"),
					},
					Period: jsii.Number(123),
					Stat: jsii.String("stat"),

					// the properties below are optional
					Unit: jsii.String("unit"),
				},
				ReturnData: jsii.Boolean(false),
			},
		},
		GoodCountMetric: []interface{}{
			&MetricDataQueryProperty{
				Id: jsii.String("id"),

				// the properties below are optional
				AccountId: jsii.String("accountId"),
				Expression: jsii.String("expression"),
				MetricStat: &MetricStatProperty{
					Metric: &MetricProperty{
						Dimensions: []interface{}{
							&DimensionProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
						MetricName: jsii.String("metricName"),
						Namespace: jsii.String("namespace"),
					},
					Period: jsii.Number(123),
					Stat: jsii.String("stat"),

					// the properties below are optional
					Unit: jsii.String("unit"),
				},
				ReturnData: jsii.Boolean(false),
			},
		},
	},
	OperationName: jsii.String("operationName"),
	TotalRequestCountMetric: []interface{}{
		&MetricDataQueryProperty{
			Id: jsii.String("id"),

			// the properties below are optional
			AccountId: jsii.String("accountId"),
			Expression: jsii.String("expression"),
			MetricStat: &MetricStatProperty{
				Metric: &MetricProperty{
					Dimensions: []interface{}{
						&DimensionProperty{
							Name: jsii.String("name"),
							Value: jsii.String("value"),
						},
					},
					MetricName: jsii.String("metricName"),
					Namespace: jsii.String("namespace"),
				},
				Period: jsii.Number(123),
				Stat: jsii.String("stat"),

				// the properties below are optional
				Unit: jsii.String("unit"),
			},
			ReturnData: jsii.Boolean(false),
		},
	},
}
```

## Properties

- `compositeSliConfig`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnServiceLevelObjective.CompositeSliConfigProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_applicationsignals.CfnServiceLevelObjective.CompositeSliConfigProperty.html)

- `dependencyConfig`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnServiceLevelObjective.DependencyConfigProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_applicationsignals.CfnServiceLevelObjective.DependencyConfigProperty.html) — Identifies the dependency using the `DependencyKeyAttributes` and `DependencyOperationName` .

- `keyAttributes`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | { [key: string]: string } — This is a string-to-string map that contains information about the type of object that this SLO is related to.

  It can include the following fields.

  - `Type` designates the type of object that this SLO is related to.
  - `ResourceType` specifies the type of the resource. This field is used only when the value of the `Type` field is `Resource` or `AWS::Resource` .
  - `Name` specifies the name of the object. This is used only if the value of the `Type` field is `Service` , `RemoteService` , or `AWS::Service` .
  - `Identifier` identifies the resource objects of this resource. This is used only if the value of the `Type` field is `Resource` or `AWS::Resource` .
  - `Environment` specifies the location where this object is hosted, or what it belongs to.
  - `AwsAccountId` allows you to create an SLO for an object that exists in another account.

- `metricName`: string — The name of the metric for non-Application Signals services.

- `metricSource`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnServiceLevelObjective.MetricSourceProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_applicationsignals.CfnServiceLevelObjective.MetricSourceProperty.html) — Configuration for identifying the source of metrics for non-Application Signals services.

- `metricType`: string — If the SLO monitors either the `LATENCY` or `AVAILABILITY` metric that Application Signals collects, this field displays which of those metrics is used.

- `monitoredRequestCountMetric`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnServiceLevelObjective.MonitoredRequestCountMetricProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_applicationsignals.CfnServiceLevelObjective.MonitoredRequestCountMetricProperty.html) — Use this structure to define the metric that you want to use as the "good request" or "bad request" value for a request-based SLO.

  This value observed for the metric defined in `TotalRequestCountMetric` will be divided by the number found for `MonitoredRequestCountMetric` to determine the percentage of successful requests that this SLO tracks.

- `operationName`: string — If the SLO monitors a specific operation of the service, this field displays that operation name.

- `totalRequestCountMetric`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnServiceLevelObjective.MetricDataQueryProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_applicationsignals.CfnServiceLevelObjective.MetricDataQueryProperty.html)[] — This structure defines the metric that is used as the "total requests" number for a request-based SLO.

  The number observed for this metric is divided by the number of "good requests" or "bad requests" that is observed for the metric defined in `MonitoredRequestCountMetric` .
