open-telemetry / opentelemetry-dotnet-instrumentation

OpenTelemetry .NET Automatic Instrumentation
https://opentelemetry.io
Apache License 2.0
368 stars 91 forks source link

multiple profilers can be attached to otel-auto-instrumentation #2297

Open muhaook opened 1 year ago

muhaook commented 1 year ago

I think sooner or later we will have requirements to profile otel-auto-instrumentation. e.g. to find out where the CPU spike is or where large memory is used, etc.

as far as I know, CLR profiling API has a limitation that it can be used only once in a process. and most of .net profiler tools are using CLR profiling API. it may mean we can not use another profiler tool to profile otel-auto-instrumentation.

had discussions on slack https://cloud-native.slack.com/archives/C01NR1YLSE7/p1678207992006149

@RassK mentioned some kind of a multiplexer and then can attach multiple profilers

Use this git issue to track if we can have sth implemented so that multiple profilers can be attached to otel-auto-instrumentation

muhaook commented 1 year ago

Comments from @pjanotti : Notice that on Windows, tools like PerfViewuse ETW events not a CLR Profiler . The key question is if the application is .NET Framework or a .NET one. If .NET Framework PerfViewshould work for CPU profiler. If it is .NET we could use dotnet trace, although, it has some limitations.

pharring commented 12 months ago

The CLR Instrumentation Engine (aka CLRIE) is a multiplexer for CLR profilers: https://github.com/microsoft/CLRInstrumentationEngine

You'll need to use it if you want to run in Azure App Service, for example.