ListAvailableResourceMetrics
Retrieve metrics of the specified types that can be queried for a specified DB instance.
Request Syntax
{
"Identifier": "string
",
"MaxResults": number
,
"MetricTypes": [ "string
" ],
"NextToken": "string
",
"ServiceType": "string
"
}
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.
- Identifier
-
An immutable identifier for a data source that is unique within an AWS Region. Performance Insights gathers metrics from this data source. To use an Amazon RDS DB instance as a data source, specify its
DbiResourceId
value. For example, specifydb-ABCDEFGHIJKLMNOPQRSTU1VWZ
.Type: String
Length Constraints: Minimum length of 0. Maximum length of 256.
Pattern:
^[a-zA-Z0-9-]+$
Required: Yes
- MetricTypes
-
The types of metrics to return in the response. Valid values in the array include the following:
-
os
(OS counter metrics) - All engines -
db
(DB load metrics) - All engines except for Amazon DocumentDB -
db.sql.stats
(per-SQL metrics) - All engines except for Amazon DocumentDB -
db.sql_tokenized.stats
(per-SQL digest metrics) - All engines except for Amazon DocumentDB
Type: Array of strings
Length Constraints: Minimum length of 0. Maximum length of 256.
Pattern:
^[a-zA-Z0-9-_\.:/*)( ]+$
Required: Yes
-
- ServiceType
-
The AWS service for which Performance Insights returns metrics.
Type: String
Valid Values:
RDS | DOCDB
Required: Yes
- MaxResults
-
The maximum number of items to return. If the
MaxRecords
value is less than the number of existing items, the response includes a pagination token.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
Response Syntax
{
"Metrics": [
{
"Description": "string",
"Metric": "string",
"Unit": "string"
}
],
"NextToken": "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.
- Metrics
-
An array of metrics available to query. Each array element contains the full name, description, and unit of the metric.
Type: Array of ResponseResourceMetric 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, specifyNextToken
in a separate request with this value.Type: String
Length Constraints: Minimum length of 1. Maximum length of 8192.
Pattern:
^[a-zA-Z0-9_=-]+$
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
List specified metrics
The following example requests the metrics for metric types os
and db
.
Sample Request
POST / HTTP/1.1
Host: <Hostname>
Accept-Encoding: identity
X-Amz-Target: PerformanceInsightsv20180227.ListAvailableResourceMetrics
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",
"MetricTypes": [ "os", "db" ]
}
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
{
"Metrics": [
{
"Description": "The number of virtual CPUs for the DB instance",
"Metric": "os.general.numVCPUs",
"Unit": "vCPUs"
},
......,
{
"Description": "Time spent reading data file blocks by backends in this instance",
"Metric": "db.IO.read_latency",
"Unit": "Milliseconds per block"
},
......
]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: