• 4 min read

Save money with Application Insights’ web SDK 2.0

Less than a year ago we shipped the first stable version of Application Insights SDK. A lot has happened since that time. Read on to learn more.

Less than a year ago we shipped the first stable version of Application Insights SDK. A lot has happened since that time. Since then we have fixed bugs, introduced new features, received lots of feedback, and have come to a better understanding of your needs. Now it is time for the new version of the Application Insights SDK. Please welcome the .NET Application Insights SDK 2.0 for Web applications.

Breaking changes

With the .NET Application Insights SDK 2.0 for Web applications we introduced a number of breaking changes. The biggest breaking change is a migration of devices support from Application Insights SDK to HockeyApp SDK that will happen April 15th. Meanwhile, if you need devices support, do not upgrade to this version. There is a great blog post explaining our motivation by Thomas Dohmke.

Another big change is a removed interface IContextInitializer. The concept of context initializer was so confusing and error prone that we published an article called “Do not use Context Initializer.” With the major version change we had a chance to remove this concept from our SDK. There are more small breaking changes listed in release notes for Core and Web nugets.

Predictable pricing

Adaptive sampling

On the new SDK Adaptive sampling is enabled by default when you install Application Insights for Web NuGet. With adaptive sampling you collect and store a reduced set of telemetry while maintaining a statistically correct analysis of application data.

When sampling occurs we ensure that the same configuration will work in different environments. For example, in Development and Test environment you will most likely see all telemetry data. In production environment with high load, the SDK will automatically limit the amount of data it collects.

Filter out request

With native support of filtering you can reduce the volume of data collected. You may choose to filter out request from a specific URL, request from robots – everything marked as “Synthetic traffic” by Web SDK, or you can decide to filter out your custom heartbeat events. Filtering gives you the ability to decide.

Produce less noise

We also enabled some default filtering. Specifically, we do not collect telemetry for static content. This results in the SDK producing less noise by default.

Application Insights is a complex solution that covers many of your monitoring needs. You can collect telemetry from a wide variety of platforms then detect, triage and diagnose the problems. With proactive detection you will be aware of problems you may have never guessed would occur and analytical capabilities.

All these capabilities require a significant amount of data to be collected from your application. The amount of data collected can really add up. No matter how efficient the data collection is there is always a limit and cost associated with it. Application Insights has a flexible model that allows you to pay for as much data as you want to send and analyze.

We have many customers running custom analytics on their data. At the same time we receive a lot of feedback from other customers that basic detect/triage/diagnose scenario should have a predictable price and not be capped by threshold limits.

With the .NET Application Insights SDK 2.0 for Web applications we made a first step towards predictable pricing for APM scenarios. Now it is much easier to filter telemetry data and we have predefined filters. However, the biggest improvement we made is an Adaptive Sampling feature that enables you to get statistically correct data even if your application has a high load of requests.


Telemetry correlation is key for many diagnostics scenarios. Application Insights allows for correlation by user and session. It shows telemetry associated with the specific request. For example, you can find all the exceptions that happened on a specific page of your application.

We are continuing our work to improve correlation story and have many excited improvements in .NET Application Insights SDK 2.0 for Web applications.

Expose auto generated RequestTelemetry

If you need to associate your telemetry with the current request you can now access RequestTelemetry object associated with the current request using new API method call. For instance, if you want to associate your log file traces with the Application Insights request telemetry you can write code like this:

var requestTelemetry = HttpContext.Current.GetRequestTelemetry(); 

Trace.WriteError(“Error processing request with Application Insights ID: ” + requestTelemetry.Id); 

Define operations hierarchy

You can now define the scope of an operation with OperationAPI in Application Insights. All calls that fall under the scope of an operation will have some operation id and operation name. For instance, this code will produce Request telemetry object associated with both traces and dependency call to bing.com:

using (var op = this.telemetryClient.StartOperation("request"))  




    HttpClient client = new HttpClient();  





Correlate AJAX calls to backend activities

The correlation between Ajax calls and corresponding server requests makes it possible to really understand why your AJAX calls are slow. Starting with the user facing issues while investigating your application’s performance creates a more customer-impact driven process. This feature provides deep clear understanding for AJAX calls equipping you to know what specific user-facing issues are occurring.


What’s next

We encourage everybody to start using new SDK version. It is faster, more configurable and has many interesting features.

With the upcoming minor releases of SDK 2.X we will continue our effort on making APM scenarios cost more predictable while keeping the power of analytics on top of this data. We will implement smart algorithms to understand what telemetry is most important to you, metrics will become more accurate,  and you will have more control over the telemetry data for your application.

We have many ideas on in-process and cross-components telemetry correlation. We will be making investments in this area.

There are also many new features coming up in Application Insights so stay tuned and give us your feedback!