Skip to content

Commit 65a743b

Browse files
authored
[Monitor-Query] Docstring tweaks (#34972)
Update docstrings in `MetricsClient`
1 parent 09e5e39 commit 65a743b

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from ._generated.metrics.batch import MonitorBatchMetricsClient
1515
from ._models import MetricsQueryResult
16+
from ._enums import MetricAggregationType
1617
from ._helpers import get_authentication_policy, get_timespan_iso8601_endpoints, get_subscription_id_from_resource
1718

1819
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
@@ -53,7 +54,7 @@ def query_resources(
5354
metric_names: Sequence[str],
5455
timespan: Optional[Union[timedelta, Tuple[datetime, timedelta], Tuple[datetime, datetime]]] = None,
5556
granularity: Optional[timedelta] = None,
56-
aggregations: Optional[Sequence[str]] = None,
57+
aggregations: Optional[Sequence[Union[MetricAggregationType, str]]] = None,
5758
max_results: Optional[int] = None,
5859
order_by: Optional[str] = None,
5960
filter: Optional[str] = None,
@@ -66,22 +67,22 @@ def query_resources(
6667
:paramtype resource_ids: list[str]
6768
:keyword metric_namespace: Metric namespace that contains the requested metric names. Required.
6869
: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.
7071
:paramtype metric_names: list[str]
7172
: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.
7374
:paramtype timespan: Optional[Union[~datetime.timedelta, tuple[~datetime.datetime, ~datetime.timedelta],
7475
tuple[~datetime.datetime, ~datetime.datetime]]]
7576
:keyword granularity: The granularity (i.e. timegrain) of the query.
7677
:paramtype granularity: Optional[~datetime.timedelta]
7778
:keyword aggregations: The list of aggregation types to retrieve. Use
7879
`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]]]
8081
: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.
8283
:paramtype max_results: Optional[int]
8384
: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'.
8586
:paramtype order_by: Optional[str]
8687
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
8788
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or

sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_client_async.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from .._generated.metrics.batch.aio._client import MonitorBatchMetricsClient
1515
from .._models import MetricsQueryResult
16+
from .._enums import MetricAggregationType
1617
from ._helpers_async import get_authentication_policy
1718
from .._helpers import get_timespan_iso8601_endpoints, get_subscription_id_from_resource
1819

@@ -54,7 +55,7 @@ async def query_resources(
5455
metric_names: Sequence[str],
5556
timespan: Optional[Union[timedelta, Tuple[datetime, timedelta], Tuple[datetime, datetime]]] = None,
5657
granularity: Optional[timedelta] = None,
57-
aggregations: Optional[Sequence[str]] = None,
58+
aggregations: Optional[Sequence[Union[MetricAggregationType, str]]] = None,
5859
max_results: Optional[int] = None,
5960
order_by: Optional[str] = None,
6061
filter: Optional[str] = None,
@@ -67,22 +68,22 @@ async def query_resources(
6768
:paramtype resource_ids: list[str]
6869
:keyword metric_namespace: Metric namespace that contains the requested metric names. Required.
6970
:paramtype metric_namespace: str
70-
:keyword metric_names: The names of the metrics (comma separated) to retrieve. Required.
71+
:keyword metric_names: The names of the metrics to retrieve. Required.
7172
:paramtype metric_names: list[str]
7273
:keyword timespan: The timespan for which to query the data. This can be a timedelta,
73-
a timedelta and a start datetime, or a start datetime/end datetime.
74+
a tuple of a start datetime with timedelta, or a tuple with start and end datetimes.
7475
:paramtype timespan: Optional[Union[~datetime.timedelta, tuple[~datetime.datetime, ~datetime.timedelta],
7576
tuple[~datetime.datetime, ~datetime.datetime]]]
7677
:keyword granularity: The granularity (i.e. timegrain) of the query.
7778
:paramtype granularity: Optional[~datetime.timedelta]
7879
:keyword aggregations: The list of aggregation types to retrieve. Use
7980
`azure.monitor.query.MetricAggregationType` enum to get each aggregation type.
80-
:paramtype aggregations: Optional[list[str]]
81+
:paramtype aggregations: Optional[list[Union[~azure.monitor.query.MetricAggregationType, str]]]
8182
:keyword max_results: The maximum number of records to retrieve.
82-
Valid only if $filter is specified.Defaults to 10.
83+
Valid only if 'filter' is specified. Defaults to 10.
8384
:paramtype max_results: Optional[int]
8485
:keyword order_by: The aggregation to use for sorting results and the direction of the sort.
85-
Only one order can be specified. Examples: sum asc.
86+
Only one order can be specified. Examples: 'sum asc', 'maximum desc'.
8687
:paramtype order_by: Optional[str]
8788
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
8889
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or

0 commit comments

Comments
 (0)