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
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | |