Observing and monitoring Azure Cosmos DB with AppDynamics

August 24 2022
 

As organizations increasingly adopt cloud-first strategies, it’s important to have data stores that have internet-level scalability to power these cloud native applications. For applications running on Azure, the logical choice is Azure Cosmos DB.


With Azure Cosmos DB being a critical part of many cloud native applications, it is imperative to understand not only the performance metrics of Azure Cosmos DB but also which application components are communicating with Azure Cosmos DB and how.

Let me give you a brief introduction to Azure Cosmos DB and then a brief overview of how AppDynamics provides clear visibility into Azure Cosmos DB and how connected application services are utilizing it.

What is Azure Cosmos DB?

Azure Cosmos DB is a fully managed document database (NoSQL), purpose-built to back modern cloud native applications. It has its origins in 2010 as a part of “Project Florence” which sought to address the fundamental challenges that developers face in building applications at internet scale. Azure Cosmos DB was formally launched in 2017 to provide single-digit millisecond response times along with SLA-backed multi-region reads/writes and independent region-specific elasticity. Azure Cosmos DB has deep integrations with other Azure services (such as AKS, Azure Functions and Azure App Service) commonly leveraged when building out cloud native applications.

The data model for Azure Cosmos DB centers on storing items in schema-agnostic containers, with multiple containers being grouped together into databases. Each database container exposes a change feed that allows for tracking and management of changes. This change tracking makes it possible to create triggered events using Azure Functions to respond to insert and update operations.

Azure Cosmos DB exposes a Core SQL API with SDKs available in .NET, Java, Node.js and Python. In addition, Azure Cosmos DB exposes additional database APIs partially compatible with wire protocols for MongoDB, Cassandra, Azure Table Storage and Gremlin. By exposing these additional compatibility APIs, developers can utilize familiar SDKs when developing applications that connect to Azure Cosmos DB.

How AppDynamics Gives You a Clear View into Azure Cosmos DB

AppDynamics integrates with Azure Monitor via the AppDynamics Azure Monitor Extension to ingest Azure Cosmos DB metrics into the AppDynamics platform. Once these metrics are ingested into AppDynamics, they are treated the same as natively collected metrics within the AppDynamics platform: they are dynamically baselined to help identify trends, detect anomalous conditions and establish health rules.

Figure 1: A screenshot of Azure Cosmos DB metrics within AppDynamics

In addition to integrating with metrics via Azure Monitor, AppDynamics can also monitor and visualize how services are connecting to the MongoDB, Cassandra and Core SQL API endpoints exposed by Azure Cosmos DB.

For connecting to the Cassandra endpoint in Azure Cosmos DB, AppDynamics can visualize services that are connecting to that endpoint in the AppDynamics flowmap along with performance of calls to the Cassandra API endpoint.

Figure 2: AppDynamics flowmap showing service communication to Azure Cosmos DB via the Cassandra API

 

Figure 3: AppDynamics flowmap showing performance details for Azure Cosmos DB via the Cassandra API

AppDynamics can also surface up data pertaining to the CQL call being made by a service including the stripped-out CQL query, information around the host and port of the Azure Cosmos DB instance and the execution time of the query.

Figure 4: AppDynamics call graph showing details around a call to Azure Cosmos DB via the Cassandra API

 

AppDynamics also visualizes the same data points when connecting to the MongoDB API endpoint of an Azure Cosmos DB instance.

Figure 5: AppDynamics flowmap showing service communication to Azure Cosmos DB via Mongo API

 

Figure 6: AppDynamics flowmap showing performance details for Azure Cosmos DB via Mongo API

 

Figure 7: AppDynamics flowmap showing slowest calls to Azure Cosmos DB via Mongo API

When visualizing calls to the Core SQL endpoint of Azure Cosmos DB, AppDynamics represents the Azure Cosmos DB instance on the flowmap as a generic service. However, the connection is denoted as going to Azure Cosmos DB. Aside from that, AppDynamics surfaces up the same type of data for connections to the Core SQL endpoint as it does the other endpoints.

Figure 8: AppDynamics flowmap showing service communication to Azure Cosmos DB via Core API

 

Figure 9: AppDynamics flowmap showing slowest DB calls to Azure Cosmos DB via Core API

 

Figure 10: AppDynamics snapshot showing call to Azure Cosmos DB via Core API

 

Figure 11: AppDynamics call graph showing details around call to Azure Cosmos DB via Core API

See for yourself!

By combining Cosmos DB metrics from Azure Monitor collected by AppDynamics with the deep code-level visibility provided by AppDynamics, customers can observe what matters most to them. But don’t take my word for it — sign up for a free trial and see for yourself!

Wayne Brown is a Senior Solutions Engineer with AppDynamics. He has built more than 20 years of experience in software development, architecture, and consulting across a wide range of technologies, disciplines, and industries since graduating from Mississippi College with both a Master of Science and a Bachelor of Science. Wayne is based in Montana, and in his spare time keeps up his skills as a master certified BBQ judge.