microsoft / ApplicationInsights-dotnet

ApplicationInsights-dotnet
MIT License
566 stars 285 forks source link

Profiler is not available on this APM instance because Net SDK its disabled. #1900

Closed hafeefshaik closed 2 years ago

hafeefshaik commented 4 years ago

Describe your environment. Describe any aspect of your environment relevant to the question: SDK version: Latest on nuget. .NET runtime version (.NET 4.7.2): Hosting Info (Azure WebApps): Platform and OS version: Windows

How can i enable below application insights setting through .Net SDK

image

Below is my application insights config.

<?xml version="1.0" encoding="utf-8"?>

search|spider|crawl|Bot|Monitor|AlwaysOn True core.windows.net core.chinacloudapi.cn core.cloudapi.de core.usgovcloudapi.net Microsoft.Azure.EventHubs Microsoft.Azure.ServiceBus Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler System.Web.StaticFileHandler System.Web.Handlers.AssemblyResourceLoader System.Web.Optimization.BundleHandler System.Web.Script.Services.ScriptHandlerFactory System.Web.Handlers.TraceHandler System.Web.Services.Discovery.DiscoveryRequestHandler System.Web.HttpDebugHandler 5 Event 5 Event
rajkumar-rangaraj commented 4 years ago

@hafeefshaik, Profiler option is enabled only when application insights is turned on in Recommended mode. Profiler cannot be enabled through SDK. Please follow instruction in this article

hafeefshaik commented 4 years ago

@rajkumar-rangaraj I tried both recommended and basic. The behaviour is same. Can you please help how can I enable snapshot and sql?

pdonovan commented 4 years ago

I have the same problem. The message implies that we have to enable the .NET SDK on the "APM instance" - I don't know how we do that, but I don't think it's related to our code.

In our case we're running an ASP.NET Core web app in an App Service. Stack is set to .NET Core, Platform is 32-bit.

rajkumar-rangaraj commented 4 years ago

Hello @hafeefshaik / @pdonovan , this is the github repo for the .NET Application Insights SDK. CLR profilers cannot be enabled through .NET SDK. In app service this is enabled through Application Insights Agent. They don't have a public repository. To get support you'll need to open a support ticket from your Application Insights resource. image

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 7 days.

patrickCode commented 3 years ago

Change the Collection level to "Recommended", then you will be able to switch ON the Profiler

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

Piedone commented 1 year ago

I think the real issue here is that the hint referees to the .NET SDK being disabled, while it actually isn't. If the wording would refer to the collection level, there wouldn't be any confusion.

robert-lara commented 1 year ago

For those who are here years later, I had to toggle "Collection level" to disabled and back to recommended to see the options to enable and disable other options. This is complete a bug on Azure's part and you will not find this solution in any of the tutorials listed above.

langemol commented 1 year ago

For Apps running on a Linux App Service Plan you need to enable profiling within your code by adding the Nuget package dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore and adding builder.Services.AddServiceProfiler(); to Program.cs https://learn.microsoft.com/en-us/azure/azure-monitor/profiler/profiler-aspnetcore-linux?tabs=enablement#set-up-the-project-locally