Skip to content

Commit 7ed945b

Browse files
authored
fix: Update excluded processes for Azure Linux App Service (#2873)
* Exclude `kuduagent.dll` from instrumentation. Resolves #2871 * Add an exclusion for `./DiagServer` commandline
1 parent ed5ba08 commit 7ed945b

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/Agent/NewRelic/Home/Home.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</Target>
1414

1515
<ItemGroup>
16-
<PackageReference Include="NewRelic.Agent.Internal.Profiler" Version="10.31.0.36"/>
16+
<PackageReference Include="NewRelic.Agent.Internal.Profiler" Version="10.33.1.6"/>
1717
</ItemGroup>
1818

1919
</Project>

src/Agent/NewRelic/Profiler/Configuration/Configuration.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,12 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
563563
{
564564
//If it contains MsBuild, it is a build command and should not be profiled.
565565
bool isMsBuildInvocation = NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("MSBuild.dll"));
566-
bool isKudu = NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("Kudu.Services.Web"));
566+
bool isKudu = NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("Kudu.Services.Web")) ||
567+
// kuduagent.dll is a new version of kudu (maybe KuduLite) in recent versions of Linux Azure App Services
568+
NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("kuduagent.dll"));
569+
// DiagServer is a short-lived process that seems to be invoked every 5 minutes in recent versions of Linux Azure App Services.
570+
bool isDiagServer = NewRelic::Profiler::Strings::ContainsCaseInsensitive(commandLine, _X("./DiagServer"));
571+
567572

568573
std::vector<xstring_t> out;
569574
Tokenize(commandLine, out);
@@ -600,7 +605,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration {
600605
}
601606
}
602607

603-
if (isMsBuildInvocation || isKudu) {
608+
if (isMsBuildInvocation || isKudu || isDiagServer) {
604609
LogInfo(L"This process will not be instrumented. Command line identified as invalid invocation for instrumentation");
605610
return false;
606611
}

src/Agent/NewRelic/Profiler/ConfigurationTest/ShouldInstrumentTest.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ namespace NewRelic { namespace Profiler { namespace Configuration { namespace Te
4141
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("app1.exe | dotnet run"), isCoreClr));
4242
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("dotnet Kudu.Services.Web.dll"), isCoreClr));
4343
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("/opt/Kudu/Kudu.Services.Web"), isCoreClr));
44+
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("/appservice/dotnet/dotnet /appservice/kuduagent/kuduagent.dll"), isCoreClr));
45+
Assert::IsFalse(configuration.ShouldInstrument(processPath, L"", appPoolId, _X("./DiagServer"), isCoreClr));
4446

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

0 commit comments

Comments
 (0)