MonitorExtensions.GetMonitorMetricsAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetMonitorMetricsAsync(ArmClient, ResourceIdentifier, String, String, String, String, Nullable<Int32>, String, String, Nullable<MonitorResultType>, String, Nullable<Boolean>, Nullable<Boolean>, String, CancellationToken)
- Source:
- MonitorExtensions.cs
Lists the metric values for a resource. This API used the default ARM throttling limits. <item> Mocking. To mock this method, please mock GetMonitorMetricsAsync(ResourceIdentifier, String, String, String, String, Nullable<Int32>, String, String, Nullable<MonitorResultType>, String, Nullable<Boolean>, Nullable<Boolean>, String, CancellationToken) instead. </item>
public static System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Monitor.Models.MonitorMetricsResult>> GetMonitorMetricsAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string timespan = default, string interval = default, string metricnames = default, string aggregation = default, int? top = default, string orderby = default, string filter = default, Azure.ResourceManager.Monitor.Models.MonitorResultType? resultType = default, string metricnamespace = default, bool? autoAdjustTimegrain = default, bool? validateDimensions = default, string rollupby = default, System.Threading.CancellationToken cancellationToken = default);
static member GetMonitorMetricsAsync : Azure.ResourceManager.ArmClient * Azure.Core.ResourceIdentifier * string * string * string * string * Nullable<int> * string * string * Nullable<Azure.ResourceManager.Monitor.Models.MonitorResultType> * string * Nullable<bool> * Nullable<bool> * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Monitor.Models.MonitorMetricsResult>>
<Extension()>
Public Function GetMonitorMetricsAsync (client As ArmClient, scope As ResourceIdentifier, Optional timespan As String = Nothing, Optional interval As String = Nothing, Optional metricnames As String = Nothing, Optional aggregation As String = Nothing, Optional top As Nullable(Of Integer) = Nothing, Optional orderby As String = Nothing, Optional filter As String = Nothing, Optional resultType As Nullable(Of MonitorResultType) = Nothing, Optional metricnamespace As String = Nothing, Optional autoAdjustTimegrain As Nullable(Of Boolean) = Nothing, Optional validateDimensions As Nullable(Of Boolean) = Nothing, Optional rollupby As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of MonitorMetricsResult))
Parameters
- scope
- ResourceIdentifier
The scope that the resource will apply against.
- timespan
- String
The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
- interval
- String
The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value that returns single datapoint for entire time span requested. Examples: PT15M, PT1H, P1D, FULL
- metricnames
- String
The names of the metrics (comma separated) to retrieve. Limit 20 metrics.
- aggregation
- String
The list of aggregation types (comma separated) to retrieve. Examples: average, minimum, maximum
The maximum number of records to retrieve per resource ID in the request. Valid only if filter is specified. Defaults to 10.
- orderby
- String
The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum asc
- filter
- String
The $filter is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’<br>- Invalid variant:<br>$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’<br>- Return all time series where A = a1<br>$filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’.
- resultType
- Nullable<MonitorResultType>
Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
- metricnamespace
- String
Metric namespace where the metrics you want reside.
When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest supported timespan. When set to false, an error is returned for invalid timespan parameters. Defaults to false.
When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid filter parameters. Defaults to true.
- rollupby
- String
Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't want to see separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
client is null.
Applies to
GetMonitorMetricsAsync(SubscriptionResource, String, String, String, String, String, Nullable<Int32>, String, String, Nullable<MonitorMetricResultType>, String, Nullable<Boolean>, Nullable<Boolean>, String, CancellationToken)
- Source:
- MonitorExtensions.cs
Lists the metric data for a subscription. This API used the default ARM throttling limits. <item> Mocking. To mock this method, please mock GetMonitorMetricsAsync(String, String, String, String, String, Nullable<Int32>, String, String, Nullable<MonitorMetricResultType>, String, Nullable<Boolean>, Nullable<Boolean>, String, CancellationToken) instead. </item>
public static System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Monitor.Models.MonitorMetricsResult>> GetMonitorMetricsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string region, string timespan = default, string interval = default, string metricnames = default, string aggregation = default, int? top = default, string orderby = default, string filter = default, Azure.ResourceManager.Monitor.Models.MonitorMetricResultType? resultType = default, string metricnamespace = default, bool? autoAdjustTimegrain = default, bool? validateDimensions = default, string rollupby = default, System.Threading.CancellationToken cancellationToken = default);
static member GetMonitorMetricsAsync : Azure.ResourceManager.Resources.SubscriptionResource * string * string * string * string * string * Nullable<int> * string * string * Nullable<Azure.ResourceManager.Monitor.Models.MonitorMetricResultType> * string * Nullable<bool> * Nullable<bool> * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.Monitor.Models.MonitorMetricsResult>>
<Extension()>
Public Function GetMonitorMetricsAsync (subscriptionResource As SubscriptionResource, region As String, Optional timespan As String = Nothing, Optional interval As String = Nothing, Optional metricnames As String = Nothing, Optional aggregation As String = Nothing, Optional top As Nullable(Of Integer) = Nothing, Optional orderby As String = Nothing, Optional filter As String = Nothing, Optional resultType As Nullable(Of MonitorMetricResultType) = Nothing, Optional metricnamespace As String = Nothing, Optional autoAdjustTimegrain As Nullable(Of Boolean) = Nothing, Optional validateDimensions As Nullable(Of Boolean) = Nothing, Optional rollupby As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of MonitorMetricsResult))
Parameters
- subscriptionResource
- SubscriptionResource
The SubscriptionResource the method will execute against.
- region
- String
The region where the metrics you want reside.
- timespan
- String
The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
- interval
- String
The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value that returns single datapoint for entire time span requested. Examples: PT15M, PT1H, P1D, FULL
- metricnames
- String
The names of the metrics (comma separated) to retrieve. Limit 20 metrics.
- aggregation
- String
The list of aggregation types (comma separated) to retrieve. Examples: average, minimum, maximum
The maximum number of records to retrieve per resource ID in the request. Valid only if filter is specified. Defaults to 10.
- orderby
- String
The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum asc
- filter
- String
The $filter is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’<br>- Invalid variant:<br>$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’<br>- Return all time series where A = a1<br>$filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’.
- resultType
- Nullable<MonitorMetricResultType>
Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
- metricnamespace
- String
Metric namespace where the metrics you want reside.
When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest supported timespan. When set to false, an error is returned for invalid timespan parameters. Defaults to false.
When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid filter parameters. Defaults to true.
- rollupby
- String
Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't want to see separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
subscriptionResource is null.