Metrics - List
Lists the metric values for a resource.
GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metrics?api-version=2018-01-01
GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metrics?timespan={timespan}&interval={interval}&metricnames={metricnames}&aggregation={aggregation}&top={top}&orderby={orderby}&$filter={$filter}&resultType={resultType}&api-version=2018-01-01&metricnamespace={metricnamespace}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
resource
|
path | True |
|
The identifier of the resource. |
timespan
|
query |
|
The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. |
|
interval
|
query |
|
The interval (i.e. timegrain) of the query. |
|
metricnames
|
query |
|
The names of the metrics (comma separated) to retrieve. |
|
aggregation
|
query |
|
The list of aggregation types (comma separated) to retrieve. |
|
top
|
query |
|
The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. |
|
orderby
|
query |
|
The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum asc. |
|
$filter
|
query |
|
The $filter is used to reduce the set of metric data returned. |
|
result
|
query |
Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. |
||
api-version
|
query | True |
|
Client Api Version. |
metricnamespace
|
query |
|
Metric namespace to query metric definitions for. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
Successful request to get the list of metric values. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
Get Metric for data |
Get Metric for metadata |
Get Metric for data
Sample Request
GET https://management.azure.com/subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default/providers/microsoft.insights/metrics?timespan=2017-04-14T02:20:00Z/2017-04-14T04:20:00Z&interval=PT1M&aggregation=Average,count&top=3&orderby=Average asc&$filter=BlobType eq '*'&api-version=2018-01-01&metricnamespace=Microsoft.Storage/storageAccounts/blobServices
Sample Response
{
"cost": 0,
"timespan": "2017-04-14T02:20:00Z/2017-04-14T04:20:00Z",
"interval": "PT1M",
"namespace": "Microsoft.Storage/storageAccounts/blobServices",
"resourceregion": "eastus2",
"value": [
{
"id": "/subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity",
"type": "Microsoft.Insights/metrics",
"name": {
"value": "BlobCapacity",
"localizedValue": "Blob Capacity"
},
"unit": "Bytes",
"timeseries": [
{
"metadatavalues": [
{
"name": {
"value": "blobtype",
"localizedValue": "blobtype"
},
"value": "PageBlob"
}
],
"data": [
{
"timeStamp": "2017-04-14T02:20:00Z",
"count": 0
},
{
"timeStamp": "2017-04-14T02:21:00Z",
"count": 0
},
{
"timeStamp": "2017-04-14T02:22:00Z",
"count": 0
},
{
"timeStamp": "2017-04-14T02:23:00Z",
"count": 1,
"average": 0
}
]
},
{
"metadatavalues": [
{
"name": {
"value": "blobtype",
"localizedValue": "blobtype"
},
"value": "BlockBlob"
}
],
"data": [
{
"timeStamp": "2017-04-14T02:20:00Z",
"count": 0
},
{
"timeStamp": "2017-04-14T02:21:00Z",
"count": 0
},
{
"timeStamp": "2017-04-14T02:22:00Z",
"count": 0
},
{
"timeStamp": "2017-04-14T02:23:00Z",
"count": 1,
"average": 245
}
]
}
]
}
]
}
Get Metric for metadata
Sample Request
GET https://management.azure.com/subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default/providers/microsoft.insights/metrics?timespan=2017-04-14T02:20:00Z/2017-04-14T04:20:00Z&interval=PT1M&aggregation=Average,count&top=3&orderby=Average asc&$filter=BlobType eq '*'&api-version=2018-01-01&metricnamespace=Microsoft.Storage/storageAccounts/blobServices
Sample Response
{
"timespan": "2017-04-14T02:20:00Z/2017-04-14T04:20:00Z",
"namespace": "Microsoft.Storage/storageAccounts/blobServices",
"resourceregion": "eastus2",
"value": [
{
"id": "/subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity",
"type": "Microsoft.Insights/metrics",
"name": {
"value": "BlobCapacity",
"localizedValue": "Blob Capacity"
},
"unit": "Bytes",
"timeseries": [
{
"metadatavalues": [
{
"name": {
"value": "blobtype",
"localizedValue": "blobtype"
},
"value": "BlockBlob"
}
]
},
{
"metadatavalues": [
{
"name": {
"value": "blobtype",
"localizedValue": "blobtype"
},
"value": "PageBlob"
}
]
}
]
}
]
}
Definitions
Error |
Describes the format of Error response. |
Localizable |
The localizable string class. |
Metadata |
Represents a metric metadata value. |
Metric |
The result data of a query. |
Metric |
Represents a metric value. |
Response |
The response to a metrics query. |
Result |
Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. |
Time |
A time series result type. The discriminator value is always TimeSeries in this case. |
Unit |
the unit of the metric. |
ErrorResponse
Describes the format of Error response.
Name | Type | Description |
---|---|---|
code |
|
Error code |
message |
|
Error message indicating why the operation failed. |
LocalizableString
The localizable string class.
Name | Type | Description |
---|---|---|
localizedValue |
|
the locale specific value. |
value |
|
the invariant value. |
MetadataValue
Represents a metric metadata value.
Name | Type | Description |
---|---|---|
name |
the name of the metadata. |
|
value |
|
the value of the metadata. |
Metric
The result data of a query.
Name | Type | Description |
---|---|---|
id |
|
the metric Id. |
name |
the name and the display name of the metric, i.e. it is localizable string. |
|
timeseries |
the time series returned when a data query is performed. |
|
type |
|
the resource type of the metric resource. |
unit |
the unit of the metric. |
MetricValue
Represents a metric value.
Name | Type | Description |
---|---|---|
average |
|
the average value in the time range. |
count |
|
the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. |
maximum |
|
the greatest value in the time range. |
minimum |
|
the least value in the time range. |
timeStamp |
|
the timestamp for the metric value in ISO 8601 format. |
total |
|
the sum of all of the values in the time range. |
Response
The response to a metrics query.
Name | Type | Description |
---|---|---|
cost |
|
The integer value representing the cost of the query, for data case. |
interval |
|
The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. |
namespace |
|
The namespace of the metrics been queried |
resourceregion |
|
The region of the resource been queried for metrics. |
timespan |
|
The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. |
value |
|
the value of the collection. |
ResultType
Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
Name | Type | Description |
---|---|---|
Data |
|
|
Metadata |
|
TimeSeriesElement
A time series result type. The discriminator value is always TimeSeries in this case.
Name | Type | Description |
---|---|---|
data |
An array of data points representing the metric values. This is only returned if a result type of data is specified. |
|
metadatavalues |
the metadata values returned if $filter was specified in the call. |
Unit
the unit of the metric.
Name | Type | Description |
---|---|---|
ByteSeconds |
|
|
Bytes |
|
|
BytesPerSecond |
|
|
Count |
|
|
CountPerSecond |
|
|
MilliSeconds |
|
|
Percent |
|
|
Seconds |
|
|
Unspecified |
|