ApplicationInsightsTelemetryEnhancer 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ApplicationInsightsTelemetryEnhancer --version 2.2.0
NuGet\Install-Package ApplicationInsightsTelemetryEnhancer -Version 2.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ApplicationInsightsTelemetryEnhancer" Version="2.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ApplicationInsightsTelemetryEnhancer --version 2.2.0
#r "nuget: ApplicationInsightsTelemetryEnhancer, 2.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ApplicationInsightsTelemetryEnhancer as a Cake Addin
#addin nuget:?package=ApplicationInsightsTelemetryEnhancer&version=2.2.0

// Install ApplicationInsightsTelemetryEnhancer as a Cake Tool
#tool nuget:?package=ApplicationInsightsTelemetryEnhancer&version=2.2.0

Application Insights Telemetry Enhancer

Add data to Microsoft Azure Application Insights

Features

  • Add Application Insights Operation Id as a response header to alll of your app's responses
  • Add request and response body to Application Insights Request Telemetry. You will see the body of every incomming API call, and the HTML of every page view.
  • Add request and response body to Application Insights Dependency Telemetry. You will see the body of every API call your app makes to external APIs.

ASP.Net support

Only .Net Core 2.2 and .Net Core 3.1 are currently supported

Usage

Operation Id Response Header

To add the operatrion id response header, add this line to the Configure method in Startup.cs

app.UseOperationIdHeader();

The default header name is Operation-Id In order to customize it, you can add a configuration section to your appsettings.json file:

"OperationIdHeader": {
  "HeaderName": "HeaderConfig"
}

After adding the configuration section, pass it in the following way in ConfigureServices method in Startup.cs:

services.AddOperationIdHeader(Configuration.GetSection("OperationIdHeader"));

Another way to customize the response header, is directrly in the ConfigureServices method:

services.AddOperationIdHeader(options =>
{
  options.HeaderName = "HeaderOptions";
});

Dependency Telemetry Enhancer

To add the request and response body of every external HTTP call, add this line to the ConfigureServices method in Startup.cs

services.AddDependencyTelemetryEnhancer();

The default custom dimentions are "Request" and "Response". In order to customize them, you can add a configuration section to your appsettings.json file:

"DependencyTelemetryEnhancer": {
    "RequestPropertyKey": "RequestConfig",
    "ResponsePropertyKey": "ResponseConfig"
}

After adding the configuration section, pass it in the following way in ConfigureServices method in Startup.cs:

services.AddDependencyTelemetryEnhancer(Configuration.GetSection("DependencyTelemetryEnhancer"));

Another way to customize the custom dimentions, is directrly in the ConfigureServices method:

services.AddDependencyTelemetryEnhancer(options =>
{
    options.RequestPropertyKey = "RequestOptions";
    options.ResponsePropertyKey = "ResponseOptions";
});

Request Telemetry Enhancer

To add the request and response body of every incomming HTTP call, add this line to the Configure method in Startup.cs

app.UseRequestTelemetryEnhancer();

The default custom dimentions are "Request" and "Response". In order to customize them, you can add a configuration section to your appsettings.json file:

"RequestTelemetryEnhancer": {
    "RequestPropertyKey": "RequestConfig",
    "ResponsePropertyKey": "ResponseConfig"
}

After adding the configuration section, pass it in the following way in ConfigureServices method in Startup.cs:

services.AddRequestTelemetryEnhancer(Configuration.GetSection("RequestTelemetryEnhancer"));

Another way to customize the custom dimentions, is directrly in the ConfigureServices method:

services.AddRequestTelemetryEnhancer(options =>
{
    options.RequestPropertyKey = "RequestOptions";
    options.ResponsePropertyKey = "ResponseOptions";
});
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.1 819 4/11/2021
5.0.0 444 11/14/2020
3.1.1 318 4/11/2021
3.1.0 433 9/12/2020
2.2.1 305 4/11/2021
2.2.0 458 9/12/2020

For use with ASP.Net Core 2.2