GraftCode.Netcore.Telemetry.AppInsightsConnector 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package GraftCode.Netcore.Telemetry.AppInsightsConnector --version 1.0.4
                    
NuGet\Install-Package GraftCode.Netcore.Telemetry.AppInsightsConnector -Version 1.0.4
                    
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="GraftCode.Netcore.Telemetry.AppInsightsConnector" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GraftCode.Netcore.Telemetry.AppInsightsConnector" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="GraftCode.Netcore.Telemetry.AppInsightsConnector" />
                    
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 GraftCode.Netcore.Telemetry.AppInsightsConnector --version 1.0.4
                    
#r "nuget: GraftCode.Netcore.Telemetry.AppInsightsConnector, 1.0.4"
                    
#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 GraftCode.Netcore.Telemetry.AppInsightsConnector@1.0.4
                    
#: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=GraftCode.Netcore.Telemetry.AppInsightsConnector&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=GraftCode.Netcore.Telemetry.AppInsightsConnector&version=1.0.4
                    
Install as a Cake Tool

GraftCode App Insights Connector

Configure Application Insights for an application and Graft bridge spans with one call:

using GraftCode.Netcore.Telemetry.AppInsightsConnector;

using var telemetry = GraftCodeAppInsightsConnector.Start("MyService");
using var activity = telemetry.StartActivity("MyOperation");

telemetry.Logger.LogInformation("My operation started");

The connector reads APPLICATIONINSIGHTS_CONNECTION_STRING, exports logs and traces, and automatically subscribes to the application's source and the Graftcode source. An explicit connection string and additional activity sources can be configured:

using var telemetry = GraftCodeAppInsightsConnector.Start(options =>
{
    options.ServiceName = "MyService";
    options.ConnectionString = configuration["ApplicationInsights:ConnectionString"];
    options.ActivitySourceNames.Add("MyCompany.Shared");
});

For dependency-injection applications:

services.AddGraftCodeAppInsightsConnector(options =>
{
    options.ServiceName = "MyService";
});

Resolve GraftCodeAppInsightsConnectorPipeline to access its ActivitySource, Logger, and ForceFlush() method.

For ASP.NET Core applications, register request telemetry after routing:

app.UseRouting();
app.UseGraftCodeAppInsightsConnectorRequestTelemetry();
app.MapControllers();

Each HTTP request gets a server Activity named {ServiceName}.{controller} when route values are available, for example TestGgWebApi.Fetch. Logs and downstream bridge spans inside the request then share the same trace automatically.

Sampling

Every trace is kept by default. Azure Monitor's own default is a rate limit of five traces per second, which drops whole traces once the budget is spent - and because unsampled traces also lose their log records, a short-lived caller that makes a single bridge call can end up reporting nothing at all while the long-running side it called reports normally.

Set TracesPerSecond to opt into rate limiting for high-volume services:

options.TracesPerSecond = 5;

Flushing

ForceFlush() covers both traces and logs, so a short-lived process should call it before exiting. The pipeline also flushes on Dispose(), process exit, Ctrl+C, and unhandled exceptions; telemetry is still lost when a process is killed outright, for example by stopping a debugging session.

Diagnosing missing telemetry

IsExportingToAppInsightsConnector is false when no connection string was resolved, in which case the connector logs a warning and telemetry stays local. This is worth asserting on startup for services that must report, since a connection string set at machine level only reaches processes started afterwards, and does not reach containers at all.

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 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 is compatible.  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 is compatible.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.5 83 11/16/2026
1.0.4 87 11/16/2026
1.0.3 96 11/10/2026
1.0.2 90 11/10/2026
1.0.1 89 11/10/2026
1.0.0 90 11/9/2026