Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7aaa065
Add regression test for dd-dotnet bundle detection bug
chojomok Jul 20, 2026
47d1935
Widen Datadog.Trace.Tools.dd_dotnet.Tests to match production TFMs
chojomok Jul 21, 2026
fa09518
Fix dd-dotnet bundle detection for dotnet <dll> launches
chojomok Jul 21, 2026
5920858
Try exact MainModule match before falling back to suffix-only
chojomok Jul 22, 2026
bd34553
Trim new comments to only explain non-obvious behavior
chojomok Jul 22, 2026
0064969
Restore unnecessarily inlined filePath variable
chojomok Jul 22, 2026
3e4a359
Make the bundle-fallback info message friendlier
chojomok Jul 22, 2026
396628a
Only surface the main-module-mismatch info message when the check fails
chojomok Jul 22, 2026
65c80e6
Add an end-to-end test for the failure output we expect to see
chojomok Jul 22, 2026
3ecc5dc
Revert "Add an end-to-end test for the failure output we expect to see"
chojomok Jul 23, 2026
39a6cb2
Skip Unix-style exact-match tests on Windows CI
chojomok Jul 23, 2026
141ac84
[dd-dotnet] Consolidate bundle detection tests
chojomok Jul 23, 2026
388925a
[dd-dotnet] Remove issue reference from test
chojomok Jul 23, 2026
2573fc9
[dd-dotnet] Detect bundle installs on Azure App Service
chojomok Jul 23, 2026
f5571c7
[dd-dotnet] Test Azure App Service bundle detection
chojomok Jul 23, 2026
9ea3509
Merge branch 'master' into mohammad/fix-bundle-detection
chojomok Jul 24, 2026
fe8a6ab
[dd-dotnet] Simplify Azure bundle detection
chojomok Jul 24, 2026
9428359
[dd-dotnet] Avoid resolving AAS main module path
chojomok Jul 24, 2026
21b9c0b
[dd-dotnet] Focus bundle detection tests on AAS
chojomok Jul 24, 2026
3476221
[dd-dotnet] Preserve bundle detection on AAS
chojomok Jul 27, 2026
7fbb973
Merge branch 'master' into mohammad/fix-bundle-detection
chojomok Jul 31, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ internal class ProcessBasicCheck
{
internal const string ClsidKey = @"SOFTWARE\Classes\CLSID\" + Utils.Profilerid + @"\InprocServer32";
internal const string Clsid32Key = @"SOFTWARE\Classes\Wow6432Node\CLSID\" + Utils.Profilerid + @"\InprocServer32";
private const string AzureAppServiceSiteNameKey = "WEBSITE_SITE_NAME";
internal const string AzureAppServiceRootPath = "/home/site/wwwroot";

public static bool Run(ProcessInfo process, IRegistryService? registryService = null)
{
Expand Down Expand Up @@ -189,9 +191,10 @@ public static bool Run(ProcessInfo process, IRegistryService? registryService =
process.EnvironmentVariables.TryGetValue(corProfilerPathKey, out var corProfilerPathValue);
process.EnvironmentVariables.TryGetValue(corProfilerPathKey32, out var corProfilerPathValue32);
process.EnvironmentVariables.TryGetValue(corProfilerPathKey64, out var corProfilerPathValue64);
var isAzureAppService = process.EnvironmentVariables.TryGetValue(AzureAppServiceSiteNameKey, out _);

string?[] valuesToCheck = { corProfilerPathValue, corProfilerPathValue32, corProfilerPathValue64 };
var isTracingUsingBundle = TracingWithBundle(valuesToCheck, process);
var isTracingUsingBundle = TracingWithBundle(valuesToCheck, process, isAzureAppService);

if (!ok && isTracingUsingBundle)
{
Expand Down Expand Up @@ -629,9 +632,8 @@ private static bool ParseBooleanConfigurationValue(string value)
or "1";
}

private static bool TracingWithBundle(string?[] profilerPathValues, ProcessInfo process)
internal static bool TracingWithBundle(string?[] profilerPathValues, ProcessInfo process, bool isAzureAppService)
{
// Get the file path of the main module (the .exe file)
string? filePath = process.MainModule;
string? directoryPath = Path.GetDirectoryName(filePath);

Expand All @@ -653,6 +655,10 @@ private static bool TracingWithBundle(string?[] profilerPathValues, ProcessInfo
{
return true;
}
else if (isAzureAppService && profilerPath is not null && profilerPath.Equals(AzureAppServiceRootPath + bundleSetupEnding, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,55 @@ public ProcessBasicChecksTests(ITestOutputHelper output)
{
}

[SkippableTheory]
[InlineData("/home/site/wwwroot/datadog/linux-x64/Datadog.Trace.ClrProfiler.Native.so")]
[InlineData("/home/site/wwwroot/datadog/linux-musl-x64/Datadog.Trace.ClrProfiler.Native.so")]
[InlineData("/home/site/wwwroot/datadog/linux-arm64/Datadog.Trace.ClrProfiler.Native.so")]
[InlineData("/home/site/wwwroot/datadog/linux-musl-arm64/Datadog.Trace.ClrProfiler.Native.so")]
public void DetectsBundleInAzureAppServiceRootWhenMainModuleIsDotnet(string profilerPath)
{
SkipOn.AllExcept(SkipOn.PlatformValue.Linux);

var environmentVariables = new Dictionary<string, string>
{
["WEBSITE_SITE_NAME"] = "app",
["CORECLR_PROFILER"] = Utils.Profilerid,
["CORECLR_ENABLE_PROFILING"] = "1",
["CORECLR_PROFILER_PATH"] = profilerPath
};
var process = new ProcessInfo("dotnet", 1, environmentVariables, "/usr/share/dotnet/dotnet", ["libcoreclr.so"]);

using var console = ConsoleHelper.Redirect();

ProcessBasicCheck.Run(process, MockRegistryService([], ProfilerPath));

console.Output.Should().Contain(TracingWithBundleProfilerPath);

console.Output.Should().NotContain(TracingWithInstallerLinux);
}

[SkippableFact]
public void DoesNotDetectBundleInAzureAppServiceRootOutsideAzureAppService()
{
SkipOn.AllExcept(SkipOn.PlatformValue.Linux);

const string profilerPath = "/home/site/wwwroot/datadog/linux-x64/Datadog.Trace.ClrProfiler.Native.so";
var environmentVariables = new Dictionary<string, string>
{
["CORECLR_PROFILER"] = Utils.Profilerid,
["CORECLR_ENABLE_PROFILING"] = "1",
["CORECLR_PROFILER_PATH"] = profilerPath
};
var process = new ProcessInfo("dotnet", 1, environmentVariables, "/usr/share/dotnet/dotnet", ["libcoreclr.so"]);

using var console = ConsoleHelper.Redirect();

ProcessBasicCheck.Run(process, MockRegistryService([], ProfilerPath));

console.Output.Should().NotContain(TracingWithBundleProfilerPath);
console.Output.Should().Contain(TracingWithInstallerLinux);
}

[SkippableFact]
[Trait("RunOnWindows", "True")]
public async Task DetectRuntime()
Expand Down
Loading