Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Monitor-Query] Docstring tweaks #34972

Merged
merged 3 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from ._generated.metrics.batch import MonitorBatchMetricsClient
from ._models import MetricsQueryResult
from ._enums import MetricAggregationType
from ._helpers import get_authentication_policy, get_timespan_iso8601_endpoints, get_subscription_id_from_resource

JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
Expand Down Expand Up @@ -53,7 +54,7 @@ def query_resources(
metric_names: Sequence[str],
timespan: Optional[Union[timedelta, Tuple[datetime, timedelta], Tuple[datetime, datetime]]] = None,
granularity: Optional[timedelta] = None,
aggregations: Optional[Sequence[str]] = None,
aggregations: Optional[Sequence[Union[MetricAggregationType, str]]] = None,
max_results: Optional[int] = None,
order_by: Optional[str] = None,
filter: Optional[str] = None,
Expand All @@ -66,22 +67,22 @@ def query_resources(
:paramtype resource_ids: list[str]
:keyword metric_namespace: Metric namespace that contains the requested metric names. Required.
:paramtype metric_namespace: str
:keyword metric_names: The names of the metrics (comma separated) to retrieve. Required.
:keyword metric_names: The names of the metrics to retrieve. Required.
:paramtype metric_names: list[str]
:keyword timespan: The timespan for which to query the data. This can be a timedelta,
a timedelta and a start datetime, or a start datetime/end datetime.
a tuple of a start datetime with timedelta, or a tuple with start and end datetimes.
:paramtype timespan: Optional[Union[~datetime.timedelta, tuple[~datetime.datetime, ~datetime.timedelta],
tuple[~datetime.datetime, ~datetime.datetime]]]
:keyword granularity: The granularity (i.e. timegrain) of the query.
:paramtype granularity: Optional[~datetime.timedelta]
:keyword aggregations: The list of aggregation types to retrieve. Use
`azure.monitor.query.MetricAggregationType` enum to get each aggregation type.
:paramtype aggregations: Optional[list[str]]
:paramtype aggregations: Optional[list[Union[~azure.monitor.query.MetricAggregationType, str]]]
:keyword max_results: The maximum number of records to retrieve.
Valid only if $filter is specified. Defaults to 10.
Valid only if 'filter' is specified. Defaults to 10.
:paramtype max_results: Optional[int]
:keyword order_by: The aggregation to use for sorting results and the direction of the sort.
Only one order can be specified. Examples: sum asc.
Only one order can be specified. Examples: 'sum asc', 'maximum desc'.
:paramtype order_by: Optional[str]
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from .._generated.metrics.batch.aio._client import MonitorBatchMetricsClient
from .._models import MetricsQueryResult
from .._enums import MetricAggregationType
from ._helpers_async import get_authentication_policy
from .._helpers import get_timespan_iso8601_endpoints, get_subscription_id_from_resource

Expand Down Expand Up @@ -54,7 +55,7 @@ async def query_resources(
metric_names: Sequence[str],
timespan: Optional[Union[timedelta, Tuple[datetime, timedelta], Tuple[datetime, datetime]]] = None,
granularity: Optional[timedelta] = None,
aggregations: Optional[Sequence[str]] = None,
aggregations: Optional[Sequence[Union[MetricAggregationType, str]]] = None,
max_results: Optional[int] = None,
order_by: Optional[str] = None,
filter: Optional[str] = None,
Expand All @@ -67,22 +68,22 @@ async def query_resources(
:paramtype resource_ids: list[str]
:keyword metric_namespace: Metric namespace that contains the requested metric names. Required.
:paramtype metric_namespace: str
:keyword metric_names: The names of the metrics (comma separated) to retrieve. Required.
:keyword metric_names: The names of the metrics to retrieve. Required.
:paramtype metric_names: list[str]
:keyword timespan: The timespan for which to query the data. This can be a timedelta,
a timedelta and a start datetime, or a start datetime/end datetime.
a tuple of a start datetime with timedelta, or a tuple with start and end datetimes.
:paramtype timespan: Optional[Union[~datetime.timedelta, tuple[~datetime.datetime, ~datetime.timedelta],
tuple[~datetime.datetime, ~datetime.datetime]]]
:keyword granularity: The granularity (i.e. timegrain) of the query.
:paramtype granularity: Optional[~datetime.timedelta]
:keyword aggregations: The list of aggregation types to retrieve. Use
`azure.monitor.query.MetricAggregationType` enum to get each aggregation type.
:paramtype aggregations: Optional[list[str]]
:paramtype aggregations: Optional[list[Union[~azure.monitor.query.MetricAggregationType, str]]]
:keyword max_results: The maximum number of records to retrieve.
Valid only if $filter is specified.Defaults to 10.
Valid only if 'filter' is specified. Defaults to 10.
:paramtype max_results: Optional[int]
:keyword order_by: The aggregation to use for sorting results and the direction of the sort.
Only one order can be specified. Examples: sum asc.
Only one order can be specified. Examples: 'sum asc', 'maximum desc'.
:paramtype order_by: Optional[str]
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or
Expand Down