Metrics (Data plane) - Create

Post the metric values for a resource.

POST https://monitoring.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProvider}/{resourceTypeName}/{resourceName}/metrics

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

The azure subscription id

resourceGroupName
path True
  • string

The ARM resource group name

resourceProvider
path True
  • string

The ARM resource provider name

resourceTypeName
path True
  • string

The ARM resource type name

resourceName
path True
  • string

The ARM resource name

Request Header

Name Required Type Description
Content-Type True
  • string

Supports application/json and application/x-ndjson

Content-Length True
  • integer
int32

Content length of the payload

Authorization True
  • string

Authorization token issue for issued for audience "https:\monitoring.azure.com"

Request Body

Name Required Type Description
data True
time True
  • string

Gets or sets Time property (in ISO 8601 format)

Responses

Name Type Description
200 OK

The azure metrics publish succeeded

Other Status Codes

An unexpected error from the server. See response object for the reason

Examples

Post azure metrics for cows sold with related metadata as dimensions

Sample Request

POST https://monitoring.azure.com/subscriptions/b7ac8a0c-fbae-4e29-a0f7-09999b8857a1/resourcegroups/CowsSeller/providers/Microsoft.Storage/storageAccounts/cowssellerstore/metrics
Content-Type: application/json
Content-Length: 783
Authorization: Bearer {AAD JWT token issued for "https:\\monitoring.azure.com\}"
{
  "time": "2018-08-24T 11:02:00-7:00",
  "data": {
    "baseData": {
      "metric": "CowsSold",
      "namespace": "Cows",
      "dimNames": [
        "Breed",
        "Color",
        "Age"
      ],
      "series": [
        {
          "dimValues": [
            "Angus",
            "Blue",
            "5"
          ],
          "min": 5,
          "max": 20,
          "sum": 30,
          "count": 3
        }
      ]
    }
  }
}

Sample Response

{
  "statusCode": 200
}

Definitions

ApiError
ApiFailureResponse
AzureMetricsBaseData
AzureMetricsData
AzureMetricsDocument
AzureMetricsResult
AzureTimeSeriesData

ApiError

Name Type Description
code
  • string

Gets or sets the azure metrics error code

message
  • string

Gets or sets the azure metrics error message

ApiFailureResponse

Name Type Description
error

AzureMetricsBaseData

Name Type Description
dimNames
  • string[]

Gets or sets the list of dimension names (optional)

metric
  • string

Gets or sets the Metric name

namespace
  • string

Gets or sets the Metric namespace

series

Gets or sets the list of time series data for the metric (one per unique dimension combination)

AzureMetricsData

Name Type Description
baseData

AzureMetricsDocument

Name Type Description
data
time
  • string

Gets or sets Time property (in ISO 8601 format)

AzureMetricsResult

Name Type Description
apiFailureResponse
statusCode
  • integer

Http status code response

AzureTimeSeriesData

Name Type Description
count
  • integer

Gets or sets Count value

dimValues
  • string[]

Gets or sets dimension values

max
  • number

Gets or sets Max value

min
  • number

Gets or sets Min value

sum
  • number

Gets or sets Sum value