Retrieve metric data

Gets metric values for multiple metrics

HTTP request

POST /v1/apps/{app-id}/metrics

Security

Type Description
API key

Pass the API key via an X-Api-Key custom header or an api_key query parameter. [More info about authorization]

Basic Auth

Use the API key as either username or password with normal HTTP basic auth [More info about authorization]

Azure AAD Auth

Pass the AAD auth token in the 'Authorization' header. [More info about authorization]

URL parameters

Name Value Description
app-id string (uuid)

ID of the application. This is Application ID from the API Access settings blade in the Azure portal.

Body

The batched metrics query.

{
  "description": "Metrics request body",
  "type": "array",
  "items": {
    "description": "A metric request",
    "properties": {
      "id": {
        "type": "string",
        "description": "An identifier for this query.  Must be unique within the post body of the request.  This identifier will be the 'id' property of the response object representing this query."
      },
      "parameters": {
        "type": "object",
        "description": "The parameters for a single metrics query",
        "properties": {
          "metricId": {
            "description": "ID of the metric. This is either a standard AI metric, or an application-specific custom metric.",
            "type": "string",
            "enum": [
              "requests/count",
              "requests/duration",
              "requests/failed",
              "users/count",
              "users/authenticated",
              "pageViews/count",
              "pageViews/duration",
              "client/processingDuration",
              "client/receiveDuration",
              "client/networkDuration",
              "client/sendDuration",
              "client/totalDuration",
              "dependencies/count",
              "dependencies/failed",
              "dependencies/duration",
              "exceptions/count",
              "exceptions/browser",
              "exceptions/server",
              "sessions/count",
              "performanceCounters/requestExecutionTime",
              "performanceCounters/requestsPerSecond",
              "performanceCounters/requestsInQueue",
              "performanceCounters/memoryAvailableBytes",
              "performanceCounters/exceptionsPerSecond",
              "performanceCounters/processCpuPercentage",
              "performanceCounters/processIOBytesPerSecond",
              "performanceCounters/processPrivateBytes",
              "performanceCounters/processorCpuPercentage",
              "availabilityResults/availabilityPercentage",
              "availabilityResults/duration",
              "billing/telemetryCount",
              "customEvents/count"
            ]
          },
          "timespan": {
            "description": "The timespan over which to retrieve metric values. This is an ISO8601 time period value. If timespan is omitted, a default time range of `PT12H` (\"last 12 hours\") is used. The actual timespan that is queried may be adjusted by the server based. In all cases, the actual time span used for the query is included in the response.",
            "type": "string",
            "default": "PT12H",
            "format": "date-time-period"
          },
          "aggregation": {
            "description": "The aggregation to use when computing the metric values. To retrieve more than one aggregation at a time, separate them with a comma. If no aggregation is specified, then the default aggregation for the metric is used.",
            "type": "array",
            "collectionFormat": "csv",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "min",
                "max",
                "avg",
                "sum"
              ]
            }
          },
          "interval": {
            "description": "The time interval to use when retrieving metric values. This is an ISO8601 duration. If interval is omitted, the metric value is aggregated across the entire timespan. If interval is supplied, the server may adjust the interval to a more appropriate size based on the timespan used for the query. In all cases, the actual interval used for the query is included in the response.",
            "type": "string",
            "format": "time-duration"
          },
          "segment": {
            "description": "The name of the dimension to segment the metric values by. This dimension must be applicable to the metric you are retrieving. To segment by more than one dimension at a time, separate them with a comma (,). In this case, the metric data will be segmented in the order the dimensions are listed in the parameter.",
            "type": "array",
            "minItems": 1,
            "collectionFormat": "csv",
            "items": {
              "type": "string",
              "enum": [
                "applicationBuild",
                "applicationVersion",
                "authenticatedOrAnonymousTraffic",
                "browser",
                "browserVersion",
                "city",
                "cloudRoleName",
                "cloudServiceName",
                "continent",
                "countryOrRegion",
                "deploymentId",
                "deploymentUnit",
                "deviceType",
                "environment",
                "hostingLocation",
                "instanceName"
              ]
            }
          },
          "top": {
            "description": "The number of segments to return.  This value is only valid when segment is specified.",
            "type": "integer",
            "format": "int32"
          },
          "orderby": {
            "description": "The aggregation function and direction to sort the segments by.  This value is only valid when segment is specified.",
            "type": "string"
          },
          "filter": {
            "description": "An expression used to filter the results.  This value should be a valid OData filter expression where the keys of each clause should be applicable dimensions for the metric you are retrieving.",
            "type": "string"
          }
        },
        "required": [
          "metricId"
        ]
      }
    },
    "required": [
      "id",
      "parameters"
    ]
  }
}
[
  {
    "id": "Average request duration summary (last 12 hours)",
    "parameters": {
      "metricId": "requests/duration",
      "aggregation": "avg",
      "timespan": "PT12H"
    }
  },
  {
    "id": "Average request duration timeline (last 12 hours, 1 hour intervals)",
    "parameters": {
      "metricId": "requests/duration",
      "aggregation": "avg",
      "timespan": "PT12H",
      "interval": "PT1H"
    }
  }
]
[
  {
    "id": "Sum of browser exceptions segmented by operation name",
    "parameters": {
      "metricId": "exceptions/browser",
      "aggregation": "sum",
      "timespan": "PT12H",
      "segment": "operation/name"
    }
  }
]

Responses

Status Code Description
200 Successful response
402 Payment required (the app is not in a required pricing tier)
404 Invalid app-id
429 Too many requests
503 Service unavailable