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

Log an error message when the profiler is loaded multiple times #6503

Merged
merged 3 commits into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tracer/src/Datadog.Tracer.Native/cor_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ HRESULT STDMETHODCALLTYPE CorProfiler::Initialize(IUnknown* cor_profiler_info_un
Logger::EnableDebug(true);
}

auto isRunningInAas = IsAzureAppServices();

if (profiler != nullptr)
{
if (isRunningInAas)
{
Logger::Info("The Tracer Profiler is initialized multiple times. This is expected and currently unavoidable when running in AAS.");
}
else
{
Logger::Error("The Tracer Profiler is initialized multiple times. This may cause unpredictable failures.",
" When running aspnetcore in IIS, make sure to disable managed code in the application pool settings.",
" https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/advanced?view=aspnetcore-9.0#create-the-iis-site");
}
}

CorProfilerBase::Initialize(cor_profiler_info_unknown);

// we used to bail-out if tracing was disabled, but we now allow the tracer to be loaded
Expand Down Expand Up @@ -157,7 +173,7 @@ HRESULT STDMETHODCALLTYPE CorProfiler::Initialize(IUnknown* cor_profiler_info_un
}
}

if (IsAzureAppServices())
if (isRunningInAas)
{
Logger::Info("Profiler is operating within Azure App Services context.");

Expand Down
Loading