Getting Started with Azure Application Performance Monitoring

Author

Reads 1.3K

Person Using Smartphone Application
Credit: pexels.com, Person Using Smartphone Application

Getting started with Azure Application Performance Monitoring is a crucial step in ensuring your applications run smoothly and efficiently. Azure provides a robust set of tools to monitor your applications, including Azure Monitor, Application Insights, and Log Analytics.

To begin, you'll need to set up Azure Monitor, which provides a unified view of your application's performance, including metrics, logs, and traces. This will help you identify potential issues before they impact your users.

The next step is to instrument your application with Application Insights, which collects data on user interactions, performance, and exceptions. This data will provide valuable insights into how your application is performing in real-time.

With Azure Monitor and Application Insights in place, you'll have a solid foundation for monitoring your application's performance.

A unique perspective: Managed Applications Azure

What Is It?

Azure Application Insights is an Application Performance Management (APM) service that helps you observe your live applications and diagnose problems.

It's a feature of Azure Monitor that integrates with your DevOps method and has connections to various development tools.

Computer server in data center room
Credit: pexels.com, Computer server in data center room

This service is designed to work with apps on a variety of platforms, including .NET, Node.js, Java, and Python, hosted on-premises, hybrid, or in any public cloud.

You can use it to monitor and analyze metrics from mobile apps by working with Visual Studio App Center.

The service will automatically detect performance anomalies and provide powerful analytics tools to help you diagnose problems and understand what users are doing with your app.

It helps you continuously improve performance and usefulness, making it an essential tool for developers and DevOps professionals.

Getting Started

To get started with Azure Application Performance Monitoring, you'll first need to enable Application Insights by instrumenting your application.

This allows you to check out Live metrics and the Application map, which will give you a good overview of your application's performance.

Enabling Application Insights is a crucial step in monitoring your application's performance, and it's easy to do.

Prerequisites

Before you start using Application Insights, you'll need to meet a few prerequisites.

Dashboard Airlift Performance Controller in Car
Credit: pexels.com, Dashboard Airlift Performance Controller in Car

To get started, you'll need to have Python version 3.11 or earlier installed.

App Service must be deployed as code, and custom containers aren't supported.

Here are the specific requirements to keep in mind:

  • Python version 3.11 or earlier
  • App Service must be deployed as code
  • Custom containers aren't supported

Now that you know the prerequisites, you can move on to the next step.

Use Cases

Getting Started with Application Insights, one of the most powerful tools for monitoring and troubleshooting your applications.

Detect and diagnose exceptions and application performance problems is one of the key use cases of Application Insights. This can be a huge time-saver, especially when dealing with complex issues.

You can use Application Insights to monitor Azure websites, as well as those hosted in containers, and websites on-premises and with alternative cloud providers. This gives you a single pane of glass to monitor all your applications, no matter where they're hosted.

Application Insights seamlessly integrates with your DevOps pipeline using Visual Studio Team Services (VSTS), GitHub, and webhooks. This makes it easy to automate your monitoring and troubleshooting workflows.

To get started with Application Insights, you can quickly start from inside Visual Studio, or monitor existing applications without redeploying.

Monitoring Features

Monitor Displaying Computer Application
Credit: pexels.com, Monitor Displaying Computer Application

Monitoring Features are a crucial part of Azure Application Performance Monitoring. Azure Monitor collects observation measures from on-premises and Azure sources, and management tools like Azure Security Center and Azure Automation push log information to Azure Monitor.

Application Insights is an APM service that helps developers monitor the live performance and usage of their applications. It provides features such as telemetry, logging, and analytics.

Application Insights offers real-time performance tracking, error logging, and usage insights, enabling developers to detect issues and optimize performance quickly. The tool supports advanced telemetry, including metrics like request rates, response times, dependency failures, and custom events.

Application Insights integrates with Azure DevOps and other tools to facilitate automated workflows and continuous improvements. It also provides a comprehensive view of application health.

Here are some key features of Application Insights:

  • Telemetry Data Collection: Application Insights collects telemetry data, including metrics, traces, and logs, from various components of your application.
  • Live Metrics Stream: Real-time monitoring of metrics and performance data to quickly identify issues.
  • Dependency Tracking: Understand dependencies between different components of your application, such as databases, APIs, and external services.
  • Exception Tracking: Identify and analyze exceptions and errors occurring within your application.
  • Performance Counters: Monitor system-level performance counters to gain insights into the health of the underlying infrastructure.
  • User Analytics: Understand user behavior, including session duration, user flows, and usage patterns.

Monitoring Process

Azure Monitor collects observation measures from a range of on-premises and Azure sources, including management tools like Azure Security Center and Azure Automation.

A laptop showing an analytics dashboard with charts and graphs, symbolizing modern data analysis tools.
Credit: pexels.com, A laptop showing an analytics dashboard with charts and graphs, symbolizing modern data analysis tools.

Application Insights, part of Azure Monitor, provides features such as telemetry, logging, and analytics to help developers monitor the live performance and usage of their applications.

Azure Monitor aggregates and stores collected measures in a log information store optimized for cost and performance, allowing for quick analysis and resolution of issues.

Enable Client-Side

Enable Client-Side Monitoring is a crucial step in the monitoring process. It's enabled by default for ASP.NET Core apps with Recommended collection.

To disable client-side monitoring, you'll need to create a new application setting. This involves going to Settings > Configuration, then under Application settings, creating a new application setting with the necessary information. Save the settings and restart your app.

Client-side monitoring can be enabled for ASP.NET by creating a new application setting. This setting is required for the Java agent to inject the Browser SDK Loader (Preview) into your application's HTML pages.

You'll also need to manually add the client-side JavaScript SDK to your Node.js application to enable client-side monitoring.

How Monitor Work?

A computer room with a monitor and computer
Credit: pexels.com, A computer room with a monitor and computer

Azure Monitor collects data from a range of on-premises and Azure sources, including management tools like Azure Security Center and Azure Automation.

The service aggregates and stores this data in a log information store that's optimized for cost and performance.

Azure Monitor can collect data from various sources, including on-premises and Azure sources.

Management tools like Azure Security Center and Azure Automation push log information to Azure Monitor.

Here's a breakdown of the data sources Azure Monitor collects:

  • On-premises sources
  • Azure sources
  • Management tools like Azure Security Center and Azure Automation

Azure Monitor stores the collected data in a log information store that's optimized for cost and performance.

This allows for efficient and cost-effective data storage and analysis.

Azure Monitor provides features like analytics, alerting, and end-to-end views of applications to help users quickly determine and resolve issues.

Discover more: Azure Cost Monitoring

Steps for Monitoring ML Models

Monitoring ML Models is a crucial step in the process. To get started, connect to your workspace to access the necessary tools and resources.

You'll need to prepare your model for deployment, which involves creating an entry script that the service will use to score new data. This script is essential for processing incoming requests.

Lack Flat Screen Computer Monitor
Credit: pexels.com, Lack Flat Screen Computer Monitor

To deploy a model as a web service, you'll need a Conda configuration file for the service environment. This file ensures that the service has the necessary dependencies to function correctly.

Next, you'll need to enable Azure Application Insights for the service. This will allow you to monitor activity and track usage for your model service endpoint.

Here are the key steps to monitor your ML models:

  • Connect to your workspace
  • Prepare a model for deployment
  • Deploy a model as a web service
  • Enable Azure Application Insights

Telemetry and Data

Application Insights collects telemetry data from various sources, including HTTP requests, dependencies, exceptions, and performance counters. This data is crucial for identifying performance issues and improving the overall user experience.

Some of the specific data points collected include uncaught exceptions, user information, device information, and session information. For example, user information can include location, network, and IP details, while device information can include browser, OS, version, language, and model.

Here are some key points to consider:

  • HTTP requests are collected, including dependencies such as SQL databases and Azure storage services.
  • Exceptions and stack traces are also collected, providing valuable insights into errors and crashes.
  • Custom events and metrics can be coded to collect additional data.
  • Trace logs can be collected if the appropriate collector is configured.

Data transfer charges may apply if your Azure web app is not hosted in a datacenter with an Application Insights collection endpoint. This can result in additional network costs, which vary depending on the region the telemetry is coming from and where it's going.

OpenTelemetry Support

Close-up of a car dashboard at night with illuminated speedometer and tech displays.
Credit: pexels.com, Close-up of a car dashboard at night with illuminated speedometer and tech displays.

Application Insights supports OpenTelemetry, a set of APIs, libraries, agents, instrumentation, and instrumentation standards for observability in cloud-native and multi-cloud environments.

If you're looking for a recommended solution for sending telemetry to the Application Insights portal, the Azure Monitor OpenTelemetry Distro is the way to go.

The ingestion schema and endpoint protocol for OpenTelemetry are available publicly, making it easy to get started.

To take advantage of OpenTelemetry with Application Insights, you can use the APIs, libraries, agents, and instrumentation standards provided by OpenTelemetry.

Handle Data Collection, Retention, Storage, and Privacy

Handling data collection, retention, storage, and privacy is crucial to ensure the security and integrity of telemetry and data.

Data collection should be limited to only what is necessary for the intended purpose, as specified in the article section "Data Collection".

Data should be retained for as short a time as possible to minimize the risk of data breaches, as mentioned in the section "Data Retention".

Data storage should be done securely, with encryption and access controls in place, as described in the section "Data Storage".

Data privacy is essential, and users must be informed about what data is being collected and how it will be used, as outlined in the section "Data Privacy".

Management and Settings

A person uses a tablet to monitor stock market trends and real-time trading graphs.
Credit: pexels.com, A person uses a tablet to monitor stock market trends and real-time trading graphs.

Monitoring your Azure application performance is crucial for identifying issues and improving user experience. Alerts can be triggered for a wide range of aspects of your application.

You can configure diagnostic settings to stream export of platform logs and metrics to the destination of your choice. This allows for a deeper understanding of usage patterns and trends.

To get started, you can use Azure Resource Monitor to create and update Application Insights resources, set the pricing plan, and get the instrumentation key. This is particularly useful for managing your resources programmatically.

Here is a list of some key Application Insights settings:

These settings can be used to customize your Application Insights experience and improve performance.

Settings Definitions

In Application Insights, settings definitions are used to configure the monitoring extension/agent. These settings can be found in the Azure portal and are used to control various aspects of the monitoring process.

The ApplicationInsightsAgent_EXTENSION_VERSION setting controls the main extension, which is responsible for runtime monitoring. Its value can be ~2 for Windows or ~3 for Linux.

Close-up of a smartphone displaying an app interface with a blurred bokeh background for a modern tech feel.
Credit: pexels.com, Close-up of a smartphone displaying an app interface with a blurred bokeh background for a modern tech feel.

The XDT_MicrosoftApplicationInsights_Mode setting controls the mode of the Application Insights extension. In default mode, only essential features are enabled to ensure optimal performance.

The XDT_MicrosoftApplicationInsights_PreemptSdk setting enables Interop with the Application Insights SDK for ASP.NET Core apps only. It loads the extension side by side with the SDK and uses it to send telemetry.

Here's a list of supported settings for the adaptive sampling telemetry processor:

The APPLICATIONINSIGHTS_CONNECTION_STRING setting is used to connect to your Application Insights resource. It requires a valid connection string, such as abcd1234-ab12-cd34-abcd1234abcd.

The InstrumentationEngine_EXTENSION_VERSION setting controls the binary-rewrite engine InstrumentationEngine. Its value is ~1 and affects performance and cold start/startup time.

The XDT_MicrosoftApplicationInsights_BaseExtensions setting controls if SQL and Azure table text are captured along with dependency calls. Its value is ~1 and affects performance and cold start/startup time.

The XDT_MicrosoftApplicationInsights_Java setting controls the Java agent. Its value can be 0 or 1, and it's only applicable in Windows.

The XDT_MicrosoftApplicationInsights_NodeJS setting controls the Node.js agent. Its value can be 0 or 1, and it's only applicable in Windows.

Log Analytics

Credit: youtube.com, Azure API Management - Diagnostic Settings & Log Analytics

Log Analytics is a powerful tool that allows you to combine Application Insights data with Azure Log Analytics for advanced querying, visualization, and correlation of log data.

You can use Azure Log Analytics to collect and analyze log data from various sources, including Azure resources and on-premises systems.

Application Insights data can be combined with Azure Log Analytics for advanced querying, visualization, and correlation of log data.

This integration enables you to gain deeper insights into your application's performance and behavior, helping you identify and troubleshoot issues more efficiently.

Managing Resources with PowerShell

Managing Application Insights resources with PowerShell is a powerful way to streamline your workflow.

You can write PowerShell scripts using Azure Resource Monitor to create and update Application Insights resources. This allows you to manage your resources from one central location.

With PowerShell, you can set the pricing plan for your Application Insights resources, which is essential for optimizing costs.

Curious to learn more? Check out: Powershell for Azure

Computer server in data center room
Credit: pexels.com, Computer server in data center room

You can also use PowerShell to get the instrumentation key for your Application Insights resources, which is necessary for tracking and monitoring your application's performance.

In addition to these tasks, PowerShell enables you to add a metric alert and an availability test to your Application Insights resources. These features help ensure your application is running smoothly and efficiently.

Here are the specific tasks you can perform with PowerShell using Azure Resource Monitor:

  • Create and update Application Insights resources.
  • Set the pricing plan.
  • Get the instrumentation key.
  • Add a metric alert.
  • Add an availability test.

Resource Manager Settings

You can manage and configure application settings for Azure App Service with Azure Resource Manager templates.

These templates allow you to deploy new App Service resources or modify existing resources with Resource Manager automation.

The basic structure of the application settings JSON for an App Service resource is a key part of this process.

To create a Resource Manager template with the default Application Insights settings, start by creating a new App Service resource with your desired web app information.

Related reading: Azure Resource

Woman in focus working on software development remotely on laptop indoors.
Credit: pexels.com, Woman in focus working on software development remotely on laptop indoors.

Enable Application Insights on the Monitoring tab, then select Review + create and choose Download a template for automation.

This option generates the latest Resource Manager template with all required settings configured.

You can modify the template by replacing all instances of AppMonitoredSite with your site name.

For Windows, set ApplicationInsightsAgent_EXTENSION_VERSION to ~2, and for Linux, set it to ~3.

Here's a summary of the settings:

By following these steps, you can effectively manage and configure application settings for Azure App Service with Azure Resource Manager templates.

TLS Versions Supported

Application Insights uses Transport Layer Security (TLS) 1.2 and 1.3 as the encryption mechanisms of choice.

TLS 1.0 and 1.1 protocol versions will be retired for Application Insights on 1 March 2025, in alignment with the Azure wide legacy TLS retirement.

After 1 March 2025, Application Insights will only support TLS 1.2 and 1.3 protocol versions.

Legacy Cipher suites and Elliptical curves will also be retired for Application Insights on 1 March 2025.

Additional reading: Azure Legacy

Troubleshooting and Improvement

Shot of Computer Screen with Multicoloured Code
Credit: pexels.com, Shot of Computer Screen with Multicoloured Code

An at-a-glance assessment of your application's health and performance is available through the application dashboard.

This visual overview of application architecture and components' interactions is provided by the application map.

Real-time analytics can be accessed through the live metrics dashboard to gain insight into application activity and performance.

To diagnose issues and optimize performance, you can use the transaction search feature to trace and identify problematic transactions.

The availability view allows you to proactively monitor and test the availability and responsiveness of application endpoints.

Failures can be identified and analyzed in the failures view to minimize downtime.

Key metrics for reviewing application performance and identifying potential bottlenecks are available in the performance view.

If this caught your attention, see: Azure Monitor Dashboard

Task 4: Performance Investigation

To start, navigate to the Application dashboard to get an at-a-glance assessment of your application's health and performance. This dashboard will give you a quick overview of how your application is doing.

The Application map is a visual overview of your application's architecture and components' interactions. It's like a map of your application's inner workings.

Man in White Dress Shirt Analyzing Data Displayed on Screen
Credit: pexels.com, Man in White Dress Shirt Analyzing Data Displayed on Screen

Live metrics provide real-time analytics for insight into application activity and performance. You can see how your application is performing in real-time.

To dig deeper, use the Transaction search feature to trace and diagnose transactions. This will help you identify issues and optimize performance.

The Availability view allows you to proactively monitor and test the availability and responsiveness of application endpoints. This is crucial for ensuring your application is always accessible.

Failures view helps you identify and analyze failures in your application to minimize downtime. This is a must-have for any application.

Performance view enables you to review application performance metrics and potential bottlenecks. This will give you a clear picture of where your application needs improvement.

Here's a summary of the performance investigation tools at your disposal:

Task 6: Creating Alerts

Creating alerts is a crucial step in monitoring your application's performance and receiving notifications when issues arise. Select the Alerts tab to set triggers that perform actions when Application Insights measurements reach specified conditions.

Home monitoring security.
Credit: pexels.com, Home monitoring security.

To create a new alert rule, click the New alert rule button. The current Application Insights resource will be selected by default, and you can proceed to select a condition.

Search for "failed" and select the Failed requests metric. You can set the Threshold value to "1" to trigger the alert once a second failed request is reported.

The conditions will be evaluated every minute and based on the aggregation of measurements over the past 5 minutes. You can adjust this if needed.

To define an Action Group for the alert to execute, click Select action group and then Create action group. Set the Action group name and Short name to "Admin alert".

Select the Action name to Alert and Action type to Email/SMS/Push/Voice. You can then edit the details of the action group.

Check the Email box and enter your email address to receive notifications when the alert is triggered.

Here's a summary of the steps to create an alert rule:

  1. Select the Alerts tab.
  2. Click New alert rule.
  3. Search for "failed" and select the Failed requests metric.
  4. Set the Threshold value to "1".
  5. Create an Action Group with the name "Admin alert".
  6. Check the Email box and enter your email address.

Once the alert rule is created, you can test it by invoking some errors using the method from earlier. Around five minutes later, you should receive an email indicating that your alert was triggered.

Frequently Asked Questions

How do I monitor API performance in Azure?

To monitor API performance in Azure, navigate to your API Management instance and select Monitoring > Metrics from the left menu. Here, you can view detailed metrics and charts to track API call activity.

Walter Brekke

Lead Writer

Walter Brekke is a seasoned writer with a passion for creating informative and engaging content. With a strong background in technology, Walter has established himself as a go-to expert in the field of cloud storage and collaboration. His articles have been widely read and respected, providing valuable insights and solutions to readers.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.