13
13
14
14
from ._generated .metrics .batch import MonitorBatchMetricsClient
15
15
from ._models import MetricsQueryResult
16
+ from ._enums import MetricAggregationType
16
17
from ._helpers import get_authentication_policy , get_timespan_iso8601_endpoints , get_subscription_id_from_resource
17
18
18
19
JSON = MutableMapping [str , Any ] # pylint: disable=unsubscriptable-object
@@ -53,7 +54,7 @@ def query_resources(
53
54
metric_names : Sequence [str ],
54
55
timespan : Optional [Union [timedelta , Tuple [datetime , timedelta ], Tuple [datetime , datetime ]]] = None ,
55
56
granularity : Optional [timedelta ] = None ,
56
- aggregations : Optional [Sequence [str ]] = None ,
57
+ aggregations : Optional [Sequence [Union [ MetricAggregationType , str ] ]] = None ,
57
58
max_results : Optional [int ] = None ,
58
59
order_by : Optional [str ] = None ,
59
60
filter : Optional [str ] = None ,
@@ -66,22 +67,22 @@ def query_resources(
66
67
:paramtype resource_ids: list[str]
67
68
:keyword metric_namespace: Metric namespace that contains the requested metric names. Required.
68
69
:paramtype metric_namespace: str
69
- :keyword metric_names: The names of the metrics (comma separated) to retrieve. Required.
70
+ :keyword metric_names: The names of the metrics to retrieve. Required.
70
71
:paramtype metric_names: list[str]
71
72
:keyword timespan: The timespan for which to query the data. This can be a timedelta,
72
- a timedelta and a start datetime, or a start datetime/ end datetime .
73
+ a tuple of a start datetime with timedelta , or a tuple with start and end datetimes .
73
74
:paramtype timespan: Optional[Union[~datetime.timedelta, tuple[~datetime.datetime, ~datetime.timedelta],
74
75
tuple[~datetime.datetime, ~datetime.datetime]]]
75
76
:keyword granularity: The granularity (i.e. timegrain) of the query.
76
77
:paramtype granularity: Optional[~datetime.timedelta]
77
78
:keyword aggregations: The list of aggregation types to retrieve. Use
78
79
`azure.monitor.query.MetricAggregationType` enum to get each aggregation type.
79
- :paramtype aggregations: Optional[list[str]]
80
+ :paramtype aggregations: Optional[list[Union[~azure.monitor.query.MetricAggregationType, str] ]]
80
81
:keyword max_results: The maximum number of records to retrieve.
81
- Valid only if $ filter is specified. Defaults to 10.
82
+ Valid only if ' filter' is specified. Defaults to 10.
82
83
:paramtype max_results: Optional[int]
83
84
:keyword order_by: The aggregation to use for sorting results and the direction of the sort.
84
- Only one order can be specified. Examples: sum asc.
85
+ Only one order can be specified. Examples: ' sum asc', 'maximum desc' .
85
86
:paramtype order_by: Optional[str]
86
87
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
87
88
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or
0 commit comments