metrics
Creates, updates, deletes, gets or lists a metrics
resource.
Overview
Name | metrics |
Type | Resource |
Id | azure.monitor.metrics |
Fields
The following fields are returned by SELECT
queries:
- list
Successful request to get the list of metric values.
Name | Datatype | Description |
---|---|---|
id | string | The metric Id. |
name | object | The name and the display name of the metric, i.e. it is localizable string. |
displayDescription | string | Detailed description of this metric. |
errorCode | string | 'Success' or the error details on query failures for this metric. |
errorMessage | string | Error message encountered querying this specific metric. |
timeseries | array | The time series returned when a data query is performed. |
type | string | The resource type of the metric resource. |
unit | string | The unit of the metric. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
list | select | resourceUri | timespan , interval , metricnames , aggregation , top , orderby , $filter , resultType , metricnamespace , AutoAdjustTimegrain , ValidateDimensions , rollupby | Lists the metric values for a resource. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
resourceUri | string | The identifier of the resource. |
$filter | string | 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 b2 $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’ - Invalid variant: $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’ This is invalid because the logical or operator cannot separate two different metadata names. - Return all time series where A = a1, B = b1 and C = c1: $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ - Return all time series where A = a1 $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. |
AutoAdjustTimegrain | boolean | 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. |
ValidateDimensions | boolean | 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. |
aggregation | string | The list of aggregation types (comma separated) to retrieve. |
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. |
metricnamespace | string | Metric namespace to query metric definitions for. |
orderby | string | The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum asc |
resultType | string | Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. |
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. |
timespan | string | The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. |
top | integer (int32) | The maximum number of records to retrieve per resource ID in the request. Valid only if filter is specified. Defaults to 10. |
SELECT
examples
- list
Lists the metric values for a resource.
SELECT
id,
name,
displayDescription,
errorCode,
errorMessage,
timeseries,
type,
unit
FROM azure.monitor.metrics
WHERE resourceUri = '{{ resourceUri }}' -- required
AND timespan = '{{ timespan }}'
AND interval = '{{ interval }}'
AND metricnames = '{{ metricnames }}'
AND aggregation = '{{ aggregation }}'
AND top = '{{ top }}'
AND orderby = '{{ orderby }}'
AND $filter = '{{ $filter }}'
AND resultType = '{{ resultType }}'
AND metricnamespace = '{{ metricnamespace }}'
AND AutoAdjustTimegrain = '{{ AutoAdjustTimegrain }}'
AND ValidateDimensions = '{{ ValidateDimensions }}'
AND rollupby = '{{ rollupby }}'
;