Skip to content

Commit ccaf592

Browse files
authored
[Monitor Query] Update filter docstrings (#34974)
These were using `$filter`, but this is misleading. Updated to reflect more accurate usage. Signed-off-by: Paul Van Eck <[email protected]>
1 parent b605d0a commit ccaf592

File tree

4 files changed

+116
-52
lines changed

4 files changed

+116
-52
lines changed

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

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,39 @@ def query_resources(
8484
:keyword order_by: The aggregation to use for sorting results and the direction of the sort.
8585
Only one order can be specified. Examples: 'sum asc', 'maximum desc'.
8686
:paramtype order_by: Optional[str]
87-
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
88-
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or
89-
b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A
90-
eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or
91-
operator cannot separate two different metadata names. - Return all time series where A = a1,
92-
B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series
93-
where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When dimension
94-
name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1**
95-
Instead of using **$filter= "dim (test) 1 eq '*'"** use **$filter= "dim %2528test%2529 1 eq '*'"**.
96-
When dimension name is **dim (test) 3** and dimension value is **dim3 (test) val**, instead of using
97-
**$filter= "dim (test) 3 eq 'dim3 (test) val'"** use **$filter= "dim
98-
%2528test%2529 3 eq 'dim3 %2528test%2529 val'"**. Default value is None.
87+
:keyword filter: The **filter** is used to reduce the set of metric data returned. Default value is None.
88+
89+
Example: Metric contains metadata A, B and C.
90+
91+
- Return all time series of C where A = a1 and B = b1 or b2:
92+
93+
**filter="A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'"**
94+
95+
- Invalid variant:
96+
97+
**filter="A eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'"**. This is invalid because the
98+
logical 'or' operator cannot separate two different metadata names.
99+
100+
- Return all time series where A = a1, B = b1 and C = c1:
101+
102+
**filter="A eq 'a1' and B eq 'b1' and C eq 'c1'"**
103+
104+
- Return all time series where A = a1:
105+
106+
**filter="A eq 'a1' and B eq '*' and C eq '*'"**
107+
108+
- Special case: When dimension name or dimension value uses round brackets. Example: When dimension name
109+
is **dim (test) 1**, instead of using **filter="dim (test) 1 eq '*'"** use
110+
**filter="dim %2528test%2529 1 eq '*'"**.
111+
112+
When dimension name is **dim (test) 3** and dimension value is
113+
**dim3 (test) val**, instead of using **filter="dim (test) 3 eq 'dim3 (test) val'"**, use **filter="dim
114+
%2528test%2529 3 eq 'dim3 %2528test%2529 val'"**.
99115
:paramtype filter: str
100116
:keyword roll_up_by: Dimension name(s) to rollup results by. For example if you only want to see
101117
metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't want to see
102118
separate values for each city, you can specify 'City' to see the results for Seattle
103-
and Tacoma rolled up into one timeseries. Default value is None.
119+
and Tacoma rolled up into one timeseries.
104120
:paramtype roll_up_by: str
105121
:return: A list of MetricsQueryResult objects.
106122
:rtype: list[~azure.monitor.query.MetricsQueryResult]

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

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,25 +98,41 @@ def query_resource(
9898
`azure.monitor.query.MetricAggregationType` enum to get each aggregation type.
9999
:paramtype aggregations: Optional[list[str]]
100100
:keyword max_results: The maximum number of records to retrieve.
101-
Valid only if $filter is specified.
101+
Valid only if 'filter' is specified.
102102
Defaults to 10.
103103
:paramtype max_results: Optional[int]
104104
:keyword order_by: The aggregation to use for sorting results and the direction of the sort.
105105
Only one order can be specified.
106106
Examples: sum asc.
107107
:paramtype order_by: Optional[str]
108-
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
109-
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or
110-
b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A
111-
eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or
112-
operator cannot separate two different metadata names. - Return all time series where A = a1, B
113-
= b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series
114-
where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When dimension
115-
name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1**
116-
Instead of using **$filter= "dim (test) 1 eq '*'"** use **$filter= "dim %2528test%2529 1 eq '*'"**.
117-
When dimension name is **dim (test) 3** and dimension value is **dim3 (test) val**, instead of using
118-
**$filter= "dim (test) 3 eq 'dim3 (test) val'"** use **$filter= "dim
119-
%2528test%2529 3 eq 'dim3 %2528test%2529 val'"**. Default value is None.
108+
:keyword filter: The **filter** is used to reduce the set of metric data returned. Default value is None.
109+
110+
Example: Metric contains metadata A, B and C.
111+
112+
- Return all time series of C where A = a1 and B = b1 or b2:
113+
114+
**filter="A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'"**
115+
116+
- Invalid variant:
117+
118+
**filter="A eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'"**. This is invalid because the
119+
logical 'or' operator cannot separate two different metadata names.
120+
121+
- Return all time series where A = a1, B = b1 and C = c1:
122+
123+
**filter="A eq 'a1' and B eq 'b1' and C eq 'c1'"**
124+
125+
- Return all time series where A = a1:
126+
127+
**filter="A eq 'a1' and B eq '*' and C eq '*'"**
128+
129+
- Special case: When dimension name or dimension value uses round brackets. Example: When dimension name
130+
is **dim (test) 1**, instead of using **filter="dim (test) 1 eq '*'"** use
131+
**filter="dim %2528test%2529 1 eq '*'"**.
132+
133+
When dimension name is **dim (test) 3** and dimension value is
134+
**dim3 (test) val**, instead of using **filter="dim (test) 3 eq 'dim3 (test) val'"**, use **filter="dim
135+
%2528test%2529 3 eq 'dim3 %2528test%2529 val'"**.
120136
:paramtype filter: Optional[str]
121137
:keyword metric_namespace: Metric namespace to query metric definitions for.
122138
:paramtype metric_namespace: Optional[str]

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

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,39 @@ async def query_resources(
8585
:keyword order_by: The aggregation to use for sorting results and the direction of the sort.
8686
Only one order can be specified. Examples: 'sum asc', 'maximum desc'.
8787
:paramtype order_by: Optional[str]
88-
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
89-
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or
90-
b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A
91-
eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or
92-
operator cannot separate two different metadata names. - Return all time series where A = a1,
93-
B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series
94-
where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When dimension
95-
name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1**
96-
Instead of using **$filter= "dim (test) 1 eq '*'"** use **$filter= "dim %2528test%2529 1 eq '*'"**.
97-
When dimension name is **dim (test) 3** and dimension value is **dim3 (test) val**, instead of using
98-
**$filter= "dim (test) 3 eq 'dim3 (test) val'"** use **$filter= "dim
99-
%2528test%2529 3 eq 'dim3 %2528test%2529 val'"**. Default value is None.
88+
:keyword filter: The **filter** is used to reduce the set of metric data returned. Default value is None.
89+
90+
Example: Metric contains metadata A, B and C.
91+
92+
- Return all time series of C where A = a1 and B = b1 or b2:
93+
94+
**filter="A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'"**
95+
96+
- Invalid variant:
97+
98+
**filter="A eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'"**. This is invalid because the
99+
logical 'or' operator cannot separate two different metadata names.
100+
101+
- Return all time series where A = a1, B = b1 and C = c1:
102+
103+
**filter="A eq 'a1' and B eq 'b1' and C eq 'c1'"**
104+
105+
- Return all time series where A = a1:
106+
107+
**filter="A eq 'a1' and B eq '*' and C eq '*'"**
108+
109+
- Special case: When dimension name or dimension value uses round brackets. Example: When dimension name
110+
is **dim (test) 1**, instead of using **filter="dim (test) 1 eq '*'"** use
111+
**filter="dim %2528test%2529 1 eq '*'"**.
112+
113+
When dimension name is **dim (test) 3** and dimension value is
114+
**dim3 (test) val**, instead of using **filter="dim (test) 3 eq 'dim3 (test) val'"**, use **filter="dim
115+
%2528test%2529 3 eq 'dim3 %2528test%2529 val'"**.
100116
:paramtype filter: str
101117
:keyword roll_up_by: Dimension name(s) to rollup results by. For example if you only want to see
102118
metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't want to see
103119
separate values for each city, you can specify 'City' to see the results for Seattle
104-
and Tacoma rolled up into one timeseries. Default value is None.
120+
and Tacoma rolled up into one timeseries.
105121
:paramtype roll_up_by: str
106122
:return: A list of MetricsQueryResult objects.
107123
:rtype: list[~azure.monitor.query.MetricsQueryResult]

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

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,41 @@ async def query_resource(
9999
Use `azure.monitor.query.MetricAggregationType` enum to get each aggregation type.
100100
:paramtype aggregations: Optional[list[str]]
101101
:keyword max_results: The maximum number of records to retrieve.
102-
Valid only if $filter is specified.
102+
Valid only if 'filter' is specified.
103103
Defaults to 10.
104104
:paramtype max_results: Optional[int]
105105
:keyword order_by: The aggregation to use for sorting results and the direction of the sort.
106106
Only one order can be specified.
107107
Examples: sum asc.
108108
:paramtype order_by: Optional[str]
109-
:keyword filter: The **$filter** is used to reduce the set of metric data returned. Example:
110-
Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or
111-
b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A
112-
eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or
113-
operator cannot separate two different metadata names. - Return all time series where A = a1, B
114-
= b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series
115-
where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When dimension
116-
name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1**
117-
Instead of using **$filter= "dim (test) 1 eq '*'"** use **$filter= "dim %2528test%2529 1 eq '*'"**.
118-
When dimension name is **dim (test) 3** and dimension value is **dim3 (test) val**, instead of using
119-
**$filter= "dim (test) 3 eq 'dim3 (test) val'"** use **$filter= "dim
120-
%2528test%2529 3 eq 'dim3 %2528test%2529 val'"**. Default value is None.
109+
:keyword filter: The **filter** is used to reduce the set of metric data returned. Default value is None.
110+
111+
Example: Metric contains metadata A, B and C.
112+
113+
- Return all time series of C where A = a1 and B = b1 or b2:
114+
115+
**filter="A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'"**
116+
117+
- Invalid variant:
118+
119+
**filter="A eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'"**. This is invalid because the
120+
logical 'or' operator cannot separate two different metadata names.
121+
122+
- Return all time series where A = a1, B = b1 and C = c1:
123+
124+
**filter="A eq 'a1' and B eq 'b1' and C eq 'c1'"**
125+
126+
- Return all time series where A = a1:
127+
128+
**filter="A eq 'a1' and B eq '*' and C eq '*'"**
129+
130+
- Special case: When dimension name or dimension value uses round brackets. Example: When dimension name
131+
is **dim (test) 1**, instead of using **filter="dim (test) 1 eq '*'"** use
132+
**filter="dim %2528test%2529 1 eq '*'"**.
133+
134+
When dimension name is **dim (test) 3** and dimension value is
135+
**dim3 (test) val**, instead of using **filter="dim (test) 3 eq 'dim3 (test) val'"**, use **filter="dim
136+
%2528test%2529 3 eq 'dim3 %2528test%2529 val'"**.
121137
:paramtype filter: Optional[str]
122138
:keyword metric_namespace: Metric namespace to query metric definitions for.
123139
:paramtype metric_namespace: Optional[str]

0 commit comments

Comments
 (0)