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.

Activate integration

To enable this integration 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:

View and query data

To view your integration data in Infrastructure, go to infrastructure.newrelic.com > Azure and select the Cosmos DB Integration.

In New Relic Insights, data is attached to the following event types:

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.

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 Entities below 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.

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

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

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: