Azure Cosmos DB (Document DB) monitoring integration

New Relic Infrastructure provides an integration for Microsoft Azure's Cosmos DB service that reports your Cosmos DB metrics and inventory data to New Relic products. This document explains how to activate the Cosmos DB integration and describes the data that can be captured.

Access to this feature depends on your subscription level. Requires Infrastructure Pro.

For information on deprecated Cosmos DB events or metrics, see Azure Cosmos DB integration (deprecated). We strongly recommend migrating to the supported events and metrics in this document.

Features

New Relic Infrastructure 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 Infrastructure, and you can create custom queries and custom chart dashboards in New Relic Insights.

Requirements

Requirements include:

Activate integration

To enable this integration:

  1. Make sure you have installed the Infrastructure agent before you activate Azure integrations from your Infrastructure account.
  2. Follow standard procedures to activate your Azure service in New Relic Infrastructure.

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 [terminal icon] icon.
  2. Add the following command:

    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 plus 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

You can change the polling frequency and filter data using configuration options.

Default polling information for the Cosmos DB integration:

Find and use data

To find your integration data in Infrastructure, go to infrastructure.newrelic.com > Integrations and look for the integration.

In New Relic Insights, data is attached to the AzureCosmosDbSample event type, with provider value of AzureCosmosDb.

For more on how to find and use data, see Understand and use integration data.

Metric data

For information on deprecated Cosmos DB events or metrics, see Azure Cosmos DB integration (deprecated). We strongly recommend migrating to the supported events and metrics in this document.

To view metrics reported by the Cosmos DB integration, query the AzureCosmosDbSample event type in Insights. Use the metadata associated with each metric to filter and facet the data being reported. For detailed metric information, see the Azure supported metrics documentation.

Metric Description Metadata
totalRequests

Total number of requests.

  • databaseName
  • collectionName
  • region
  • statusCode
metadataRequests

Count of metadata requests.

  • databaseName
  • collectionName
  • region
  • statusCode
mongoRequests

Count of Mongo requests made.

  • databaseName
  • collectionName
  • region
  • commandName
  • errorCode
mongoRequestCharge

Total number of Mongo request units consumed.

  • databaseName
  • collectionName
  • region
  • commandName
  • errorCode
totalRequestUnits

Total number of request units consumed.

  • databaseName
  • collectionName
  • region
  • statusCode
provisionedThroughput

Throughput provisioned for the database or collection.

  • databaseName
  • collectionName
availableStorageBytes

Total available storage, in bytes.

  • databaseName
  • collectionName
  • region
dataUsageBytes

Total data usage reported, in bytes.

  • databaseName
  • collectionName
  • region
indexUsageBytes

Total index usage reported, in bytes.

  • databaseName
  • collectionName
  • region
documentQuotaBytes

Total storage quota reported, in bytes.

  • databaseName
  • collectionName
  • region
documentCount

Total document count reported.

  • databaseName
  • collectionName
  • region
replicationLatencyMilliseconds

P99 replication latency across source and target regions for geo-enabled account, in milliseconds.

  • sourceRegion
  • targetRegion
serviceAvailabilityPercent

Account requests availability percentage in hour, day, or month granularity.

No specific metadata.

cassandraRequests

Count of Cassandra requests made.

  • databaseName
  • collectionName
  • errorCode
  • region
  • opperationType
  • resourceType
cassandraRequestCharges

Total number of request units consumed for Cassandra requests.

  • databaseName
  • collectionName
  • errorCode
  • region
  • opperationType
  • resourceType
cassandraConnectionClosures

Total number of Cassandra connections that were closed.

  • closureReason
  • region

Inventory data

Inventory data is information about your system's state and configuration. For details on how to find and use inventory data, see Understand and use data.

The Cosmos DB integration reports the inventory data for the entity type azure/cosmosdb/account/ using the following metadata:

  • documentEndpoint: The document end point.
  • databaseAccountOfferType: The database account offer type.
  • consistencyPolicy: The consistency policy for the Cosmos DB database account.
  • defaultConsistencyLevel: The default consistency level for the Cosmos DB database account.
  • kind: The type of database account set at database account creation.
  • resourceGroupName: The Azure resource group name that the Cosmos DB database account belong to.
  • regionName: The region name in which the Azure DocumentDB database account is deployed.
  • type: The azure resource type, which is Microsoft.DocumentDB/databaseAccounts.

For more help

Recommendations for learning more: