swagger: '2.0' info: title: Microsoft Azure MonitorClient version: '2016-09-01' host: management.azure.com schemes: - https consumes: - application/json produces: - application/json security: - azure_auth: - user_impersonation securityDefinitions: azure_auth: type: oauth2 authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize flow: implicit description: Azure Active Directory OAuth2 Flow scopes: user_impersonation: impersonate your user account paths: /{resourceUri}/providers/microsoft.insights/metrics: get: tags: - Metrics operationId: microsoftAzureMetricsList description: Lists the metric values for a resource. parameters: - $ref: >- ./serviceDiagnosticsSettings_API.json#/parameters/ResourceUriParameter - name: $filter in: query type: string description: >- Reduces the set of data collected.
The filter is optional. If present it must contain a list of metric names to retrieve of the form: *(name.value eq 'metricName' [or name.value eq 'metricName' or ...])*. Optionally, the filter can contain conditions for the following attributes *aggregationType*, *startTime*, *endTime*, and *timeGrain* of the form *attributeName operator value*. Where operator is one of *ne*, *eq*, *gt*, *lt*.
Several conditions can be combined with parentheses and logical operators, e.g: *and*, *or*.
Some example filter expressions are:
- $filter=(name.value eq 'RunsSucceeded') and aggregationType eq 'Total' and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1M',
- $filter=(name.value eq 'RunsSucceeded') and (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1H',
- $filter=(name.value eq 'ActionsCompleted' or name.value eq 'RunsSucceeded') and (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1M'.

**NOTE**: When a metrics query comes in with multiple metrics, but with no aggregation types defined, the service will pick the Primary aggregation type of the first metrics to be used as the default aggregation type for all the metrics. required: false - $ref: >- ../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter responses: '200': description: Successful request to get the list of metric values schema: $ref: '#/definitions/MetricCollection' examples: application/json: value: - data: - timeStamp: '2016-11-23T19:14:00Z' total: 1 - timeStamp: '2016-11-23T19:15:00Z' - timeStamp: '2016-11-23T19:16:00Z' - timeStamp: '2016-11-23T19:17:00Z' - timeStamp: '2016-11-23T19:18:00Z' - timeStamp: '2016-11-23T19:19:00Z' total: 1 - timeStamp: '2016-11-23T19:20:00Z' - timeStamp: '2016-11-23T19:21:00Z' - timeStamp: '2016-11-23T19:22:00Z' - timeStamp: '2016-11-23T19:23:00Z' - timeStamp: '2016-11-23T19:24:00Z' total: 1 id: >- /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/andy0802australia/providers/Microsoft.Logic/workflows/andy0803australia/providers/microsoft.insights/metrics/RunsStarted name: value: RunsStarted localizedValue: Runs Started type: Microsoft.Insights/metrics unit: Count default: description: Error response describing why the operation failed. schema: $ref: '#/definitions/ErrorResponse' x-ms-pageable: nextLinkName: x-ms-odata: '#/definitions/Metric' x-ms-examples: Get Metric without filter: $ref: ./examples/GetMetric.json Get Metric with filter: $ref: ./examples/GetMetricFiltered.json summary: Microsoft Azure Get Resourceuri Providers Microsoft Insights Metrics definitions: LocalizableString: required: - value properties: value: type: string description: the invariant value. localizedValue: type: string description: the locale specific value. description: The localizable string class. Unit: type: string description: The unit of the metric. enum: - Count - Bytes - Seconds - CountPerSecond - BytesPerSecond - Percent - MilliSeconds - ByteSeconds - Unspecified - Cores - MilliCores - NanoCores - BitsPerSecond x-ms-enum: name: Unit modelAsString: false MetricValue: required: - timeStamp properties: timeStamp: type: string format: date-time description: the timestamp for the metric value in ISO 8601 format. average: type: number format: double description: the average value in the time range. minimum: type: number format: double description: the least value in the time range. maximum: type: number format: double description: the greatest value in the time range. total: type: number format: double description: the sum of all of the values in the time range. count: type: integer format: int64 description: >- the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. description: Represents a metric value. Metric: required: - name - unit - data properties: id: type: string description: the id, resourceId, of the metric. type: type: string description: the resource type of the metric resource. name: $ref: '#/definitions/LocalizableString' description: >- the name and the display name of the metric, i.e. it is localizable string. unit: $ref: '#/definitions/Unit' description: the unit of the metric. data: type: array items: $ref: '#/definitions/MetricValue' description: Array of data points representing the metric values. description: A set of metric values in a time range. MetricCollection: properties: value: type: array items: $ref: '#/definitions/Metric' description: the value of the collection. required: - value description: The collection of metric value sets. ErrorResponse: description: Describes the format of Error response. type: object properties: code: description: Error code type: string message: description: Error message indicating why the operation failed. type: string tags: - name: Metrics