Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] profiler auto-instrumention not working in win10 IIS #2485

Closed
ysj2018 opened this issue Nov 19, 2024 · 4 comments
Closed

[BUG] profiler auto-instrumention not working in win10 IIS #2485

ysj2018 opened this issue Nov 19, 2024 · 4 comments
Labels
bug Something isn't working community question Further information is requested

Comments

@ysj2018
Copy link

ysj2018 commented Nov 19, 2024

I would like to use Elastic APM's profiler auto-instrumentation to monitor our .NET application. I first tested it on Windows 10, but the profiling was unsuccessful. I followed the steps described on the official website:

  1. I downloaded the Elastic APM Profiler version 1.30.0 and extracted it to a directory on Windows 10.
  2. I created a basic application using .NET 5.0.408 (which provides a page with a button that, when clicked, uses HttpClient to access Baidu) (the test was functional).
  3. I packaged it into a specific directory.
  4. I enabled IIS features on Windows 10:
  • .NET Extensibility 4.6
  • ASP
  • ASP.NET 4.6
  1. I created an application pool (selected "No Managed Code" for the .NET CLR version and "Integrated" for the managed pipeline mode).
  2. I created a website (assigned port 8081).
  3. I published the application to the specified path of the website, and the application was functional.
  4. I modified the web.config file to add environment variables with the following configuration:
xml<?xml version="1.0" encoding="utf-8"?><configuration>  <location path="." inheritInChildApplications="false">    <system.webServer>      <handlers>        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />      </handlers>      <aspNetCore processPath="dotnet" arguments=".\WebApplication3.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">        <environmentVariables>          <environmentVariable name="ELASTIC_APM_SERVICE_NAME" value="dotnettest" />          <environmentVariable name="COR_ENABLE_PROFILING" value="1" />          <environmentVariable name="COR_PROFILER_PATH" value="D:\agent\elastic_apm_profiler.dll" />          <environmentVariable name="ELASTIC_APM_PROFILER_HOME" value="D:\agent\" />          <environmentVariable name="ELASTIC_APM_PROFILER_INTEGRATIONS" value="D:\agent\integrations.yml" />          <environmentVariable name="ELASTIC_APM_SERVER_URL" value="http://localhost:8200" />          <environmentVariable name="ELASTIC_OTEL_LOG_LEVEL" value="trace" />          <environmentVariable name="ELASTIC_OTEL_LOG_DIRECTORY" value="D:\agent\logs" />          <environmentVariable name="ELASTIC_APM_APPLICATION_PACKAGES" value="D:\IIS\" />          <environmentVariable name="ELASTIC_APM_PROFILER_LOG_DIR" value="D:\agent\log" />          <environmentVariable name="COR_PROFILER" value="{FA65FE15-F085-4681-9B20-95E04F6C03CC}" />        </environmentVariables>      </aspNetCore>    </system.webServer>  </location></configuration>
  1. I restarted the application, and the application was accessible normally, but I did not see any trace data (I had APM Server 7.10 running and configured to output data to Kafka), nor did I see any profiler loading logs.
  2. I restored the web.config and directly configured the variables as system variables, then restarted the application, but still did not see the profiler being loaded.

What could be the possible reasons? Are there any issues with my operations?

@ysj2018 ysj2018 added the bug Something isn't working label Nov 19, 2024
@stevejgordon
Copy link
Contributor

@ysj2018, Have you viewed the profiler documentation? We provide a script to configure the environment variables against the app pool. Using web.config is untested for ASP.NET Core.

You have used the incorrect environment variables for your app. For ASP.NET Core (.NET 5+) you should be using:

CORECLR_ENABLE_PROFILING = "1"
CORECLR_PROFILER = "{FA65FE15-F085-4681-9B20-95E04F6C03CC}"
CORECLR_PROFILER_PATH = "$profilerHomeDir\elastic_apm_profiler.dll"

COR_PROFILER etc. is for .NET Framework.

Please try using the documented scripting approach to enable profiling, and let us know if you have any issues after that.

@stevejgordon stevejgordon added question Further information is requested and removed triage labels Nov 19, 2024
@ysj2018
Copy link
Author

ysj2018 commented Nov 19, 2024

Thank you for your answer. On Windows 10, I can get results by using a script to add environment variables. However, I have tried adding system variables before, but they didn't take effect. So, for previous versions of Windows, is it currently not supported to add a variable for each application?

@stevejgordon
Copy link
Contributor

The script should work on IIS10 on all versions of Windows. It sets the environment variables on the AppPool, not system environment variables.

@stevejgordon
Copy link
Contributor

@ysj2018 I will close this issue and switch the conversation to your discuss post. There isn't a bug to address here, and questions are best kept on the forum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants