[POC] Run integration tests in ci (#216)
* Run managed integration tests in ci * - update EnvironmentHelper from upstream - fixes for non windows - add nuke output scan * fix mongodb integrations namespace * Fix linux otel binary string def * Fix linux tests * Add debug output to MockZipkinCollector * add profiler logs artifacts * fix upload artifacts always * Ensure profiler logs directory * temp switch build to debug * fix cmake version for mac * Fix cmake version for Ubuntu
This commit is contained in:
parent
81510ceacb
commit
eb76b27b4b
|
@ -42,11 +42,18 @@ jobs:
|
|||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
|
||||
- name: Run './build.cmd Workflow'
|
||||
run: ./build.cmd Workflow
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: always()
|
||||
with:
|
||||
name: profiler-logs
|
||||
path: build_data/profiler-logs
|
||||
ubuntu-latest:
|
||||
name: ubuntu-latest
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Downgrade CMake
|
||||
run: sudo ./build/artifacts/downgrade-cmake-ubuntu.sh
|
||||
- name: Cache .nuke/temp, ~/.nuget/packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
@ -56,11 +63,21 @@ jobs:
|
|||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
|
||||
- name: Run './build.cmd Workflow'
|
||||
run: ./build.cmd Workflow
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: always()
|
||||
with:
|
||||
name: profiler-logs
|
||||
path: build_data/profiler-logs
|
||||
macOS-latest:
|
||||
name: macOS-latest
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Downgrade CMake
|
||||
run: ./build/artifacts/downgrade-cmake-macos.sh
|
||||
- name: Update GitHub PATH
|
||||
run: |
|
||||
echo "/Applications/CMake.app/Contents/bin" >> $GITHUB_PATH
|
||||
- name: Cache .nuke/temp, ~/.nuget/packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
@ -70,3 +87,8 @@ jobs:
|
|||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
|
||||
- name: Run './build.cmd Workflow'
|
||||
run: ./build.cmd Workflow
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: always()
|
||||
with:
|
||||
name: profiler-logs
|
||||
path: build_data/profiler-logs
|
||||
|
|
|
@ -9,15 +9,16 @@
|
|||
<CsharpProject Include="src\**\*.csproj" />
|
||||
<CppProject Include="src\**\*.vcxproj"/>
|
||||
<CppTestProject Include="test\**\*.vcxproj"/>
|
||||
<SampleProject Include="test\test-applications\**\*.csproj" />
|
||||
<SampleProject Include="test\test-applications\integrations\**\*.csproj" />
|
||||
<IntegrationProject Include="test\integration-tests\**\*.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Restore">
|
||||
<MSBuild Targets="Restore" Projects="@(CsharpProject);@(CppProject);@(SampleProject)"/>
|
||||
<MSBuild Targets="Restore" Projects="@(CsharpProject);@(CppProject);@(SampleProject);@(IntegrationProject)"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="Clean">
|
||||
<MSBuild Targets="Clean" Projects="@(CsharpProject);@(CppProject);@(SampleProject)"/>
|
||||
<MSBuild Targets="Clean" Projects="@(CsharpProject);@(CppProject);@(SampleProject);@(IntegrationProject)"/>
|
||||
</Target>
|
||||
|
||||
<!-- default target -->
|
||||
|
@ -43,6 +44,16 @@
|
|||
</MSBuild>
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildCsharpTest">
|
||||
<MSBuild Targets="Restore" Projects="@(SampleProject);@(IntegrationProject)">
|
||||
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
|
||||
</MSBuild>
|
||||
|
||||
<MSBuild Targets="Build" Projects="@(SampleProject);@(IntegrationProject)">
|
||||
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
|
||||
</MSBuild>
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildCpp">
|
||||
<MSBuild Targets="Build" Projects="@(CppProject)" Condition="'$(Platform)' == 'x64' OR '$(Platform)' == 'All'" Properties="Platform=x64">
|
||||
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
|
||||
|
|
|
@ -92,11 +92,11 @@ EndProject
|
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTests.Helpers", "test\integration-tests\IntegrationTests.Helpers\IntegrationTests.Helpers.csproj", "{20B74D4B-B777-4E33-AE1F-7D536DFA6BE6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test-applications", "test-applications", "{91A299AD-6C09-4B7F-BD8B-A705D9BFC672}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
test\test-applications\Directory.Build.props = test\test-applications\Directory.Build.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "integrations", "integrations", "{E409ADD3-9574-465C-AB09-4324D205CC7C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
test\test-applications\integrations\Directory.Build.props = test\test-applications\integrations\Directory.Build.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.GraphQL", "test\test-applications\integrations\Samples.GraphQL\Samples.GraphQL.csproj", "{63FD1231-345F-461E-A9C2-237ED305ED11}"
|
||||
EndProject
|
||||
|
@ -104,7 +104,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ClrProfiler.M
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "mocks", "mocks", "{E3ABDF7D-4592-4923-907C-D351DDF1CBE9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ClrProfiler.Managed.Mock", "mocks\OpenTelemetry.ClrProfiler.Managed.Mock\OpenTelemetry.ClrProfiler.Managed.Mock.csproj", "{F0A045FD-AC09-4D33-92B8-E03E728B7F95}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ClrProfiler.Managed.Mock", "test\test-applications\mocks\OpenTelemetry.ClrProfiler.Managed.Mock\OpenTelemetry.ClrProfiler.Managed.Mock.csproj", "{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -350,18 +350,18 @@ Global
|
|||
{735434B9-6555-4DEE-97FC-786C763CA1F1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{735434B9-6555-4DEE-97FC-786C763CA1F1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{735434B9-6555-4DEE-97FC-786C763CA1F1}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95}.Release|x86.Build.0 = Release|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Release|x64.Build.0 = Release|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -392,7 +392,8 @@ Global
|
|||
{E409ADD3-9574-465C-AB09-4324D205CC7C} = {91A299AD-6C09-4B7F-BD8B-A705D9BFC672}
|
||||
{63FD1231-345F-461E-A9C2-237ED305ED11} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
|
||||
{735434B9-6555-4DEE-97FC-786C763CA1F1} = {5C915382-C886-457D-8641-9E766D8E5A17}
|
||||
{F0A045FD-AC09-4D33-92B8-E03E728B7F95} = {E3ABDF7D-4592-4923-907C-D351DDF1CBE9}
|
||||
{E3ABDF7D-4592-4923-907C-D351DDF1CBE9} = {91A299AD-6C09-4B7F-BD8B-A705D9BFC672}
|
||||
{CF5EFBA1-A852-4D11-968D-CE6A9A46B299} = {E3ABDF7D-4592-4923-907C-D351DDF1CBE9}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
CMAKE_VERSION=3.19.8
|
||||
echo "Uninstalling brew CMake"
|
||||
brew uninstall cmake
|
||||
echo "Downloading CMake $CMAKE_VERSION"
|
||||
curl --output cmake-$CMAKE_VERSION-macos-universal.tar.gz -L https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-macos-universal.tar.gz
|
||||
echo "Extracting archive"
|
||||
tar -xzvf cmake-$CMAKE_VERSION-macos-universal.tar.gz
|
||||
echo "Copying Cmake.app to Applications"
|
||||
cp -rf ./cmake-$CMAKE_VERSION-macos-universal/CMake.app /Applications
|
||||
echo "Updating local PATH"
|
||||
touch ~/.zshrc
|
||||
grep -qxF 'export PATH=${PATH}:/Applications/CMake.app/Contents/bin' ~/.zshrc || echo 'export PATH=${PATH}:/Applications/CMake.app/Contents/bin' >> ~/.zshrc
|
||||
source ~/.zshrc
|
||||
echo "Cleaning up files"
|
||||
rm -rf ./cmake-$CMAKE_VERSION-macos-universal
|
||||
rm ./cmake-$CMAKE_VERSION-macos-universal.tar.gz
|
|
@ -0,0 +1,4 @@
|
|||
curl -sL https://cmake.org/files/v3.19/cmake-3.19.8-Linux-x86_64.sh -o cmakeinstall.sh
|
||||
chmod +x cmakeinstall.sh
|
||||
./cmakeinstall.sh --prefix=/usr/local --exclude-subdir
|
||||
rm cmakeinstall.sh
|
|
@ -25,6 +25,7 @@ partial class Build
|
|||
AbsolutePath TracerHomeDirectory => TracerHome ?? (OutputDirectory / "tracer-home");
|
||||
AbsolutePath ArtifactsDirectory => Artifacts ?? (OutputDirectory / "artifacts");
|
||||
AbsolutePath BuildDataDirectory => RootDirectory / "build_data";
|
||||
AbsolutePath ProfilerTestLogs => BuildDataDirectory / "profiler-logs";
|
||||
|
||||
Project NativeProfilerProject => Solution.GetProject(Projects.ClrProfilerNative);
|
||||
|
||||
|
@ -51,6 +52,7 @@ partial class Build
|
|||
EnsureExistingDirectory(TracerHomeDirectory);
|
||||
EnsureExistingDirectory(ArtifactsDirectory);
|
||||
EnsureExistingDirectory(BuildDataDirectory);
|
||||
EnsureExistingDirectory(ProfilerTestLogs);
|
||||
});
|
||||
|
||||
Target Restore => _ => _
|
||||
|
@ -95,6 +97,26 @@ partial class Build
|
|||
);
|
||||
});
|
||||
|
||||
Target CompileManagedTests => _ => _
|
||||
.Unlisted()
|
||||
.Description("Compiles the managed code in the test directory")
|
||||
.After(CompileManagedSrc)
|
||||
.Executes(() =>
|
||||
{
|
||||
// Always AnyCPU
|
||||
DotNetBuild(x => x
|
||||
.SetProjectFile(Solution.GetProject(Projects.Tests.ClrProfilerManagedLoaderTests))
|
||||
.SetConfiguration(BuildConfiguration)
|
||||
.SetNoRestore(true));
|
||||
|
||||
DotNetMSBuild(x => x
|
||||
.SetTargetPath(MsBuildProject)
|
||||
.SetTargetPlatform(Platform)
|
||||
.SetConfiguration(BuildConfiguration)
|
||||
.DisableRestore()
|
||||
.SetTargets("BuildCsharpTest"));
|
||||
});
|
||||
|
||||
Target CompileNativeSrc => _ => _
|
||||
.Unlisted()
|
||||
.Description("Compiles the native loader")
|
||||
|
@ -109,20 +131,6 @@ partial class Build
|
|||
.DependsOn(CompileNativeTestsWindows)
|
||||
.DependsOn(CompileNativeTestsLinux);
|
||||
|
||||
Target CompileManagedTests => _ => _
|
||||
.Unlisted()
|
||||
.Description("Compile the managed code unit tests")
|
||||
.After(CompileNativeSrc)
|
||||
.Executes(() =>
|
||||
{
|
||||
// Always AnyCPU
|
||||
DotNetBuild(x => x
|
||||
.SetProjectFile(Solution.GetProject(Projects.Tests.ClrProfilerManagedLoaderTests))
|
||||
.SetConfiguration(BuildConfiguration)
|
||||
.SetNoRestore(true)
|
||||
);
|
||||
});
|
||||
|
||||
Target PublishManagedProfiler => _ => _
|
||||
.Unlisted()
|
||||
.After(CompileManagedSrc)
|
||||
|
@ -169,15 +177,14 @@ partial class Build
|
|||
|
||||
Target RunManagedTests => _ => _
|
||||
.Unlisted()
|
||||
.Produces(BuildDataDirectory / "profiler-logs" / "*")
|
||||
.After(BuildTracer)
|
||||
.After(CompileManagedTests)
|
||||
.After(PublishMocks)
|
||||
.Executes(() =>
|
||||
{
|
||||
DotNetTest(s => s
|
||||
.SetNoBuild(true)
|
||||
.SetNoRestore(true)
|
||||
.SetConfiguration(BuildConfiguration)
|
||||
.SetProjectFile(Solution.GetProject(Projects.Tests.ClrProfilerManagedLoaderTests)));
|
||||
RunUnitTests();
|
||||
RunIntegrationTests();
|
||||
});
|
||||
|
||||
Target PublishMocks => _ => _
|
||||
|
@ -188,8 +195,8 @@ partial class Build
|
|||
{
|
||||
// publish ClrProfilerManaged moc
|
||||
var targetFrameworks = IsWin
|
||||
? TargetFrameworks
|
||||
: TargetFrameworks.Where(framework => !framework.ToString().StartsWith("net4"));
|
||||
? new[] { TargetFramework.NET461, TargetFramework.NETCOREAPP3_1 }
|
||||
: new[] { TargetFramework.NETCOREAPP3_1 };
|
||||
|
||||
DotNetPublish(s => s
|
||||
.SetProject(Solution.GetProject(Projects.Mocks.ClrProfilerManagedMock))
|
||||
|
@ -212,4 +219,41 @@ partial class Build
|
|||
.SetNoRestore(true)
|
||||
);
|
||||
});
|
||||
|
||||
private AbsolutePath GetResultsDirectory(Project proj) => BuildDataDirectory / "results" / proj.Name;
|
||||
|
||||
private void RunUnitTests()
|
||||
{
|
||||
Project[] unitTests = new[]
|
||||
{
|
||||
Solution.GetProject(Projects.Tests.ClrProfilerManagedLoaderTests)
|
||||
};
|
||||
|
||||
DotNetTest(config => config
|
||||
.SetConfiguration(BuildConfiguration)
|
||||
.SetTargetPlatformAnyCPU()
|
||||
.EnableNoRestore()
|
||||
.EnableNoBuild()
|
||||
.CombineWith(unitTests, (s, project) => s
|
||||
.EnableTrxLogOutput(GetResultsDirectory(project))
|
||||
.SetProjectFile(project)), degreeOfParallelism: 4);
|
||||
}
|
||||
|
||||
private void RunIntegrationTests()
|
||||
{
|
||||
Project[] integrationTests = Solution
|
||||
.GetProjects("IntegrationTests.*")
|
||||
.ToArray();
|
||||
|
||||
DotNetTest(config => config
|
||||
.SetConfiguration(BuildConfiguration)
|
||||
.SetTargetPlatform(Platform)
|
||||
// TODO: Remove if NetFX works
|
||||
.SetFramework(TargetFramework.NETCOREAPP3_1)
|
||||
.EnableNoRestore()
|
||||
.EnableNoBuild()
|
||||
.CombineWith(integrationTests, (s, project) => s
|
||||
.EnableTrxLogOutput(GetResultsDirectory(project))
|
||||
.SetProjectFile(project)), degreeOfParallelism: 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,20 @@ using Nuke.Common.Utilities.Collections;
|
|||
using static Nuke.Common.EnvironmentInfo;
|
||||
using static Nuke.Common.IO.FileSystemTasks;
|
||||
|
||||
/**
|
||||
* To trigger manual generation invoke:
|
||||
* nuke --generate-configuration GitHubActions_ci --host GitHubActions
|
||||
* Automatic generation disabled due artifacts upload (even if Nuke step fails)
|
||||
*/
|
||||
[GitHubActions("ci",
|
||||
GitHubActionsImage.WindowsLatest,
|
||||
GitHubActionsImage.UbuntuLatest,
|
||||
GitHubActionsImage.MacOsLatest,
|
||||
AutoGenerate = true,
|
||||
AutoGenerate = false,
|
||||
OnPushBranches = new[] { "main", "refs/tags/*" },
|
||||
OnPushExcludePaths = new[] { "docs/*" },
|
||||
OnPullRequestBranches = new[] { "*" },
|
||||
PublishArtifacts = true,
|
||||
InvokedTargets = new[] { nameof(Workflow) })]
|
||||
partial class Build : NukeBuild
|
||||
{
|
||||
|
@ -90,8 +96,9 @@ partial class Build : NukeBuild
|
|||
.DependsOn(RunNativeTests);
|
||||
|
||||
Target ManagedTests => _ => _
|
||||
.Description("Builds the managed unit tests and runs them")
|
||||
.Description("Builds the managed unit / integration tests and runs them")
|
||||
.After(Clean, BuildTracer)
|
||||
.DependsOn(CreateRequiredDirectories)
|
||||
.DependsOn(CompileManagedTests)
|
||||
.DependsOn(CompileMocks)
|
||||
.DependsOn(PublishMocks)
|
||||
|
|
|
@ -6,6 +6,9 @@ internal static class DotNetSettingsExtensions
|
|||
public static DotNetPublishSettings SetTargetPlatformAnyCPU(this DotNetPublishSettings settings)
|
||||
=> settings.SetTargetPlatform(MSBuildTargetPlatform.MSIL);
|
||||
|
||||
public static DotNetTestSettings SetTargetPlatformAnyCPU(this DotNetTestSettings settings)
|
||||
=> settings.SetTargetPlatform(MSBuildTargetPlatform.MSIL);
|
||||
|
||||
public static T SetTargetPlatformAnyCPU<T>(this T settings)
|
||||
where T : MSBuildSettings
|
||||
=> settings.SetTargetPlatform(MSBuildTargetPlatform.MSIL);
|
||||
|
@ -17,6 +20,20 @@ internal static class DotNetSettingsExtensions
|
|||
: settings.SetProperty("Platform", GetTargetPlatform(platform));
|
||||
}
|
||||
|
||||
public static DotNetTestSettings SetTargetPlatform(this DotNetTestSettings settings, MSBuildTargetPlatform platform)
|
||||
{
|
||||
return platform is null
|
||||
? settings
|
||||
: settings.SetProperty("Platform", GetTargetPlatform(platform));
|
||||
}
|
||||
|
||||
public static DotNetTestSettings EnableTrxLogOutput(this DotNetTestSettings settings, string resultsDirectory)
|
||||
{
|
||||
return settings
|
||||
.SetLogger("trx")
|
||||
.SetResultsDirectory(resultsDirectory);
|
||||
}
|
||||
|
||||
private static string GetTargetPlatform(MSBuildTargetPlatform platform) =>
|
||||
platform == MSBuildTargetPlatform.MSIL ? "AnyCPU" : platform.ToString();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -46,7 +46,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -70,7 +70,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -94,7 +94,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -118,7 +118,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -142,7 +142,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -166,7 +166,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_ExecuteAsync_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -190,7 +190,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_Execute_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_Execute_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -214,7 +214,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -238,7 +238,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -262,7 +262,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -286,7 +286,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -310,7 +310,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
},
|
||||
|
@ -334,7 +334,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.IWireProtocol_Generic_Execute_Integration",
|
||||
"action": "CallTargetModification"
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.MongoDbIntegration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.MongoDbIntegration",
|
||||
"method": "Execute",
|
||||
"signature": "00 06 01 1C 1C 1C 08 08 0A",
|
||||
"action": "ReplaceTargetMethod"
|
||||
|
@ -389,7 +389,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.MongoDbIntegration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.MongoDbIntegration",
|
||||
"method": "ExecuteGeneric",
|
||||
"signature": "00 06 1C 1C 1C 1C 08 08 0A",
|
||||
"action": "ReplaceTargetMethod"
|
||||
|
@ -415,7 +415,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.MongoDbIntegration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.MongoDbIntegration",
|
||||
"method": "ExecuteAsync",
|
||||
"signature": "00 06 1C 1C 1C 1C 08 08 0A",
|
||||
"action": "ReplaceTargetMethod"
|
||||
|
@ -441,7 +441,7 @@
|
|||
},
|
||||
"wrapper": {
|
||||
"assembly": "OpenTelemetry.ClrProfiler.Managed",
|
||||
"type": "OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb.MongoDbIntegration",
|
||||
"type": "OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb.MongoDbIntegration",
|
||||
"method": "ExecuteAsyncGeneric",
|
||||
"signature": "00 06 1C 1C 1C 1C 08 08 0A",
|
||||
"action": "ReplaceTargetMethod"
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Threading;
|
|||
using OpenTelemetry.ClrProfiler.CallTarget;
|
||||
using OpenTelemetry.ClrProfiler.Managed.Util;
|
||||
|
||||
namespace OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb
|
||||
namespace OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb
|
||||
{
|
||||
/// <summary>
|
||||
/// MongoDB.Driver.Core.WireProtocol.IWireProtocol<TResult> instrumentation
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Threading;
|
|||
using OpenTelemetry.ClrProfiler.CallTarget;
|
||||
using OpenTelemetry.ClrProfiler.Managed.Util;
|
||||
|
||||
namespace OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb
|
||||
namespace OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb
|
||||
{
|
||||
/// <summary>
|
||||
/// MongoDB.Driver.Core.WireProtocol.IWireProtocol instrumentation
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Threading;
|
|||
using OpenTelemetry.ClrProfiler.CallTarget;
|
||||
using OpenTelemetry.ClrProfiler.Managed.Util;
|
||||
|
||||
namespace OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb
|
||||
namespace OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb
|
||||
{
|
||||
/// <summary>
|
||||
/// MongoDB.Driver.Core.WireProtocol.IWireProtocol<TResult> instrumentation
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb
|
||||
namespace OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb
|
||||
{
|
||||
internal class MongoDbExecuteAsyncAttribute : MongoDbInstrumentMethodAttribute
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb
|
||||
namespace OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb
|
||||
{
|
||||
internal class MongoDbExecuteAttribute : MongoDbInstrumentMethodAttribute
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb
|
||||
namespace OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb
|
||||
{
|
||||
internal abstract class MongoDbInstrumentMethodAttribute : InstrumentMethodAttribute
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ using OpenTelemetry.ClrProfiler.Managed.Logging;
|
|||
using OpenTelemetry.ClrProfiler.Managed.Tagging;
|
||||
using OpenTelemetry.ClrProfiler.Managed.Util;
|
||||
|
||||
namespace OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb
|
||||
namespace OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracing integration for MongoDB.Driver.Core.
|
||||
|
|
|
@ -2,7 +2,7 @@ using System.Diagnostics;
|
|||
using OpenTelemetry.ClrProfiler.Managed.Tagging;
|
||||
using OpenTelemetry.ClrProfiler.Managed.Util;
|
||||
|
||||
namespace OpenTelemetry.ClrProfiler.AutoInstrumentation.MongoDb
|
||||
namespace OpenTelemetry.ClrProfiler.Managed.Instrumentations.MongoDb
|
||||
{
|
||||
internal class MongoDbTags : InstrumentationTags
|
||||
{
|
||||
|
|
|
@ -2585,11 +2585,11 @@ HRESULT CorProfiler::AddIISPreStartInitFlags(
|
|||
}
|
||||
|
||||
#ifdef LINUX
|
||||
extern uint8_t dll_start[] asm("_binary_OpenTelemetry_AutoInstrumentation_ClrProfiler_Managed_Loader_dll_start");
|
||||
extern uint8_t dll_end[] asm("_binary_OpenTelemetry_AutoInstrumentation_ClrProfiler_Managed_Loader_dll_end");
|
||||
extern uint8_t dll_start[] asm("_binary_OpenTelemetry_ClrProfiler_Managed_Loader_dll_start");
|
||||
extern uint8_t dll_end[] asm("_binary_OpenTelemetry_ClrProfiler_Managed_Loader_dll_end");
|
||||
|
||||
extern uint8_t pdb_start[] asm("_binary_OpenTelemetry_AutoInstrumentation_ClrProfiler_Managed_Loader_pdb_start");
|
||||
extern uint8_t pdb_end[] asm("_binary_OpenTelemetry_AutoInstrumentation_ClrProfiler_Managed_Loader_pdb_end");
|
||||
extern uint8_t pdb_start[] asm("_binary_OpenTelemetry_ClrProfiler_Managed_Loader_pdb_start");
|
||||
extern uint8_t pdb_end[] asm("_binary_OpenTelemetry_ClrProfiler_Managed_Loader_pdb_end");
|
||||
#endif
|
||||
|
||||
void CorProfiler::GetAssemblyAndSymbolsBytes(BYTE** pAssemblyArray, int* assemblySize, BYTE** pSymbolsArray, int* symbolsSize) const {
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace OpenTelemetry.ClrProfiler.Managed.Loader.Tests
|
|||
var directory = Directory.GetCurrentDirectory();
|
||||
Environment.SetEnvironmentVariable("OTEL_DOTNET_TRACER_HOME", $"{directory}/Profiler");
|
||||
|
||||
Console.WriteLine("Setting directory >> " + $"{directory}/Profiler");
|
||||
|
||||
var exception = Record.Exception(() => Startup.ManagedProfilerDirectory);
|
||||
// That means the assembly was loaded successfully and Initialize method was called.
|
||||
Assert.Null(exception);
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace IntegrationTests.GraphQL
|
|||
int agentPort = TcpPortProvider.GetOpenPort();
|
||||
int aspNetCorePort = TcpPortProvider.GetOpenPort();
|
||||
|
||||
using (var agent = new MockZipkinCollector(agentPort))
|
||||
using (var agent = new MockZipkinCollector(Output, agentPort))
|
||||
using (Process process = StartSample(agent.Port, arguments: null, packageVersion: string.Empty, aspNetCorePort: aspNetCorePort))
|
||||
{
|
||||
var wh = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
@ -61,7 +62,7 @@ namespace IntegrationTests.Helpers
|
|||
: string.Empty;
|
||||
}
|
||||
|
||||
public bool DebugModeEnabled { get; set; }
|
||||
public bool DebugModeEnabled { get; set; } = true;
|
||||
|
||||
public Dictionary<string, string> CustomEnvironmentVariables { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
|
@ -111,6 +112,30 @@ namespace IntegrationTests.Helpers
|
|||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetProfilerPathCandidates(string sampleApplicationOutputDirectory)
|
||||
{
|
||||
string extension = EnvironmentTools.GetOS() switch
|
||||
{
|
||||
"win" => "dll",
|
||||
"linux" => "so",
|
||||
"osx" => "dylib",
|
||||
_ => throw new PlatformNotSupportedException()
|
||||
};
|
||||
|
||||
string fileName = $"OpenTelemetry.ClrProfiler.Native.{extension}";
|
||||
|
||||
var relativePath = Path.Combine("profiler-lib", fileName);
|
||||
|
||||
if (sampleApplicationOutputDirectory != null)
|
||||
{
|
||||
yield return Path.Combine(sampleApplicationOutputDirectory, relativePath);
|
||||
}
|
||||
|
||||
yield return Path.Combine(GetExecutingProjectBin(), relativePath);
|
||||
yield return Path.Combine(GetProfilerProjectBin(), fileName);
|
||||
yield return Path.Combine(GetNukeBuildOutput(), fileName);
|
||||
}
|
||||
|
||||
public void SetEnvironmentVariables(
|
||||
int agentPort,
|
||||
int aspNetCorePort,
|
||||
|
@ -143,6 +168,7 @@ namespace IntegrationTests.Helpers
|
|||
if (DebugModeEnabled)
|
||||
{
|
||||
environmentVariables["OTEL_TRACE_DEBUG"] = "1";
|
||||
environmentVariables["OTEL_TRACE_LOG_DIRECTORY"] = Path.Combine(EnvironmentTools.GetSolutionDirectory(), "build_data", "profiler-logs");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(processToProfile))
|
||||
|
@ -221,52 +247,19 @@ namespace IntegrationTests.Helpers
|
|||
{
|
||||
if (_profilerFileLocation == null)
|
||||
{
|
||||
string extension = EnvironmentTools.GetOS() switch
|
||||
var paths = GetProfilerPathCandidates(GetSampleApplicationOutputDirectory()).ToArray();
|
||||
|
||||
foreach (var candidate in paths)
|
||||
{
|
||||
"win" => "dll",
|
||||
"linux" => "so",
|
||||
"osx" => "dylib",
|
||||
_ => throw new PlatformNotSupportedException()
|
||||
};
|
||||
|
||||
string fileName = $"OpenTelemetry.ClrProfiler.Native.{extension}";
|
||||
|
||||
var directory = GetSampleApplicationOutputDirectory();
|
||||
|
||||
var relativePath = Path.Combine(
|
||||
"profiler-lib",
|
||||
fileName);
|
||||
|
||||
_profilerFileLocation = Path.Combine(
|
||||
directory,
|
||||
relativePath);
|
||||
|
||||
// TODO: get rid of the fallback options when we have a consistent convention
|
||||
|
||||
if (!File.Exists(_profilerFileLocation))
|
||||
{
|
||||
_output?.WriteLine($"Attempt 1: Unable to find profiler at {_profilerFileLocation}.");
|
||||
// Let's try the executing directory, as dotnet publish ignores the Copy attributes we currently use
|
||||
_profilerFileLocation = Path.Combine(
|
||||
GetExecutingProjectBin(),
|
||||
relativePath);
|
||||
if (File.Exists(candidate))
|
||||
{
|
||||
_profilerFileLocation = candidate;
|
||||
_output?.WriteLine($"Found profiler at {_profilerFileLocation}.");
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
|
||||
if (!File.Exists(_profilerFileLocation))
|
||||
{
|
||||
_output?.WriteLine($"Attempt 2: Unable to find profiler at {_profilerFileLocation}.");
|
||||
// One last attempt at the actual native project directory
|
||||
_profilerFileLocation = Path.Combine(
|
||||
GetProfilerProjectBin(),
|
||||
fileName);
|
||||
}
|
||||
|
||||
if (!File.Exists(_profilerFileLocation))
|
||||
{
|
||||
throw new Exception($"Attempt 3: Unable to find profiler at {_profilerFileLocation}");
|
||||
}
|
||||
|
||||
_output?.WriteLine($"Found profiler at {_profilerFileLocation}.");
|
||||
throw new Exception($"Unable to find profiler in any of the paths: {string.Join("; ", paths)}");
|
||||
}
|
||||
|
||||
return _profilerFileLocation;
|
||||
|
@ -362,50 +355,27 @@ namespace IntegrationTests.Helpers
|
|||
return projectDir;
|
||||
}
|
||||
|
||||
public string GetSampleApplicationOutputDirectory(string packageVersion = "", string framework = "", bool usePublishFolder = true)
|
||||
public string GetSampleApplicationOutputDirectory(string packageVersion = "", string framework = "")
|
||||
{
|
||||
var targetFramework = string.IsNullOrEmpty(framework) ? GetTargetFramework() : framework;
|
||||
var binDir = Path.Combine(
|
||||
GetSampleProjectDirectory(),
|
||||
"bin");
|
||||
|
||||
string outputDir;
|
||||
|
||||
if (_samplesDirectory.Contains("aspnet"))
|
||||
{
|
||||
outputDir = Path.Combine(
|
||||
return Path.Combine(
|
||||
binDir,
|
||||
EnvironmentTools.GetBuildConfiguration(),
|
||||
"publish");
|
||||
}
|
||||
else if (EnvironmentTools.GetOS() == "win")
|
||||
{
|
||||
outputDir = Path.Combine(
|
||||
binDir,
|
||||
packageVersion,
|
||||
EnvironmentTools.GetPlatform(),
|
||||
EnvironmentTools.GetBuildConfiguration(),
|
||||
targetFramework);
|
||||
}
|
||||
else if (usePublishFolder)
|
||||
{
|
||||
outputDir = Path.Combine(
|
||||
binDir,
|
||||
packageVersion,
|
||||
EnvironmentTools.GetBuildConfiguration(),
|
||||
targetFramework,
|
||||
"publish");
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = Path.Combine(
|
||||
binDir,
|
||||
packageVersion,
|
||||
EnvironmentTools.GetBuildConfiguration(),
|
||||
targetFramework);
|
||||
}
|
||||
|
||||
return outputDir;
|
||||
return Path.Combine(
|
||||
binDir,
|
||||
packageVersion,
|
||||
EnvironmentTools.GetPlatform().ToLowerInvariant(),
|
||||
EnvironmentTools.GetBuildConfiguration(),
|
||||
targetFramework);
|
||||
}
|
||||
|
||||
public string GetTargetFramework()
|
||||
|
@ -423,20 +393,46 @@ namespace IntegrationTests.Helpers
|
|||
return $"net{_major}{_minor}{_patch ?? string.Empty}";
|
||||
}
|
||||
|
||||
private string GetProfilerProjectBin()
|
||||
private static string GetProfilerProjectBin()
|
||||
{
|
||||
string projectBinPath = Path.Combine(
|
||||
EnvironmentTools.GetSolutionDirectory(),
|
||||
"src",
|
||||
"OpenTelemetry.ClrProfiler.Native",
|
||||
"bin");
|
||||
|
||||
if (!EnvironmentTools.IsWindows())
|
||||
{
|
||||
// Check CMake output from CMakeLists.txt
|
||||
return projectBinPath;
|
||||
}
|
||||
|
||||
return Path.Combine(
|
||||
EnvironmentTools.GetSolutionDirectory(),
|
||||
"src",
|
||||
"OpenTelemetry.ClrProfiler.Native",
|
||||
"bin",
|
||||
projectBinPath,
|
||||
EnvironmentTools.GetBuildConfiguration(),
|
||||
EnvironmentTools.GetPlatform().ToLower());
|
||||
}
|
||||
|
||||
private string GetExecutingProjectBin()
|
||||
private static string GetExecutingProjectBin()
|
||||
{
|
||||
return Path.GetDirectoryName(ExecutingAssembly.Location);
|
||||
}
|
||||
|
||||
private static string GetNukeBuildOutput()
|
||||
{
|
||||
string nukeOutputPath = Path.Combine(
|
||||
EnvironmentTools.GetSolutionDirectory(),
|
||||
"bin",
|
||||
"tracer-home");
|
||||
|
||||
if (!EnvironmentTools.IsWindows())
|
||||
{
|
||||
return nukeOutputPath;
|
||||
}
|
||||
|
||||
return Path.Combine(
|
||||
nukeOutputPath,
|
||||
$"win-{EnvironmentTools.GetPlatform().ToLower()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,16 +10,20 @@ using System.Threading;
|
|||
using IntegrationTests.Helpers.Mocks;
|
||||
using IntegrationTests.Helpers.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace IntegrationTests.Helpers
|
||||
{
|
||||
public class MockZipkinCollector : IDisposable
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
private readonly HttpListener _listener;
|
||||
private readonly Thread _listenerThread;
|
||||
|
||||
public MockZipkinCollector(int port = 9080, int retries = 5)
|
||||
public MockZipkinCollector(ITestOutputHelper output, int port = 9080, int retries = 5)
|
||||
{
|
||||
_output = output;
|
||||
|
||||
// try up to 5 consecutive ports before giving up
|
||||
while (true)
|
||||
{
|
||||
|
@ -40,6 +44,8 @@ namespace IntegrationTests.Helpers
|
|||
_listenerThread = new Thread(HandleHttpRequests);
|
||||
_listenerThread.Start();
|
||||
|
||||
WriteOutput($"Running on port '{Port}'");
|
||||
|
||||
return;
|
||||
}
|
||||
catch (HttpListenerException) when (retries > 0)
|
||||
|
@ -52,6 +58,8 @@ namespace IntegrationTests.Helpers
|
|||
// always close listener if exception is thrown,
|
||||
// whether it was caught or not
|
||||
listener.Close();
|
||||
|
||||
WriteOutput("Listener shut down. Could not find available port.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,6 +138,7 @@ namespace IntegrationTests.Helpers
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
WriteOutput($"Shutting down. Total spans received: '{Spans.Count}'");
|
||||
_listener?.Stop();
|
||||
}
|
||||
|
||||
|
@ -220,5 +229,12 @@ namespace IntegrationTests.Helpers
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteOutput(string msg)
|
||||
{
|
||||
const string name = nameof(MockZipkinCollector);
|
||||
|
||||
_output.WriteLine($"[{name}]: {msg}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
<IsPackable>false</IsPackable>
|
||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||
<ProfilerOutputDirectory>$(MSBuildThisFileDirectory)\..\..\src\Datadog.Trace.ClrProfiler.Native\bin\$(Configuration)\$(Platform)</ProfilerOutputDirectory>
|
||||
<ManagedProfilerOutputDirectory Condition="'$(ManagedProfilerOutputDirectory)' == ''">$(MSBuildThisFileDirectory)\..\..\src\Datadog.Trace.ClrProfiler.Managed\bin\$(Configuration)</ManagedProfilerOutputDirectory>
|
||||
<ProfilerOutputDirectory>$(MSBuildThisFileDirectory)\..\..\..\src\OpenTelemetry.ClrProfiler.Native\bin\$(Configuration)\$(Platform)</ProfilerOutputDirectory>
|
||||
<ManagedProfilerOutputDirectory Condition="'$(ManagedProfilerOutputDirectory)' == ''">$(MSBuildThisFileDirectory)\..\..\..\src\OpenTelemetry.ClrProfiler.Managed\bin\$(Configuration)</ManagedProfilerOutputDirectory>
|
||||
|
||||
<!--These should be consolidated in a file that can be shared for the tests and samples directories -->
|
||||
<DefineConstants Condition="'$(BuildingInsideVisualStudio)'=='true' or '$(TestAllPackageVersions)'!='true'">$(DefineConstants);DEFAULT_SAMPLES</DefineConstants>
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
<ItemGroup Condition="'$(ExcludeManagedProfiler)' != 'true' and
|
||||
'$(LoadManagedProfilerFromProfilerDirectory)' != 'true' ">
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\..\src\OpenTelemetry.ClrProfiler.Managed\OpenTelemetry.ClrProfiler.Managed.csproj" />
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\..\..\src\OpenTelemetry.ClrProfiler.Managed\OpenTelemetry.ClrProfiler.Managed.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(ExcludeNativeProfiler)' != 'true'">
|
||||
|
@ -35,7 +35,7 @@
|
|||
CopyToOutputDirectory="Always"
|
||||
CopyToPublishDirectory="Always"
|
||||
Link="profiler-lib\%(RecursiveDir)\%(Filename)%(Extension)" />
|
||||
<Content Include="$(MSBuildThisFileDirectory)\..\..\integrations.json"
|
||||
<Content Include="$(MSBuildThisFileDirectory)\..\..\..\integrations.json"
|
||||
CopyToOutputDirectory="Always"
|
||||
CopyToPublishDirectory="Always"
|
||||
Link="profiler-lib\integrations.json" />
|
|
@ -23,7 +23,6 @@ namespace Samples.GraphQL
|
|||
serverOptions.AllowSynchronousIO = true
|
||||
)
|
||||
.UseContentRoot(directory)
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net461;netstandard2.0;netcoreapp3.1</TargetFrameworks>
|
||||
<AssemblyName>OpenTelemetry.ClrProfiler.Managed</AssemblyName>
|
||||
<RootNamespace>OpenTelemetry.ClrProfiler.Managed</RootNamespace>
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue