DescribeDimensionKeys - Amazon RDS Performance Insights

DescribeDimensionKeys

For a specific time period, retrieve the top N dimension keys for a metric.

Note

Each response element returns a maximum of 500 bytes. For larger elements, such as SQL statements, only the first 500 bytes are returned.

Request Syntax

{ "AdditionalMetrics": [ "string" ], "EndTime": number, "Filter": { "string" : "string" }, "GroupBy": { "Dimensions": [ "string" ], "Group": "string", "Limit": number }, "Identifier": "string", "MaxResults": number, "Metric": "string", "NextToken": "string", "PartitionBy": { "Dimensions": [ "string" ], "Group": "string", "Limit": number }, "PeriodInSeconds": number, "ServiceType": "string", "StartTime": number }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

EndTime

The date and time specifying the end of the requested time series data. The value specified is exclusive, which means that data points less than (but not equal to) EndTime are returned.

The value for EndTime must be later than the value for StartTime.

Type: Timestamp

Required: Yes

GroupBy

A specification for how to aggregate the data points from a query result. You must specify a valid dimension group. Performance Insights returns all dimensions within this group, unless you provide the names of specific dimensions within this group. You can also request that Performance Insights return a limited number of values for a dimension.

Type: DimensionGroup object

Required: Yes

Identifier

An immutable, AWS Region-unique identifier for a data source. Performance Insights gathers metrics from this data source.

To use an Amazon RDS instance as a data source, you specify its DbiResourceId value. For example, specify db-FAIHNTYBKTGAUSUZQYPDS2GW4A.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 256.

Pattern: ^[a-zA-Z0-9-]+$

Required: Yes

Metric

The name of a Performance Insights metric to be measured.

Valid values for Metric are:

  • db.load.avg - A scaled representation of the number of active sessions for the database engine.

  • db.sampledload.avg - The raw number of active sessions for the database engine.

If the number of active sessions is less than an internal Performance Insights threshold, db.load.avg and db.sampledload.avg are the same value. If the number of active sessions is greater than the internal threshold, Performance Insights samples the active sessions, with db.load.avg showing the scaled values, db.sampledload.avg showing the raw values, and db.sampledload.avg less than db.load.avg. For most use cases, you can query db.load.avg only.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 256.

Pattern: .*\S.*

Required: Yes

ServiceType

The AWS service for which Performance Insights will return metrics. Valid values are as follows:

  • RDS

  • DOCDB

Type: String

Valid Values: RDS | DOCDB

Required: Yes

StartTime

The date and time specifying the beginning of the requested time series data. You must specify a StartTime within the past 7 days. The value specified is inclusive, which means that data points equal to or greater than StartTime are returned.

The value for StartTime must be earlier than the value for EndTime.

Type: Timestamp

Required: Yes

AdditionalMetrics

Additional metrics for the top N dimension keys. If the specified dimension group in the GroupBy parameter is db.sql_tokenized, you can specify per-SQL metrics to get the values for the top N SQL digests. The response syntax is as follows: "AdditionalMetrics" : { "string" : "string" }.

Type: Array of strings

Array Members: Minimum number of 1 item. Maximum number of 30 items.

Length Constraints: Minimum length of 0. Maximum length of 256.

Pattern: .*\S.*

Required: No

Filter

One or more filters to apply in the request. Restrictions:

  • Any number of filters by the same dimension, as specified in the GroupBy or Partition parameters.

  • A single filter for any other dimension in this dimension group.

Type: String to string map

Key Length Constraints: Minimum length of 0. Maximum length of 256.

Key Pattern: .*\S.*

Value Length Constraints: Minimum length of 0. Maximum length of 256.

Value Pattern: .*\S.*

Required: No

MaxResults

The maximum number of items to return in the response. If more items exist than the specified MaxRecords value, a pagination token is included in the response so that the remaining results can be retrieved.

Type: Integer

Valid Range: Minimum value of 0. Maximum value of 25.

Required: No

NextToken

An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the token, up to the value specified by MaxRecords.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 8192.

Pattern: ^[a-zA-Z0-9_=-]+$

Required: No

PartitionBy

For each dimension specified in GroupBy, specify a secondary dimension to further subdivide the partition keys in the response.

Type: DimensionGroup object

Required: No

PeriodInSeconds

The granularity, in seconds, of the data points returned from Performance Insights. A period can be as short as one second, or as long as one day (86400 seconds). Valid values are:

  • 1 (one second)

  • 60 (one minute)

  • 300 (five minutes)

  • 3600 (one hour)

  • 86400 (twenty-four hours)

If you don't specify PeriodInSeconds, then Performance Insights chooses a value for you, with a goal of returning roughly 100-200 data points in the response.

Type: Integer

Required: No

Response Syntax

{ "AlignedEndTime": number, "AlignedStartTime": number, "Keys": [ { "AdditionalMetrics": { "string" : number }, "Dimensions": { "string" : "string" }, "Partitions": [ number ], "Total": number } ], "NextToken": "string", "PartitionKeys": [ { "Dimensions": { "string" : "string" } } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

AlignedEndTime

The end time for the returned dimension keys, after alignment to a granular boundary (as specified by PeriodInSeconds). AlignedEndTime will be greater than or equal to the value of the user-specified Endtime.

Type: Timestamp

AlignedStartTime

The start time for the returned dimension keys, after alignment to a granular boundary (as specified by PeriodInSeconds). AlignedStartTime will be less than or equal to the value of the user-specified StartTime.

Type: Timestamp

Keys

The dimension keys that were requested.

Type: Array of DimensionKeyDescription objects

NextToken

A pagination token that indicates the response didn’t return all available records because MaxRecords was specified in the previous request. To get the remaining records, specify NextToken in a separate request with this value.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 8192.

Pattern: ^[a-zA-Z0-9_=-]+$

PartitionKeys

If PartitionBy was present in the request, PartitionKeys contains the breakdown of dimension keys by the specified partitions.

Type: Array of ResponsePartitionKey objects

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServiceError

The request failed due to an unknown error.

HTTP Status Code: 500

InvalidArgumentException

One of the arguments provided is invalid for this request.

HTTP Status Code: 400

NotAuthorizedException

The user is not authorized to perform this request.

HTTP Status Code: 400

Examples

Retrieve top dimension keys

The following example retrieves the top 10 dimension keys for metrics db.load.avg, db.sql_tokenized.stats.calls_per_sec.avg, and db.sql_tokenized.statement over a specific 5-minute time range. The request returns the metrics in dimension groups db.sql_tokenized.id and db.sql_tokenized.statement. For both of these dimension groups, the request subdivides the partition keys by db.user.id and db.user.name.

Sample Request

POST / HTTP/1.1 Host: <Hostname> Accept-Encoding: identity X-Amz-Target: PerformanceInsightsv20180227.DescribeDimensionKeys Content-Type: application/x-amz-json-1.1 User-Agent: <UserAgentString> X-Amz-Date: <Date> Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=<Headers>, Signature=<Signature> Content-Length: <PayloadSizeBytes> { "ServiceType": "RDS", "Identifier": "db-ABC1DEFGHIJKL2MNOPQRSTUV3W", "StartTime": 1603915200, "EndTime": 1603918800, "PeriodInSeconds": 300, "Metric": "db.load.avg", "GroupBy": { "Dimensions": [ "db.sql_tokenized.id", "db.sql_tokenized.statement" ], "Group": "db.sql_tokenized", "Limit": 5 }, "Filter": { "db.user.name" : "example-user" }, "PartitionBy": { "Dimensions": [ "db.user.id", "db.user.name" ], "Group": "db.user", "Limit": 5 }, "MaxResults": 10, "AdditionalMetrics": [ "db.sql_tokenized.stats.calls_per_sec.avg", "db.sql_tokenized.stats.rows_per_sec.avg" ] }

Sample Response

HTTP/1.1 200 OK Content-Type: application/x-amz-json-1.1 Date: <Date> x-amzn-RequestId: <RequestId> Content-Length: <PayloadSizeBytes> Connection: keep-alive { "AlignedEndTime": 1.6244895E9, "AlignedStartTime": 1.6244889E9, "Keys": [ { "Dimensions": { "db.sql_tokenized.id" : "12A345BCDE67F8G9H012I3IJKI4J5675K8L912M", "db.sql_tokenized.statement" : "INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP);" }, "Partitions": [ 2.1333333333333333 ], "Total": 2.1333333333333333, "AdditionalMetrics" : { "db.sql_tokenized.stats.calls_per_sec.avg": 1.0, "db.sql_tokenized.stats.rows_per_sec.avg": 3.0 } }, ...... ], "PartitionKeys": [ { "Dimensions": { "db.user.name": "example-user", "db.user.id": "A12B3456C7D8E890F123F45G67HIJ8K9LM0N1O2" } } ] } }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: