---
title: Azure Cosmos DB (Document DB) monitoring integration
source: https://docs.newrelic.com/docs/infrastructure/microsoft-azure-integrations/azure-integrations-list/azure-cosmos-db-document-db-monitoring-integration
---

[New Relic infrastructure monitoring](https://docs.newrelic.com/docs/infrastructure) provides an integration for [Microsoft Azure's Cosmos DB](https://docs.microsoft.com/en-us/azure/cosmos-db/introduction) service that reports your Cosmos DB metrics and other data to New Relic. This document explains how to activate the Cosmos DB integration and describes the data that can be captured.

## Features

New Relic gathers both database data and collection billing data from your Azure Cosmos DB service. You can monitor and alert on your Azure Cosmos DB data from New Relic, and you can [create custom queries and custom chart dashboards](https://docs.newrelic.com/docs/using-new-relic/data/understand-data/query-new-relic-data).

## Activate integration [#activate]

To enable this integration follow standard procedures to [activate your Azure service in New Relic](https://docs.newrelic.com/docs/infrastructure/microsoft-azure-integrations/getting-started/activate-azure-integrations).

The Cosmos DB integration requires you to create an additional role and permission to fetch database and collection data:

1.  Go to the **Azure Portal** and open a shell by selecting the terminal 
    icon.
2.  Add the following command:

    ```sh
    az role definition create --role-definition '{
        "Name": "NewRelic Integrations",
        "Actions": [
            "*/read",
            "Microsoft.DocumentDB/databaseAccounts/listKeys/action"
        ],
        "NotActions": [],
        "AssignableScopes": [
            "/subscriptions/YOUR_INSERT_SUBSCRIPTION_ID"
        ],
        "Description": "Read Only for NewRelic Integrations",
        "IsCustom": "true"
    }'
    ```
3.  From **Services > Subscriptions**, select the subscription, go to **Access control (IAM)**, and then select 
    **Add**.
4.  In the **Role** search box, add the name of the newly created role definition (for example, `NewRelic Integrations`).
5.  In the **Select** search box, add the name of the New Relic integration application, and select it.
6.  Ensure that the application is added to the **Selected members** list, then **Save**.

## Configuration and polling [#polling]

You can change the polling frequency and filter data using [configuration options](https://docs.newrelic.com/docs/integrations/new-relic-integrations/getting-started/configure-polling-frequency-data-collection-cloud-integrations).

Default [polling](https://docs.newrelic.com/docs/infrastructure/microsoft-azure-integrations/azure-integrations-list/azure-polling-intervals-infrastructure-integrations) information for the Cosmos DB integration:

-   Polling interval: 5 minutes
-   Resolution: 1 minute or 5 minutes, varies by metric. For resolution information on a specific metric, see [Microsoft Azure's documentation about support metrics](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftdocumentdbdatabaseaccounts).

## View and query data [#find-data]

To view your integration data, go to **[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > Infrastructure > Azure** and select the Cosmos DB Integration.

You can [query and explore your data](https://docs.newrelic.com/docs/using-new-relic/data/understand-data/query-new-relic-data) using the following [event types](https://docs.newrelic.com/docs/data-apis/understand-data/new-relic-data-types/#event-data):

| Entity     | Event Type                      | Provider                  |
| ---------- | ------------------------------- | ------------------------- |
| Account    | `AzureCosmosDbAccountSample`    | `AzureCosmosDbAccount`    |
| Database   | `AzureCosmosDbDatabaseSample`   | `AzureCosmosDbDatabase`   |
| Collection | `AzureCosmosDbCollectionSample` | `AzureCosmosDbCollection` |

For more on how to find and use data, see [Understand and use integration data](https://docs.newrelic.com/docs/infrastructure/integrations/find-use-infrastructure-integration-data).

## Metric data

> #### ⚠️ IMPORTANT
>
> -   For information on deprecated Cosmos DB events or metrics, refer to [Azure Cosmos DB integration (deprecated)](https://docs.newrelic.com/docs/azure-cosmos-db-document-db-monitoring-integration-deprecated).
> -   We strongly recommend migrating to the supported events and metrics in this document.
> -   Support for the `Azure Cosmos DB Microsoft.DocumentDB/mongoClusters` resource type is currently not available.

To view metrics reported by the Cosmos DB integration, query the Entities below. Use the metadata associated with each metric to [filter and facet](https://docs.newrelic.com/docs/infrastructure/integrations-getting-started/getting-started/understand-integration-data-data-types#metric) the data being reported. For detailed metric information, see the [Azure supported metrics](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftdocumentdbdatabaseaccounts) documentation.

### Account Data

| Metric                        | Description                                                                                        | Metadata                                                                                                          |
| ----------------------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `totalRequests`               | Total number of requests.                                                                          | - `account` - `kind` - `region` - `offerType` - `statusCode` - `resourceGroup`                                    |
| `metadataRequests`            | Count of metadata requests.                                                                        | - `account` - `kind` - `region` - `offerType` - `statusCode` - `resourceGroup`                                    |
| `mongoRequests`               | Count of Mongo requests made.                                                                      | - `account` - `kind` - `region` - `commandName` - `offerType` - `errorCode` - `resourceGroup`                     |
| `mongoRequestCharge`          | Total number of Mongo request units consumed.                                                      | - `account` - `kind` - `region` - `commandName` - `offerType` - `errorCode` - `resourceGroup`                     |
| `totalRequestUnits`           | Total number of request units consumed.                                                            | - `account` - `kind` - `region` - `offerType` - `statusCode` - `resourceGroup`                                    |
| `provisionedThroughput`       | Throughput provisioned for the database or collection.                                             | - `account` - `offerType` - `kind` - `resourceGroup`                                                              |
| `availableStorageBytes`       | Total available storage, in bytes.                                                                 | - `account` - `kind` - `offerType` - `region` - `resourceGroup`                                                   |
| `dataUsageBytes`              | Total data usage reported, in bytes.                                                               | - `account` - `kind` - `offerType` - `region` - `resourceGroup`                                                   |
| `indexUsageBytes`             | Total index usage reported, in bytes.                                                              | - `account` - `kind` - `offerType` - `region` - `resourceGroup`                                                   |
| `documentQuotaBytes`          | Total storage quota reported, in bytes.                                                            | - `account` - `kind` - `offerType` - `region` - `resourceGroup`                                                   |
| `documentCount`               | Total document count reported.                                                                     | - `account` - `kind` - `offerType` - `region` - `resourceGroup`                                                   |
| `ReplicationLatency`          | P99 replication latency across source and target regions for geo-enabled account, in milliseconds. | - `account` - `kind` - `sourceRegion` - `offerType` - `targetRegion` - `resourceGroup`                            |
| `ServiceAvailability`         | Account requests availability percentage in hour, day, or month granularity.                       | No specific metadata.                                                                                             |
| `cassandraRequests`           | Count of Cassandra requests made.                                                                  | - `account` - `kind` - `errorCode` - `offerType` - `opperationType` - `region` - `resourceType` - `resourceGroup` |
| `cassandraRequestCharges`     | Total number of request units consumed for Cassandra requests.                                     | - `account` - `kind` - `errorCode` - `offerType` - `opperationType` - `region` - `resourceType` - `resourceGroup` |
| `cassandraConnectionClosures` | Total number of Cassandra connections that were closed.                                            | - `account` - `kind` - `closureReason` - `offerType` - `region` - `resourceGroup`                                 |

### DataBase Data

| Metric                           | Description                                                                                        | Metadata                                                                                  |
| -------------------------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `totalRequests`                  | Total number of requests.                                                                          | - `account` - `databaseName` - `region` - `statusCode`                                    |
| `metadataRequests`               | Count of metadata requests.                                                                        | - `account` - `databaseName` - `region` - `statusCode`                                    |
| `mongoRequests`                  | Count of Mongo requests made.                                                                      | - `account` - `databaseName` - `region` - `commandName` - `errorCode`                     |
| `mongoRequestCharge`             | Total number of Mongo request units consumed.                                                      | - `account` - `databaseName` - `region` - `commandName` - `errorCode`                     |
| `totalRequestUnits`              | Total number of request units consumed.                                                            | - `account` - `databaseName` - `region` - `statusCode`                                    |
| `provisionedThroughput`          | Throughput provisioned for the database or collection.                                             | - `account` - `databaseName`                                                              |
| `availableStorageBytes`          | Total available storage, in bytes.                                                                 | - `account` - `databaseName` - `region`                                                   |
| `dataUsageBytes`                 | Total data usage reported, in bytes.                                                               | - `account` - `databaseName` - `region`                                                   |
| `indexUsageBytes`                | Total index usage reported, in bytes.                                                              | - `account` - `databaseName` - `region`                                                   |
| `documentQuotaBytes`             | Total storage quota reported, in bytes.                                                            | - `account` - `databaseName` - `region`                                                   |
| `documentCount`                  | Total document count reported.                                                                     | - `account` - `databaseName` - `region`                                                   |
| `replicationLatencyMilliseconds` | P99 replication latency across source and target regions for geo-enabled account, in milliseconds. | - `account` - `sourceRegion` - `targetRegion`                                             |
| `serviceAvailabilityPercent`     | Account requests availability percentage in hour, day, or month granularity.                       | No specific metadata.                                                                     |
| `cassandraRequests`              | Count of Cassandra requests made.                                                                  | - `account` - `databaseName` - `errorCode` - `opperationType` - `region` - `resourceType` |
| `cassandraRequestCharges`        | Total number of request units consumed for Cassandra requests.                                     | - `account` - `databaseName` - `errorCode` - `opperationType` - `region` - `resourceType` |
| `cassandraConnectionClosures`    | Total number of Cassandra connections that were closed.                                            | - `account` - `closureReason` - `region`                                                  |

### Collection Data

| Metric                           | Description                                                                                        | Metadata                                                                                                 |
| -------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `totalRequests`                  | Total number of requests.                                                                          | - `account` - `collectionName` - `database` - `region` - `statusCode`                                    |
| `metadataRequests`               | Count of metadata requests.                                                                        | - `account` - `collectionName` - `database` - `region` - `statusCode`                                    |
| `mongoRequests`                  | Count of Mongo requests made.                                                                      | - `account` - `collectionName` - `database` - `region` - `commandName` - `errorCode`                     |
| `mongoRequestCharge`             | Total number of Mongo request units consumed.                                                      | - `account` - `collectionName` - `database` - `region` - `commandName` - `errorCode`                     |
| `totalRequestUnits`              | Total number of request units consumed.                                                            | - `account` - `collectionName` - `database` - `region` - `statusCode`                                    |
| `provisionedThroughput`          | Throughput provisioned for the database or collection.                                             | - `account` - `collectionName` - `database`                                                              |
| `availableStorageBytes`          | Total available storage, in bytes.                                                                 | - `account` - `collectionName` - `database` - `region`                                                   |
| `dataUsageBytes`                 | Total data usage reported, in bytes.                                                               | - `account` - `collectionName` - `database` - `region`                                                   |
| `indexUsageBytes`                | Total index usage reported, in bytes.                                                              | - `account` - `collectionName` - `database` - `region`                                                   |
| `documentQuotaBytes`             | Total storage quota reported, in bytes.                                                            | - `account` - `collectionName` - `database` - `region`                                                   |
| `documentCount`                  | Total document count reported.                                                                     | - `account` - `collectionName` - `database` - `region`                                                   |
| `replicationLatencyMilliseconds` | P99 replication latency across source and target regions for geo-enabled account, in milliseconds. | - `account` - `collectionName` - `sourceRegion` - `targetRegion`                                         |
| `serviceAvailabilityPercent`     | Account requests availability percentage in hour, day, or month granularity.                       | No specific metadata.                                                                                    |
| `cassandraRequests`              | Count of Cassandra requests made.                                                                  | - `account` - `collectionName` - `database` - `errorCode` - `opperationType` - `region` - `resourceType` |
| `cassandraRequestCharges`        | Total number of request units consumed for Cassandra requests.                                     | - `account` - `collectionName` - `database` - `errorCode` - `opperationType` - `region` - `resourceType` |
| `cassandraConnectionClosures`    | Total number of Cassandra connections that were closed.                                            | - `account` - `collectionName` - `closureReason` - `region`                                              |
