{ "swagger": "2.0", "info": { "title": "Azure Monitor Metrics Data API", "version": "2024-02-01", "description": "Provides APIs for getting the metric data for Azure resources.", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" } ] }, "schemes": [ "https" ], "host": "management.azure.com", "produces": [ "application/json" ], "consumes": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "description": "Azure Active Directory OAuth2 Flow.", "flow": "implicit", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "scopes": { "user_impersonation": "impersonate your user account" } } }, "tags": [ { "name": "MetricDefinitions" }, { "name": "metricNamespaces" }, { "name": "Metrics" } ], "paths": { "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions": { "get": { "operationId": "MetricDefinitions_List", "tags": [ "MetricDefinitions" ], "description": "Lists the metric definitions for the resource.", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "#/parameters/Azure.ResourceManager.ResourceUriParameter" }, { "name": "metricnamespace", "in": "query", "description": "Metric namespace where the metrics you want reside.", "required": false, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/MetricDefinitionCollection" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Microsoft.Common.CommonErrorResponse" } } }, "x-ms-examples": { "Get Application Insights Metric Definitions without filter": { "$ref": "./examples/GetMetricDefinitionsApplicationInsights.json" }, "Get Metric Definitions without filter": { "$ref": "./examples/GetMetricDefinitions.json" }, "Get StorageCache Metric Definitions with metric class": { "$ref": "./examples/GetMetricDefinitionsMetricClass.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/{resourceUri}/providers/Microsoft.Insights/metrics": { "get": { "operationId": "Metrics_List", "tags": [ "Metrics" ], "description": "**Lists the metric values for a resource**. This API used the [default ARM throttling limits](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/request-limits-and-throttling).", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "#/parameters/Azure.ResourceManager.ResourceUriParameter" }, { "name": "timespan", "in": "query", "description": "The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.", "required": false, "type": "string" }, { "name": "interval", "in": "query", "description": "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.\n*Examples: PT15M, PT1H, P1D, FULL*", "required": false, "type": "string" }, { "name": "metricnames", "in": "query", "description": "The names of the metrics (comma separated) to retrieve. Limit 20 metrics.", "required": false, "type": "string" }, { "name": "aggregation", "in": "query", "description": "The list of aggregation types (comma separated) to retrieve.\n*Examples: average, minimum, maximum*", "required": false, "type": "string" }, { "name": "top", "in": "query", "description": "The maximum number of records to retrieve per resource ID in the request.\nValid only if filter is specified.\nDefaults to 10.", "required": false, "type": "integer", "format": "int32" }, { "name": "orderby", "in": "query", "description": "The aggregation to use for sorting results and the direction of the sort.\nOnly one order can be specified.\n*Examples: sum asc*", "required": false, "type": "string" }, { "name": "$filter", "in": "query", "description": "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 ‘*’**.", "required": false, "type": "string" }, { "name": "resultType", "in": "query", "description": "Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.", "required": false, "type": "string", "enum": [ "Data", "Metadata" ], "x-ms-enum": { "name": "ResultType", "modelAsString": false, "values": [ { "name": "Data", "value": "Data", "description": "Data" }, { "name": "Metadata", "value": "Metadata", "description": "Metadata" } ] } }, { "name": "metricnamespace", "in": "query", "description": "Metric namespace where the metrics you want reside.", "required": false, "type": "string" }, { "name": "AutoAdjustTimegrain", "in": "query", "description": "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.", "required": false, "type": "boolean" }, { "name": "ValidateDimensions", "in": "query", "description": "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.", "required": false, "type": "boolean" }, { "name": "rollupby", "in": "query", "description": "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.", "required": false, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/Response" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Microsoft.Common.CommonErrorResponse" } } }, "x-ms-examples": { "Get Metric for data": { "$ref": "./examples/GetMetric.json" }, "Get Metric for metadata": { "$ref": "./examples/GetMetricMetadata.json" }, "Get Metric with error": { "$ref": "./examples/GetMetricError.json" } } } }, "/{resourceUri}/providers/microsoft.insights/metricNamespaces": { "get": { "operationId": "MetricNamespaces_List", "tags": [ "metricNamespaces" ], "description": "Lists the metric namespaces for the resource.", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "name": "resourceUri", "in": "path", "description": "The identifier of the resource.", "required": true, "type": "string", "x-ms-skip-url-encoding": true }, { "name": "startTime", "in": "query", "description": "The ISO 8601 conform Date start time from which to query for metric namespaces.", "required": false, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/MetricNamespaceCollection" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Microsoft.Common.ErrorResponse" } } }, "x-ms-examples": { "Get Metric Namespaces without filter": { "$ref": "./examples/GetMetricNamespaces.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricDefinitions": { "get": { "operationId": "MetricDefinitions_ListAtSubscriptionScope", "tags": [ "MetricDefinitions" ], "description": "Lists the metric definitions for the subscription.", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" }, { "name": "region", "in": "query", "description": "The region where the metrics you want reside.", "required": true, "type": "string" }, { "name": "metricnamespace", "in": "query", "description": "Metric namespace where the metrics you want reside.", "required": false, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/SubscriptionScopeMetricDefinitionCollection" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Microsoft.Common.ErrorContract" } } }, "x-ms-examples": { "Get Subscription level Metric Definitions without filter": { "$ref": "./examples/GetMultiResourceMetricDefinitions.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics": { "get": { "operationId": "Metrics_ListAtSubscriptionScope", "tags": [ "Metrics" ], "description": "**Lists the metric data for a subscription**. This API used the [default ARM throttling limits](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/request-limits-and-throttling).", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" }, { "name": "region", "in": "query", "description": "The region where the metrics you want reside.", "required": true, "type": "string" }, { "name": "timespan", "in": "query", "description": "The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.", "required": false, "type": "string" }, { "name": "interval", "in": "query", "description": "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.\n*Examples: PT15M, PT1H, P1D, FULL*", "required": false, "type": "string" }, { "name": "metricnames", "in": "query", "description": "The names of the metrics (comma separated) to retrieve. Limit 20 metrics.", "required": false, "type": "string" }, { "name": "aggregation", "in": "query", "description": "The list of aggregation types (comma separated) to retrieve.\n*Examples: average, minimum, maximum*", "required": false, "type": "string" }, { "name": "top", "in": "query", "description": "The maximum number of records to retrieve per resource ID in the request.\nValid only if filter is specified.\nDefaults to 10.", "required": false, "type": "integer", "format": "int32" }, { "name": "orderby", "in": "query", "description": "The aggregation to use for sorting results and the direction of the sort.\nOnly one order can be specified.\n*Examples: sum asc*", "required": false, "type": "string" }, { "name": "$filter", "in": "query", "description": "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 ‘*’**.", "required": false, "type": "string" }, { "name": "resultType", "in": "query", "description": "Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.", "required": false, "type": "string", "enum": [ "Data", "Metadata" ], "x-ms-enum": { "name": "MetricResultType", "modelAsString": true, "values": [ { "name": "Data", "value": "Data", "description": "Data" }, { "name": "Metadata", "value": "Metadata", "description": "Metadata" } ] } }, { "name": "metricnamespace", "in": "query", "description": "Metric namespace where the metrics you want reside.", "required": false, "type": "string" }, { "name": "AutoAdjustTimegrain", "in": "query", "description": "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.", "required": false, "type": "boolean" }, { "name": "ValidateDimensions", "in": "query", "description": "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.", "required": false, "type": "boolean" }, { "name": "rollupby", "in": "query", "description": "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.", "required": false, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/Response" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Microsoft.Common.ErrorContract" } } }, "x-ms-examples": { "Get subscription level metric data": { "$ref": "./examples/GetMultiResourceMetric.json" }, "Get subscription level metric metadata": { "$ref": "./examples/GetMultiResourceMetricMetadata.json" } } }, "post": { "operationId": "Metrics_ListAtSubscriptionScopePost", "tags": [ "Metrics" ], "description": "**Lists the metric data for a subscription**. Parameters can be specified on either query params or the body. This API used the [default ARM throttling limits](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/request-limits-and-throttling).", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" }, { "name": "region", "in": "query", "description": "The region where the metrics you want reside.", "required": true, "type": "string" }, { "name": "timespan", "in": "query", "description": "The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.", "required": false, "type": "string" }, { "name": "interval", "in": "query", "description": "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.\n*Examples: PT15M, PT1H, P1D, FULL*", "required": false, "type": "string" }, { "name": "metricnames", "in": "query", "description": "The names of the metrics (comma separated) to retrieve. Limit 20 metrics.", "required": false, "type": "string" }, { "name": "aggregation", "in": "query", "description": "The list of aggregation types (comma separated) to retrieve.\n*Examples: average, minimum, maximum*", "required": false, "type": "string" }, { "name": "top", "in": "query", "description": "The maximum number of records to retrieve per resource ID in the request.\nValid only if filter is specified.\nDefaults to 10.", "required": false, "type": "integer", "format": "int32" }, { "name": "orderby", "in": "query", "description": "The aggregation to use for sorting results and the direction of the sort.\nOnly one order can be specified.\n*Examples: sum asc*", "required": false, "type": "string" }, { "name": "$filter", "in": "query", "description": "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 ‘*’**.", "required": false, "type": "string" }, { "name": "resultType", "in": "query", "description": "Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.", "required": false, "type": "string", "enum": [ "Data", "Metadata" ], "x-ms-enum": { "name": "MetricResultType", "modelAsString": true, "values": [ { "name": "Data", "value": "Data", "description": "Data" }, { "name": "Metadata", "value": "Metadata", "description": "Metadata" } ] } }, { "name": "metricnamespace", "in": "query", "description": "Metric namespace where the metrics you want reside.", "required": false, "type": "string" }, { "name": "AutoAdjustTimegrain", "in": "query", "description": "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.", "required": false, "type": "boolean" }, { "name": "ValidateDimensions", "in": "query", "description": "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.", "required": false, "type": "boolean" }, { "name": "rollupby", "in": "query", "description": "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.", "required": false, "type": "string" }, { "name": "body", "in": "body", "description": "The request body", "required": false, "schema": { "$ref": "#/definitions/SubscriptionScopeMetricsRequestBodyParameters" } } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/Response" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Microsoft.Common.ErrorContract" } } }, "x-ms-examples": { "Post request for subscription level metric data": { "$ref": "./examples/PostMultiResourceMetric.json" }, "Post request for subscription level metric data using body params": { "$ref": "./examples/PostMultiResourceMetricBody.json" }, "Post request for subscription level metric metadata": { "$ref": "./examples/PostMultiResourceMetricMetadata.json" } } } } }, "definitions": { "AggregationType": { "type": "string", "description": "The aggregation type of the metric.", "enum": [ "None", "Average", "Count", "Minimum", "Maximum", "Total" ], "x-ms-enum": { "name": "AggregationType", "modelAsString": false, "values": [ { "name": "None", "value": "None", "description": "None" }, { "name": "Average", "value": "Average", "description": "Average" }, { "name": "Count", "value": "Count", "description": "Count" }, { "name": "Minimum", "value": "Minimum", "description": "Minimum" }, { "name": "Maximum", "value": "Maximum", "description": "Maximum" }, { "name": "Total", "value": "Total", "description": "Total" } ] } }, "MetadataValue": { "type": "object", "description": "Represents a metric metadata value.", "properties": { "name": { "$ref": "#/definitions/Microsoft.Common.LocalizableString", "description": "The name of the metadata." }, "value": { "type": "string", "description": "The value of the metadata." } } }, "Metric": { "type": "object", "description": "The result data of a query.", "properties": { "id": { "type": "string", "description": "The metric Id." }, "type": { "type": "string", "description": "The resource type of the metric resource." }, "name": { "$ref": "#/definitions/Microsoft.Common.LocalizableString", "description": "The name and the display name of the metric, i.e. it is localizable string." }, "displayDescription": { "type": "string", "description": "Detailed description of this metric." }, "errorCode": { "type": "string", "description": "'Success' or the error details on query failures for this metric." }, "errorMessage": { "type": "string", "description": "Error message encountered querying this specific metric." }, "unit": { "$ref": "#/definitions/MetricUnit", "description": "The unit of the metric." }, "timeseries": { "type": "array", "description": "The time series returned when a data query is performed.", "items": { "$ref": "#/definitions/TimeSeriesElement" }, "x-ms-identifiers": [] } }, "required": [ "id", "type", "name", "unit", "timeseries" ] }, "MetricAggregationType": { "type": "string", "description": "The aggregation type of the metric.", "enum": [ "None", "Average", "Count", "Minimum", "Maximum", "Total" ], "x-ms-enum": { "name": "MetricAggregationType", "modelAsString": true, "values": [ { "name": "None", "value": "None", "description": "None" }, { "name": "Average", "value": "Average", "description": "Average" }, { "name": "Count", "value": "Count", "description": "Count" }, { "name": "Minimum", "value": "Minimum", "description": "Minimum" }, { "name": "Maximum", "value": "Maximum", "description": "Maximum" }, { "name": "Total", "value": "Total", "description": "Total" } ] } }, "MetricAvailability": { "type": "object", "description": "Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that time grain.", "properties": { "timeGrain": { "type": "string", "format": "duration", "description": "The time grain specifies a supported aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc." }, "retention": { "type": "string", "format": "duration", "description": "The retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc." } } }, "MetricClass": { "type": "string", "description": "The class of the metric.", "enum": [ "Availability", "Transactions", "Errors", "Latency", "Saturation" ], "x-ms-enum": { "name": "MetricClass", "modelAsString": true, "values": [ { "name": "Availability", "value": "Availability", "description": "Availability" }, { "name": "Transactions", "value": "Transactions", "description": "Transactions" }, { "name": "Errors", "value": "Errors", "description": "Errors" }, { "name": "Latency", "value": "Latency", "description": "Latency" }, { "name": "Saturation", "value": "Saturation", "description": "Saturation" } ] } }, "MetricDefinition": { "type": "object", "description": "Metric definition class specifies the metadata for a metric.", "properties": { "isDimensionRequired": { "type": "boolean", "description": "Flag to indicate whether the dimension is required." }, "resourceId": { "type": "string", "description": "The resource identifier of the resource that emitted the metric." }, "namespace": { "type": "string", "description": "The namespace the metric belongs to." }, "name": { "$ref": "#/definitions/Microsoft.Common.LocalizableString", "description": "The name and the display name of the metric, i.e. it is a localizable string." }, "displayDescription": { "type": "string", "description": "Detailed description of this metric." }, "category": { "type": "string", "description": "Custom category name for this metric." }, "metricClass": { "$ref": "#/definitions/MetricClass", "description": "The class of the metric." }, "unit": { "$ref": "#/definitions/MetricUnit", "description": "The unit of the metric." }, "primaryAggregationType": { "$ref": "#/definitions/AggregationType", "description": "The primary aggregation type value defining how to use the values for display." }, "supportedAggregationTypes": { "type": "array", "description": "The collection of what aggregation types are supported.", "items": { "$ref": "#/definitions/AggregationType" } }, "metricAvailabilities": { "type": "array", "description": "The collection of what aggregation intervals are available to be queried.", "items": { "$ref": "#/definitions/MetricAvailability" }, "x-ms-identifiers": [ "timeGrain" ] }, "id": { "type": "string", "description": "The resource identifier of the metric definition." }, "dimensions": { "type": "array", "description": "The name and the display name of the dimension, i.e. it is a localizable string.", "items": { "$ref": "#/definitions/Microsoft.Common.LocalizableString" }, "x-ms-identifiers": [ "value" ] } } }, "MetricDefinitionCollection": { "type": "object", "description": "Represents collection of metric definitions.", "properties": { "value": { "type": "array", "description": "The values for the metric definitions.", "items": { "$ref": "#/definitions/MetricDefinition" } }, "nextLink": { "type": "string", "description": "The link to the next page of items" } }, "required": [ "value" ] }, "MetricNamespace": { "type": "object", "description": "Metric namespace class specifies the metadata for a metric namespace.", "properties": { "id": { "type": "string", "description": "The ID of the metric namespace." }, "type": { "type": "string", "description": "The type of the namespace." }, "name": { "type": "string", "description": "The escaped name of the namespace." }, "classification": { "$ref": "#/definitions/NamespaceClassification", "description": "Kind of namespace" }, "properties": { "$ref": "#/definitions/MetricNamespaceName", "description": "Properties which include the fully qualified namespace name." } } }, "MetricNamespaceCollection": { "type": "object", "description": "Represents collection of metric namespaces.", "properties": { "value": { "type": "array", "description": "The values for the metric namespaces.", "items": { "$ref": "#/definitions/MetricNamespace" } }, "nextLink": { "type": "string", "description": "The link to the next page of items" } }, "required": [ "value" ] }, "MetricNamespaceName": { "type": "object", "description": "The fully qualified metric namespace name.", "properties": { "metricNamespaceName": { "type": "string", "description": "The metric namespace name." } } }, "MetricResultType": { "type": "string", "description": "Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.", "enum": [ "Data", "Metadata" ], "x-ms-enum": { "name": "MetricResultType", "modelAsString": true, "values": [ { "name": "Data", "value": "Data", "description": "Data" }, { "name": "Metadata", "value": "Metadata", "description": "Metadata" } ] } }, "MetricUnit": { "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": "MetricUnit", "modelAsString": true, "values": [ { "name": "Count", "value": "Count", "description": "Unit of raw quantity." }, { "name": "Bytes", "value": "Bytes", "description": "Unit of memory in bytes." }, { "name": "Seconds", "value": "Seconds", "description": "Unit of time in seconds." }, { "name": "CountPerSecond", "value": "CountPerSecond", "description": "Rate unit of raw quantity per second." }, { "name": "BytesPerSecond", "value": "BytesPerSecond", "description": "Rate unit of memory in bytes per second." }, { "name": "Percent", "value": "Percent", "description": "Percentage unit." }, { "name": "MilliSeconds", "value": "MilliSeconds", "description": "Unit of time in 1/1000th of a second." }, { "name": "ByteSeconds", "value": "ByteSeconds", "description": "Unit of data transfer or storage. It is the size of the data in bytes multiplied by the time it takes to transfer or store the data in seconds." }, { "name": "Unspecified", "value": "Unspecified", "description": "No specified unit." }, { "name": "Cores", "value": "Cores", "description": "Unit of processing power." }, { "name": "MilliCores", "value": "MilliCores", "description": "Unit of processing power in 1/1000th of a CPU core." }, { "name": "NanoCores", "value": "NanoCores", "description": "Unit of processing power in one billionth of a CPU core." }, { "name": "BitsPerSecond", "value": "BitsPerSecond", "description": "Rate unit of binary digits per second." } ] } }, "MetricValue": { "type": "object", "description": "Represents a metric value.", "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": "number", "format": "double", "description": "The number of samples in the time range. Can be used to determine the number of values that contributed to the average value." } }, "required": [ "timeStamp" ] }, "Microsoft.Common.CommonErrorResponse": { "type": "object", "description": "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)", "properties": { "code": { "type": "string", "description": "Error code", "readOnly": true }, "message": { "type": "string", "description": "Error message indicating why the operation failed.", "readOnly": true }, "target": { "type": "string", "description": "The error target.", "readOnly": true }, "details": { "type": "array", "description": "The error details.", "items": { "$ref": "#/definitions/Microsoft.Common.CommonErrorResponse" }, "readOnly": true, "x-ms-identifiers": [ "message", "target" ] }, "additionalInfo": { "type": "array", "description": "The error additional info.", "items": { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorAdditionalInfo" }, "readOnly": true, "x-ms-identifiers": [] } } }, "Microsoft.Common.ErrorContract": { "type": "object", "description": "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)", "properties": { "error": { "$ref": "#/definitions/Microsoft.Common.CommonErrorResponse", "description": "The error object." } } }, "Microsoft.Common.ErrorResponse": { "type": "object", "description": "Describes the format of Error response.", "properties": { "code": { "type": "string", "description": "Error code" }, "message": { "type": "string", "description": "Error message indicating why the operation failed." } } }, "Microsoft.Common.LocalizableString": { "type": "object", "description": "The localizable string class.", "properties": { "value": { "type": "string", "description": "the invariant value." }, "localizedValue": { "type": "string", "description": "the locale specific value." } }, "required": [ "value" ] }, "NamespaceClassification": { "type": "string", "description": "Kind of namespace", "enum": [ "Platform", "Custom", "Qos" ], "x-ms-enum": { "name": "NamespaceClassification", "modelAsString": true, "values": [ { "name": "Platform", "value": "Platform", "description": "Platform" }, { "name": "Custom", "value": "Custom", "description": "Custom" }, { "name": "Qos", "value": "Qos", "description": "Qos" } ] } }, "Response": { "type": "object", "description": "The response to a metrics query.", "properties": { "cost": { "type": "integer", "format": "int32", "description": "The integer value representing the relative cost of the query.", "minimum": 0 }, "timespan": { "type": "string", "description": "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." }, "interval": { "type": "string", "description": "The interval (window size) for which the metric data was returned in ISO 8601 duration format with a special case for 'FULL' value that returns single datapoint for entire time span requested (*Examples: PT15M, PT1H, P1D, FULL*).\nThis may be adjusted and different from what was originally requested if AutoAdjustTimegrain=true is specified. This is not present if a metadata request was made." }, "namespace": { "type": "string", "description": "The namespace of the metrics being queried" }, "resourceregion": { "type": "string", "description": "The region of the resource being queried for metrics." }, "value": { "type": "array", "description": "The value of the collection.", "items": { "$ref": "#/definitions/Metric" } } }, "required": [ "timespan", "value" ] }, "SubscriptionScopeMetricDefinition": { "type": "object", "description": "Metric definition class specifies the metadata for a metric.", "properties": { "isDimensionRequired": { "type": "boolean", "description": "Flag to indicate whether the dimension is required." }, "resourceId": { "type": "string", "description": "The resource identifier of the resource that emitted the metric." }, "namespace": { "type": "string", "description": "The namespace the metric belongs to." }, "name": { "$ref": "#/definitions/Microsoft.Common.LocalizableString", "description": "The name and the display name of the metric, i.e. it is a localizable string." }, "displayDescription": { "type": "string", "description": "Detailed description of this metric." }, "category": { "type": "string", "description": "Custom category name for this metric." }, "metricClass": { "$ref": "#/definitions/MetricClass", "description": "The class of the metric." }, "unit": { "$ref": "#/definitions/MetricUnit", "description": "The unit of the metric." }, "primaryAggregationType": { "$ref": "#/definitions/MetricAggregationType", "description": "The primary aggregation type value defining how to use the values for display." }, "supportedAggregationTypes": { "type": "array", "description": "The collection of what aggregation types are supported.", "items": { "$ref": "#/definitions/MetricAggregationType" } }, "metricAvailabilities": { "type": "array", "description": "The collection of what aggregation intervals are available to be queried.", "items": { "$ref": "#/definitions/MetricAvailability" }, "x-ms-identifiers": [ "timeGrain" ] }, "id": { "type": "string", "description": "The resource identifier of the metric definition." }, "dimensions": { "type": "array", "description": "The name and the display name of the dimension, i.e. it is a localizable string.", "items": { "$ref": "#/definitions/Microsoft.Common.LocalizableString" }, "x-ms-identifiers": [ "value" ] } } }, "SubscriptionScopeMetricDefinitionCollection": { "type": "object", "description": "Represents collection of metric definitions.", "properties": { "value": { "type": "array", "description": "The values for the metric definitions.", "items": { "$ref": "#/definitions/SubscriptionScopeMetricDefinition" } }, "nextLink": { "type": "string", "description": "The link to the next page of items" } }, "required": [ "value" ] }, "SubscriptionScopeMetricsRequestBodyParameters": { "type": "object", "description": "Query parameters can also be specified in the body, specifying the same parameter in both the body and query parameters will result in an error.", "properties": { "timespan": { "type": "string", "description": "The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'." }, "interval": { "type": "string", "description": "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.\n*Examples: PT15M, PT1H, P1D, FULL*" }, "metricNames": { "type": "string", "description": "The names of the metrics (comma separated) to retrieve." }, "aggregation": { "type": "string", "description": "The list of aggregation types (comma separated) to retrieve." }, "filter": { "type": "string", "description": "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 ‘*’**." }, "top": { "type": "integer", "format": "int32", "description": "The maximum number of records to retrieve.\nValid only if $filter is specified.\nDefaults to 10." }, "orderBy": { "type": "string", "description": "The aggregation to use for sorting results and the direction of the sort.\nOnly one order can be specified.\nExamples: sum asc." }, "rollUpBy": { "type": "string", "description": "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." }, "resultType": { "$ref": "#/definitions/MetricResultType", "description": "Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details." }, "metricNamespace": { "type": "string", "description": "Metric namespace where the metrics you want reside." }, "autoAdjustTimegrain": { "type": "boolean", "description": "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": { "type": "boolean", "description": "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." } } }, "TimeSeriesElement": { "type": "object", "description": "A time series result type. The discriminator value is always TimeSeries in this case.", "properties": { "metadatavalues": { "type": "array", "description": "The metadata values returned if $filter was specified in the call.", "items": { "$ref": "#/definitions/MetadataValue" }, "x-ms-identifiers": [ "name" ] }, "data": { "type": "array", "description": "An array of data points representing the metric values. This is only returned if a result type of data is specified.", "items": { "$ref": "#/definitions/MetricValue" }, "x-ms-identifiers": [ "timeStamp" ] } } } }, "parameters": { "Azure.ResourceManager.ResourceUriParameter": { "name": "resourceUri", "in": "path", "description": "The fully qualified Azure Resource manager identifier of the resource.", "required": true, "type": "string", "x-ms-parameter-location": "method", "x-ms-skip-url-encoding": true } } }