get_resource_metrics
async
¶
get_resource_metrics(
service_type: ServiceType,
identifier: IdentifierString,
metric_queries: MetricQueryList,
start_time: ISOTimestamp,
end_time: ISOTimestamp,
*,
config_overrides: Optional[AsyncPIClientConfig] = None,
period_in_seconds: Optional[Integer] = None,
max_results: Optional[MaxResults] = None,
next_token: Optional[NextToken] = None,
period_alignment: Optional[PeriodAlignment] = None,
) -> GetResourceMetricsResponse
Retrieve Performance Insights metrics for a set of data sources over a time period. You can provide specific dimension groups and dimensions, and provide filtering criteria for each group. You must specify an aggregate function for each metric.
Each response element returns a maximum of 500 bytes. For larger elements, such as SQL statements, only the first 500 bytes are returned.
Parameters:
-
service_type(ServiceType) –The Amazon Web Services service for which Performance Insights returns metrics. Valid values are as follows:
-
RDS -
DOCDB
-
-
identifier(IdentifierString) –An immutable identifier for a data source that is unique for an Amazon Web Services Region. Performance Insights gathers metrics from this data source. In the console, the identifier is shown as ResourceID. When you call
DescribeDBInstances, the identifier is returned asDbiResourceId.To use a DB instance as a data source, specify its
DbiResourceIdvalue. For example, specifydb-ABCDEFGHIJKLMNOPQRSTU1VW2X. -
metric_queries(MetricQueryList) –An array of one or more queries to perform. Each query must specify a Performance Insights metric and specify an aggregate function, and you can provide filtering criteria. You must append the aggregate function to the metric. For example, to find the average for the metric
db.loadyou must usedb.load.avg. Valid values for aggregate functions include.avg,.min,.max, and.sum. -
start_time(ISOTimestamp) –The date and time specifying the beginning of the requested time series query range. You can't specify a
StartTimethat is earlier than 7 days ago. By default, Performance Insights has 7 days of retention, but you can extend this range up to 2 years. The value specified is inclusive. Thus, the command returns data points equal to or greater thanStartTime.The value for
StartTimemust be earlier than the value forEndTime. -
end_time(ISOTimestamp) –The date and time specifying the end of the requested time series query range. The value specified is exclusive. Thus, the command returns data points less than (but not equal to)
EndTime.The value for
EndTimemust be later than the value forStartTime. -
period_in_seconds(Optional[Integer], default:None) –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 will choose a value for you, with a goal of returning roughly 100-200 data points in the response. -
-
max_results(Optional[MaxResults], default:None) –The maximum number of items to return in the response.
-
next_token(Optional[NextToken], default:None) –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. -
period_alignment(Optional[PeriodAlignment], default:None) –The returned timestamp which is the start or end time of the time periods. The default value is
END_TIME.
Raises:
-
InternalServiceError–The request failed due to an unknown error.
-
InvalidArgumentException–One of the arguments provided is invalid for this request.
-
NotAuthorizedException–The user is not authorized to perform this request.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_pi/_services/async_pi.py
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |