Plex.App.Insights.Core 2.22.13

dotnet add package Plex.App.Insights.Core --version 2.22.13
                    
NuGet\Install-Package Plex.App.Insights.Core -Version 2.22.13
                    
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="Plex.App.Insights.Core" Version="2.22.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plex.App.Insights.Core" Version="2.22.13" />
                    
Directory.Packages.props
<PackageReference Include="Plex.App.Insights.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Plex.App.Insights.Core --version 2.22.13
                    
#r "nuget: Plex.App.Insights.Core, 2.22.13"
                    
#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.
#:package Plex.App.Insights.Core@2.22.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Plex.App.Insights.Core&version=2.22.13
                    
Install as a Cake Addin
#tool nuget:?package=Plex.App.Insights.Core&version=2.22.13
                    
Install as a Cake Tool

Plex.App.Insights.Core

A .NET 8 library that provides a single-call extension method to wire up OpenTelemetry-based Application Insights telemetry (traces and metrics) for ASP.NET Core applications.

Features

  • One-line setupbuilder.AddAppInsights() configures everything
  • OpenTelemetry-based — uses the modern OpenTelemetry SDK with Azure Monitor exporters
  • Tracing — ASP.NET Core (inbound HTTP), HTTP client (outbound HTTP), and SQL client instrumentation
  • Metrics — ASP.NET Core hosting, Kestrel server, and HTTP client metrics
  • SQL command capture — optionally includes SQL command text in traces
  • Cloud role naming — configures service.name, service.instance.id, and service.version as OpenTelemetry resource attributes
  • Safe no-op — gracefully skips registration when APPLICATIONINSIGHTS_CONNECTION_STRING is not set

Installation

dotnet add package Plex.App.Insights.Core

Configuration

Set the Application Insights connection string as an environment variable:

APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=...;IngestionEndpoint=...

Add optional settings to your appsettings.json:

{
  "AppSettings": {
    "CloudRoleName": "my-service",
    "CloudRoleInstance": "instance-01",
    "CloudRoleVersion": "1.0.0",
    "EnableSqlCommandTextInstrumentation": "true"
  }
}
Setting Default Description
CloudRoleName Sets the service.name resource attribute (identifies the service in Application Insights)
CloudRoleInstance Sets the service.instance.id resource attribute
CloudRoleVersion Sets the service.version resource attribute
EnableSqlCommandTextInstrumentation false When true, captures SQL command text (db.query.text) in traces

Usage

var builder = WebApplication.CreateBuilder(args);

builder.AddAppInsights();

var app = builder.Build();

This registers:

Tracing:

  • ASP.NET Core instrumentation (inbound HTTP requests)
  • HTTP client instrumentation (outbound HTTP calls)
  • SQL client instrumentation (with optional command text capture)
  • Azure Monitor trace exporter

Metrics:

  • Microsoft.AspNetCore.Hosting (request metrics)
  • Microsoft.AspNetCore.Server.Kestrel (server metrics)
  • System.Net.Http (HTTP client metrics)
  • Azure Monitor metric exporter

If APPLICATIONINSIGHTS_CONNECTION_STRING is not set, the method is a no-op — safe to call in all environments.

Dependencies

Package Version
Azure.Monitor.OpenTelemetry.Exporter 1.8.x
OpenTelemetry.Instrumentation.AspNetCore 1.17.x
OpenTelemetry.Instrumentation.Http 1.17.x
OpenTelemetry.Instrumentation.SqlClient 1.17.x
Plex.Extensions.Configuration 8.0.x

License

Plex-Solution Community Source-Available License — free for non-commercial use only.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
2.22.13 42 7/23/2026
2.22.12 142 7/3/2026
2.22.11 98 7/3/2026
2.22.10 101 7/2/2026
2.22.9 104 7/1/2026
2.22.7 2,259 7/2/2024
2.22.6 413 5/14/2024
2.22.5 215 5/14/2024
2.22.4 233 5/13/2024
2.22.2 595 2/2/2024
2.22.1 356 1/22/2024
2.22.0 245 1/22/2024

Update vulnerabilities packages