Database - List Metrics

Retrieves the metrics determined by the given filter for the given database account and database.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics?api-version=2026-03-15&$filter={$filter}

URI Parameters

Name In Required Type Description
accountName
path True

string

minLength: 3
maxLength: 50
pattern: ^[a-z0-9]+(-[a-z0-9]+)*

Cosmos DB database account name.

databaseRid
path True

string

Cosmos DB database rid.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

$filter
query True

string

An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Responses

Name Type Description
200 OK

MetricListResult

Azure operation completed successfully.

Other Status Codes

ErrorResponse

An unexpected error response.

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

CosmosDBDatabaseGetMetrics

Sample request

GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/databases/rid/metrics?api-version=2026-03-15&$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z

Sample response

{
  "value": [
    {
      "timeGrain": "PT5M",
      "startTime": "2017-11-19T23:53:55.2780000Z",
      "endTime": "2017-11-20T00:13:55.2780000Z",
      "unit": "Count",
      "metricValues": [
        {
          "timestamp": "2017-11-19T23:53:55.2780000Z",
          "total": 0,
          "_count": 0,
          "average": 0
        },
        {
          "timestamp": "2017-11-19T23:58:55.2780000Z",
          "total": 0,
          "_count": 0,
          "average": 0
        },
        {
          "timestamp": "2017-11-20T00:03:55.2780000Z",
          "total": 0,
          "_count": 0,
          "average": 0
        },
        {
          "timestamp": "2017-11-20T00:08:55.2780000Z",
          "total": 0,
          "_count": 0,
          "average": 0
        }
      ],
      "name": {
        "value": "Total Requests",
        "localizedValue": "Total Requests"
      }
    }
  ]
}

Definitions

Name Description
ErrorResponse

Error Response.

Metric

Metric data

MetricListResult

The response to a list metrics request.

MetricName

A metric name.

MetricValue

Represents metrics values.

UnitType

The unit of the metric.

ErrorResponse

Error Response.

Name Type Description
code

string

Error code.

message

string

Error message indicating why the operation failed.

Metric

Metric data

Name Type Description
endTime

string (date-time)

The end time for the metric (ISO-8601 format).

metricValues

MetricValue[]

The metric values for the specified time window and timestep.

name

MetricName

The name information for the metric.

startTime

string (date-time)

The start time for the metric (ISO-8601 format).

timeGrain

string

The time grain to be used to summarize the metric values.

unit

UnitType

The unit of the metric.

MetricListResult

The response to a list metrics request.

Name Type Description
nextLink

string

value

Metric[]

The list of metrics for the account.

MetricName

A metric name.

Name Type Description
localizedValue

string

The friendly name of the metric.

value

string

The name of the metric.

MetricValue

Represents metrics values.

Name Type Description
_count

integer (int32)

The number of values for the metric.

average

number (double)

The average value of the metric.

maximum

number (double)

The max value of the metric.

minimum

number (double)

The min value of the metric.

timestamp

string (date-time)

The metric timestamp (ISO-8601 format).

total

number (double)

The total value of the metric.

UnitType

The unit of the metric.

Value Description
Count
Bytes
Seconds
Percent
CountPerSecond
BytesPerSecond
Milliseconds