Skip to content

Commit d249cc6

Browse files
authored
[Monitor Query] Regen with latest swagger (#33752)
Now we use the stable swaggers. The swagger file was also renamed to enable compatibility with the tox "generate" environment. Also made some adjustments based on feedback such as `batch_query` positional arg order and the inclusion of the `roll_up_by` kwarg. Signed-off-by: Paul Van Eck <[email protected]>
1 parent 2219c7d commit d249cc6

File tree

18 files changed

+317
-186
lines changed

18 files changed

+317
-186
lines changed

sdk/monitor/azure-monitor-query/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# Release History
22

3-
## 1.3.0b3 (Unreleased)
3+
## 1.3.0 (Unreleased)
44

55
### Features Added
66

7+
- Added `roll_up_by` keyword argument to `MetricsBatchQueryClient.query_batch` to support rolling up metrics by dimension. ([#33752](https://github.com/Azure/azure-sdk-for-python/pull/33752))
8+
79
### Breaking Changes
810

11+
- The following changes are breaking against the previous preview release (i.e. `1.3.0b2`/`1.3.0b1`):
12+
- Reordered the arguments for the async `MetricsBatchQueryClient` constructor so that `endpoint` is now the first positional argument. ([#33752](https://github.com/Azure/azure-sdk-for-python/pull/33752))
13+
- Reordered the `metric_names` and `metric_namespace` positional arguments in `MetricsBatchQueryClient.query_batch`. ([#33752](https://github.com/Azure/azure-sdk-for-python/pull/33752))
14+
915
### Bugs Fixed
1016

1117
### Other Changes

sdk/monitor/azure-monitor-query/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/monitor/azure-monitor-query",
5-
"Tag": "python/monitor/azure-monitor-query_70a241fcfc"
5+
"Tag": "python/monitor/azure-monitor-query_7462cb1df1"
66
}

sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/operations/_operations.py

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def list(self, resource_uri: str, *, metricnamespace: Optional[str] = None, **kw
6464
6565
:param resource_uri: The identifier of the resource. Required.
6666
:type resource_uri: str
67-
:keyword metricnamespace: Metric namespace to query metric definitions for. Default value is
67+
:keyword metricnamespace: Metric namespace where the metrics you want reside. Default value is
6868
None.
6969
:paramtype metricnamespace: str
7070
:return: An iterator like instance of JSON object
@@ -85,16 +85,16 @@ def list(self, resource_uri: str, *, metricnamespace: Optional[str] = None, **kw
8585
],
8686
"displayDescription": "str", # Optional. Detailed description of this
8787
metric.
88-
"id": "str", # Optional. the resource identifier of the metric definition.
88+
"id": "str", # Optional. The resource identifier of the metric definition.
8989
"isDimensionRequired": bool, # Optional. Flag to indicate whether the
9090
dimension is required.
9191
"metricAvailabilities": [
9292
{
93-
"retention": "1 day, 0:00:00", # Optional. the retention
93+
"retention": "1 day, 0:00:00", # Optional. The retention
9494
period for the metric at the specified timegrain. Expressed as a
9595
duration 'PT1M', 'P1D', etc.
96-
"timeGrain": "1 day, 0:00:00" # Optional. the time grain
97-
specifies the aggregation interval for the metric. Expressed as a
96+
"timeGrain": "1 day, 0:00:00" # Optional. The time grain
97+
specifies a supported aggregation interval for the metric. Expressed as a
9898
duration 'PT1M', 'P1D', etc.
9999
}
100100
],
@@ -104,14 +104,14 @@ def list(self, resource_uri: str, *, metricnamespace: Optional[str] = None, **kw
104104
"value": "str", # The invariant value. Required.
105105
"localizedValue": "str" # Optional. The display name.
106106
},
107-
"namespace": "str", # Optional. the namespace the metric belongs to.
108-
"primaryAggregationType": "str", # Optional. the primary aggregation type
107+
"namespace": "str", # Optional. The namespace the metric belongs to.
108+
"primaryAggregationType": "str", # Optional. The primary aggregation type
109109
value defining how to use the values for display. Known values are: "None",
110110
"Average", "Count", "Minimum", "Maximum", and "Total".
111-
"resourceId": "str", # Optional. the resource identifier of the resource
111+
"resourceId": "str", # Optional. The resource identifier of the resource
112112
that emitted the metric.
113113
"supportedAggregationTypes": [
114-
"str" # Optional. the collection of what aggregation types are
114+
"str" # Optional. The collection of what aggregation types are
115115
supported.
116116
],
117117
"unit": "str" # Optional. The unit of the metric. Known values are: "Count",
@@ -123,7 +123,7 @@ def list(self, resource_uri: str, *, metricnamespace: Optional[str] = None, **kw
123123
_headers = kwargs.pop("headers", {}) or {}
124124
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
125125

126-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01"))
126+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
127127
cls: ClsType[JSON] = kwargs.pop("cls", None)
128128

129129
error_map = {
@@ -210,6 +210,9 @@ async def list(
210210
filter: Optional[str] = None,
211211
result_type: Optional[str] = None,
212212
metricnamespace: Optional[str] = None,
213+
auto_adjust_timegrain: Optional[bool] = None,
214+
validate_dimensions: Optional[bool] = None,
215+
rollupby: Optional[str] = None,
213216
**kwargs: Any
214217
) -> JSON:
215218
# pylint: disable=line-too-long
@@ -225,41 +228,51 @@ async def list(
225228
span requested.
226229
*Examples: PT15M, PT1H, P1D, FULL*. Default value is None.
227230
:paramtype interval: ~datetime.timedelta
228-
:keyword metricnames: The names of the metrics (comma separated) to retrieve. Special case: If
229-
a metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be
230-
**'Metric%2Name1'**. Default value is None.
231+
:keyword metricnames: The names of the metrics (comma separated) to retrieve. Default value is
232+
None.
231233
:paramtype metricnames: str
232-
:keyword aggregation: The list of aggregation types (comma separated) to retrieve. Default
233-
value is None.
234+
:keyword aggregation: The list of aggregation types (comma separated) to retrieve.
235+
*Examples: average, minimum, maximum*. Default value is None.
234236
:paramtype aggregation: str
235-
:keyword top: The maximum number of records to retrieve.
236-
Valid only if $filter is specified.
237+
:keyword top: The maximum number of records to retrieve per resource ID in the request.
238+
Valid only if filter is specified.
237239
Defaults to 10. Default value is None.
238240
:paramtype top: int
239241
:keyword orderby: The aggregation to use for sorting results and the direction of the sort.
240242
Only one order can be specified.
241-
Examples: sum asc. Default value is None.
243+
*Examples: sum asc*. Default value is None.
242244
:paramtype orderby: str
243-
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
244-
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or
245-
b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A
246-
eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or
247-
operator cannot separate two different metadata names. - Return all time series where A = a1, B
248-
= b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series
249-
where A = a1 **$filter=A eq 'a1' and B eq '\ *' and C eq '*\ '**. Special case: When dimension
250-
name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1**
251-
Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\
252-
' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\
253-
** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim
254-
%2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None.
245+
:keyword filter: The **$filter** is used to reduce the set of metric data
246+
returned.:code:`<br>`Example::code:`<br>`Metric contains metadata A, B and C.:code:`<br>`-
247+
Return all time series of C where A = a1 and B = b1 or b2:code:`<br>`\ **$filter=A eq ‘a1’ and
248+
B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`<br>`- Invalid variant::code:`<br>`\ **$filter=A
249+
eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`<br>`This is invalid because the
250+
logical or operator cannot separate two different metadata names.:code:`<br>`- Return all time
251+
series where A = a1, B = b1 and C = c1::code:`<br>`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq
252+
‘c1’**\ :code:`<br>`- Return all time series where A = a1:code:`<br>`\ **$filter=A eq ‘a1’ and
253+
B eq ‘\ *’ and C eq ‘*\ ’**. Default value is None.
255254
:paramtype filter: str
256255
:keyword result_type: Reduces the set of data collected. The syntax allowed depends on the
257256
operation. See the operation's description for details. Known values are: "Data" and
258257
"Metadata". Default value is None.
259258
:paramtype result_type: str
260-
:keyword metricnamespace: Metric namespace to query metric definitions for. Default value is
259+
:keyword metricnamespace: Metric namespace where the metrics you want reside. Default value is
261260
None.
262261
:paramtype metricnamespace: str
262+
:keyword auto_adjust_timegrain: When set to true, if the timespan passed in is not supported by
263+
this metric, the API will return the result using the closest supported timespan. When set to
264+
false, an error is returned for invalid timespan parameters. Defaults to false. Default value
265+
is None.
266+
:paramtype auto_adjust_timegrain: bool
267+
:keyword validate_dimensions: When set to false, invalid filter parameter values will be
268+
ignored. When set to true, an error is returned for invalid filter parameters. Defaults to
269+
true. Default value is None.
270+
:paramtype validate_dimensions: bool
271+
:keyword rollupby: Dimension name(s) to rollup results by. For example if you only want to see
272+
metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't want to see
273+
separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle
274+
and Tacoma rolled up into one timeseries. Default value is None.
275+
:paramtype rollupby: str
263276
:return: JSON object
264277
:rtype: JSON
265278
:raises ~azure.core.exceptions.HttpResponseError:
@@ -275,7 +288,7 @@ async def list(
275288
Required.
276289
"value": [
277290
{
278-
"id": "str", # the metric Id. Required.
291+
"id": "str", # The metric Id. Required.
279292
"name": {
280293
"value": "str", # The invariant value. Required.
281294
"localizedValue": "str" # Optional. The display
@@ -316,7 +329,7 @@ async def list(
316329
]
317330
}
318331
],
319-
"type": "str", # the resource type of the metric resource.
332+
"type": "str", # The resource type of the metric resource.
320333
Required.
321334
"unit": "str", # The unit of the metric. Required. Known
322335
values are: "Count", "Bytes", "Seconds", "CountPerSecond",
@@ -354,7 +367,7 @@ async def list(
354367
_headers = kwargs.pop("headers", {}) or {}
355368
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
356369

357-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-01-01"))
370+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01"))
358371
cls: ClsType[JSON] = kwargs.pop("cls", None)
359372

360373
_request = build_metrics_list_request(
@@ -368,6 +381,9 @@ async def list(
368381
filter=filter,
369382
result_type=result_type,
370383
metricnamespace=metricnamespace,
384+
auto_adjust_timegrain=auto_adjust_timegrain,
385+
validate_dimensions=validate_dimensions,
386+
rollupby=rollupby,
371387
api_version=api_version,
372388
headers=_headers,
373389
params=_params,

sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class MonitorBatchMetricsClient: # pylint: disable=client-accepts-api-version-k
2727
https://eastus.metrics.monitor.azure.com. The region should match the region of the requested
2828
resources. For global resources, the region should be 'global'. Required.
2929
:type endpoint: str
30-
:keyword api_version: Api Version. Default value is "2023-05-01-preview". Note that overriding
31-
this default value may result in unsupported behavior.
30+
:keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this
31+
default value may result in unsupported behavior.
3232
:paramtype api_version: str
3333
"""
3434

sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ class MonitorBatchMetricsClientConfiguration: # pylint: disable=too-many-instan
2323
https://eastus.metrics.monitor.azure.com. The region should match the region of the requested
2424
resources. For global resources, the region should be 'global'. Required.
2525
:type endpoint: str
26-
:keyword api_version: Api Version. Default value is "2023-05-01-preview". Note that overriding
27-
this default value may result in unsupported behavior.
26+
:keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this
27+
default value may result in unsupported behavior.
2828
:paramtype api_version: str
2929
"""
3030

3131
def __init__(self, endpoint: str, **kwargs: Any) -> None:
32-
api_version: str = kwargs.pop("api_version", "2023-05-01-preview")
32+
api_version: str = kwargs.pop("api_version", "2023-10-01")
3333

3434
if endpoint is None:
3535
raise ValueError("Parameter 'endpoint' must not be None.")

sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class MonitorBatchMetricsClient: # pylint: disable=client-accepts-api-version-k
2727
https://eastus.metrics.monitor.azure.com. The region should match the region of the requested
2828
resources. For global resources, the region should be 'global'. Required.
2929
:type endpoint: str
30-
:keyword api_version: Api Version. Default value is "2023-05-01-preview". Note that overriding
31-
this default value may result in unsupported behavior.
30+
:keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this
31+
default value may result in unsupported behavior.
3232
:paramtype api_version: str
3333
"""
3434

sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ class MonitorBatchMetricsClientConfiguration: # pylint: disable=too-many-instan
2323
https://eastus.metrics.monitor.azure.com. The region should match the region of the requested
2424
resources. For global resources, the region should be 'global'. Required.
2525
:type endpoint: str
26-
:keyword api_version: Api Version. Default value is "2023-05-01-preview". Note that overriding
27-
this default value may result in unsupported behavior.
26+
:keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this
27+
default value may result in unsupported behavior.
2828
:paramtype api_version: str
2929
"""
3030

3131
def __init__(self, endpoint: str, **kwargs: Any) -> None:
32-
api_version: str = kwargs.pop("api_version", "2023-05-01-preview")
32+
api_version: str = kwargs.pop("api_version", "2023-10-01")
3333

3434
if endpoint is None:
3535
raise ValueError("Parameter 'endpoint' must not be None.")

0 commit comments

Comments
 (0)