microsoft / ApplicationInsights-Profiler-AspNetCore

Application Insights Profiler sample and documentation
MIT License
66 stars 22 forks source link

How-To Use it Properly with OpenTelemetry NuGet? #209

Closed christophwille closed 3 months ago

christophwille commented 5 months ago

https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable?tabs=aspnetcore

using Azure.Monitor.OpenTelemetry.AspNetCore;

// Create a new WebApplicationBuilder instance.
var builder = WebApplication.CreateBuilder(args);

// Add the OpenTelemetry NuGet package to the application's services and configure OpenTelemetry to use Azure Monitor.
builder.Services.AddOpenTelemetry().UseAzureMonitor();

// Build the application.
var app = builder.Build();

vs

https://learn.microsoft.com/en-us/azure/azure-monitor/profiler/profiler-containers?tabs=net-core-new

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddApplicationInsightsTelemetry(); // Add this line of code to enable Application Insights.
builder.Services.AddServiceProfiler(); // Add this line of code to enable Profiler
builder.Services.AddControllersWithViews();

var app = builder.Build();

If I use OpenTelemetry for Azure Monitor / Application Insights, I have a connection string to Azure Monitor, and with profiler I have an instrumentation key. Questions:

xiaomi7732 commented 5 months ago

Hi @christophwille, Thanks for bring this up. Profiler is currently not supported with the Application Insights Open Telemetry Distro.

More more details for the feature support:

https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-configuration?tabs=aspnetcore#whats-the-current-release-state-of-features-within-the-azure-monitor-opentelemetry-distro

It takes more than just the connection string to make the Profiler work. We are investigating the requirements and consider a different package to support the Open Telemetry distro.

Unfortunately, I don't have too much to share at this moment yet.