Skip to content

Commit

Permalink
fix: Update excluded processes for Azure Linux App Service (#2873)
Browse files Browse the repository at this point in the history
* Exclude `kuduagent.dll` from instrumentation. Resolves #2871
* Add an exclusion for `./DiagServer` commandline
  • Loading branch information
tippmar-nr authored Nov 4, 2024
1 parent ed5ba08 commit 7ed945b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Agent/NewRelic/Home/Home.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</Target>

<ItemGroup>
<PackageReference Include="NewRelic.Agent.Internal.Profiler" Version="10.31.0.36"/>
<PackageReference Include="NewRelic.Agent.Internal.Profiler" Version="10.33.1.6"/>
</ItemGroup>

</Project>
9 changes: 7 additions & 2 deletions src/Agent/NewRelic/Profiler/Configuration/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,12 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
{
//If it contains MsBuild, it is a build command and should not be profiled.
bool isMsBuildInvocation = NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("MSBuild.dll"));
bool isKudu = NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("Kudu.Services.Web"));
bool isKudu = NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("Kudu.Services.Web")) ||
// kuduagent.dll is a new version of kudu (maybe KuduLite) in recent versions of Linux Azure App Services
NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("kuduagent.dll"));
// DiagServer is a short-lived process that seems to be invoked every 5 minutes in recent versions of Linux Azure App Services.
bool isDiagServer = NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("./DiagServer"));


std::vector<xstring_t> out;
Tokenize(commandLine, out);
Expand Down Expand Up @@ -600,7 +605,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
}
}

if (isMsBuildInvocation || isKudu) {
if (isMsBuildInvocation || isKudu || isDiagServer) {
LogInfo(L"This process will not be instrumented. Command line identified as invalid invocation for instrumentation");
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ namespace NewRelic { namespace Profiler { namespace Configuration { namespace Te
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("app1.exe | dotnet run"), isCoreClr));
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("dotnet Kudu.Services.Web.dll"), isCoreClr));
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("/opt/Kudu/Kudu.Services.Web"), isCoreClr));
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("/appservice/dotnet/dotnet /appservice/kuduagent/kuduagent.dll"), isCoreClr));
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("./DiagServer"), isCoreClr));

Assert::IsTrue(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("dotnetXexe restore"), isCoreClr));
Assert::IsTrue(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("\"c:\\program files\\dotnet.exe\"run"), isCoreClr));
Expand Down

0 comments on commit 7ed945b

Please sign in to comment.