From 2687e39dccbdb4eef67c0fb06137969bef0056c4 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Tue, 25 Nov 2025 14:04:06 +0000 Subject: [PATCH 1/2] Upgrade to .NET 10 SDK - Updated nearly all projects to target .NET 10. An exception is the `Example.AutoInstrumentation` project which remains .NET 9, until we update to the latest upstream version which supports .NET 10. - Moved to centralized package management. - Replaced `Elastic.OpenTelemetry.sln` with `Elastic.OpenTelemetry.slnx`. - Removed the `End_To_End` test suite and related infrastructure, simplifying test execution logic. - Enhanced disposal logic in logging components. - Updated tests to cover .NET 10. --- .aspire/settings.json | 3 + .github/.github.csproj | 3 +- .github/workflows/prerelease.yml | 2 +- CONTRIBUTING.md | 2 +- Directory.Build.props | 2 +- Directory.Packages.props | 59 ++ Elastic.OpenTelemetry.sln | 169 ----- Elastic.OpenTelemetry.sln.DotSettings | 592 ------------------ Elastic.OpenTelemetry.slnx | 54 ++ build/build.fsproj | 14 +- build/scripts/BuildInformation.fs | 17 +- build/scripts/CommandLine.fs | 4 +- build/scripts/Targets.fs | 22 +- dotnet-tools.json | 8 +- examples/AppHost/AppHost.csproj | 7 +- .../Example.AspNetCore.Mvc.csproj | 5 +- .../Example.AspNetCore.WebApiAot.csproj | 5 +- .../Example.AutoInstrumentation/Dockerfile | 5 +- .../Example.AutoInstrumentation.csproj | 25 +- .../Example.Console/Example.Console.csproj | 29 +- .../Example.MinimalApi.csproj | 5 +- examples/Example.MinimalApi/Program.cs | 28 +- .../Example.WorkerService.csproj | 7 +- .../ServiceDefaults/ServiceDefaults.csproj | 15 +- global.json | 2 +- src/Directory.Build.props | 4 +- ...c.OpenTelemetry.AutoInstrumentation.csproj | 10 +- .../Diagnostics/CompositeLogger.cs | 6 +- .../Diagnostics/FileLogger.cs | 83 ++- .../Diagnostics/LoggerMessages.cs | 2 +- .../Elastic.OpenTelemetry.Core.csproj | 14 +- .../Elastic.OpenTelemetry.csproj | 24 +- .../Hosting/ElasticOpenTelemetryService.cs | 7 +- test-applications/WebApi/Program.cs | 2 - test-applications/WebApi/WebApi.csproj | 4 +- .../{WebApiDotNet8 => }/Program.cs | 0 .../Properties/launchSettings.json | 0 .../{WebApiDotNet8 => }/WebApiDotNet8.csproj | 2 +- .../{WebApiDotNet8 => }/WebApiDotNet8.http | 0 .../{WebApiDotNet8 => }/appsettings.json | 0 test-applications/WebApiDotNet9/Program.cs | 26 + .../Properties/launchSettings.json | 23 + test-applications/WebApiDotNet9/README.md | 4 + .../WebApiDotNet9/WebApiDotNet9.csproj | 18 + .../WebApiDotNet9/appsettings.json | 9 + ...utoInstrumentation.IntegrationTests.csproj | 9 +- .../ExampleApplicationContainer.cs | 72 --- .../PluginLoaderTests.cs | 53 +- tests/Directory.Build.props | 12 +- .../DistributedFixture/ApmUIBrowserContext.cs | 170 ----- .../DistributedApplicationFixture.cs | 143 ----- .../DotNetRunApplication.cs | 120 ---- .../DistributedFixture/ITrafficSimulator.cs | 26 - ...Elastic.OpenTelemetry.EndToEndTests.csproj | 22 - .../EndToEndOptions.cs | 49 -- .../README.md | 45 -- .../ServiceTests.cs | 48 -- .../test.runsettings | 7 - .../Aot/NativeAotCompatibilityTests.cs | 2 +- .../Elastic.OpenTelemetry.Tests.csproj | 14 +- .../InstrumentationScanningTests.cs | 7 +- 61 files changed, 475 insertions(+), 1646 deletions(-) create mode 100644 .aspire/settings.json create mode 100644 Directory.Packages.props delete mode 100644 Elastic.OpenTelemetry.sln delete mode 100644 Elastic.OpenTelemetry.sln.DotSettings create mode 100644 Elastic.OpenTelemetry.slnx rename test-applications/WebApiDotNet8/{WebApiDotNet8 => }/Program.cs (100%) rename test-applications/WebApiDotNet8/{WebApiDotNet8 => }/Properties/launchSettings.json (100%) rename test-applications/WebApiDotNet8/{WebApiDotNet8 => }/WebApiDotNet8.csproj (94%) rename test-applications/WebApiDotNet8/{WebApiDotNet8 => }/WebApiDotNet8.http (100%) rename test-applications/WebApiDotNet8/{WebApiDotNet8 => }/appsettings.json (100%) create mode 100644 test-applications/WebApiDotNet9/Program.cs create mode 100644 test-applications/WebApiDotNet9/Properties/launchSettings.json create mode 100644 test-applications/WebApiDotNet9/README.md create mode 100644 test-applications/WebApiDotNet9/WebApiDotNet9.csproj create mode 100644 test-applications/WebApiDotNet9/appsettings.json delete mode 100644 tests/AutoInstrumentation.IntegrationTests/ExampleApplicationContainer.cs delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ApmUIBrowserContext.cs delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DistributedApplicationFixture.cs delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DotNetRunApplication.cs delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ITrafficSimulator.cs delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/EndToEndOptions.cs delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/README.md delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/ServiceTests.cs delete mode 100644 tests/Elastic.OpenTelemetry.EndToEndTests/test.runsettings diff --git a/.aspire/settings.json b/.aspire/settings.json new file mode 100644 index 00000000..cac323d5 --- /dev/null +++ b/.aspire/settings.json @@ -0,0 +1,3 @@ +{ + "appHostPath": "../examples/AppHost/AppHost.csproj" +} \ No newline at end of file diff --git a/.github/.github.csproj b/.github/.github.csproj index 36ca0144..c7d7b03c 100644 --- a/.github/.github.csproj +++ b/.github/.github.csproj @@ -1,6 +1,7 @@ + - net9.0 + net10.0 False diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index f108e0c8..5b318bfa 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -27,7 +27,7 @@ jobs: uses: ./.github/workflows/bootstrap - name: Test - run: ./build.sh test --test-suite=skip-e2e + run: ./build.sh test - run: ./build.sh release -c name: Release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 12cc8d57..33da6335 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,5 +6,5 @@ NOTE: This document is a work in progress. Ensure you have the following components installed: -- .NET 9 SDK +- .NET 10 SDK - To build and run the NativeAoT tests you will require the prequisites listed at https://learn.microsoft.com/en-gb/dotnet/core/deploying/native-aot/?tabs=windows%2Cnet8#prerequisites, specifically the C++ components optionally installed with Visual Studio. \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 226a175b..2e7fb4c3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,6 +24,6 @@ - + \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 00000000..c6af938e --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,59 @@ + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Elastic.OpenTelemetry.sln b/Elastic.OpenTelemetry.sln deleted file mode 100644 index e9523357..00000000 --- a/Elastic.OpenTelemetry.sln +++ /dev/null @@ -1,169 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.9.34321.82 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.OpenTelemetry", "src\Elastic.OpenTelemetry\Elastic.OpenTelemetry.csproj", "{79C08F0E-7220-486C-AC0C-E3B287EB0B18}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E622CFF2-C6C4-40FB-BE42-7C4F2B38B75A}" - ProjectSection(SolutionItems) = preProject - src\Directory.Build.props = src\Directory.Build.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9}" -EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "build", "build\build.fsproj", "{872D0721-A4F2-405C-B0AB-036B340F1907}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AAD39891-0B70-47FA-A212-43E1AAE5DF56}" - ProjectSection(SolutionItems) = preProject - tests\.runsettings = tests\.runsettings - tests\Directory.Build.props = tests\Directory.Build.props - tests\xunit.runner.json = tests\xunit.runner.json - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.OpenTelemetry.Tests", "tests\Elastic.OpenTelemetry.Tests\Elastic.OpenTelemetry.Tests.csproj", "{22BF9223-3A6D-4197-8527-3E4E43A98A81}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = ".github", ".github\.github.csproj", "{B701E33D-D777-4BD4-A4EC-1F63FE69AF7A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.OpenTelemetry.EndToEndTests", "tests\Elastic.OpenTelemetry.EndToEndTests\Elastic.OpenTelemetry.EndToEndTests.csproj", "{B970DBE1-6A04-4014-A285-6A9F36421025}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.MinimalApi", "examples\Example.MinimalApi\Example.MinimalApi.csproj", "{397D7E8D-39C2-41D6-9D4D-F1D35666926A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.AspNetCore.Mvc", "examples\Example.AspNetCore.Mvc\Example.AspNetCore.Mvc.csproj", "{6D7D5234-BE86-46E0-A871-153FE96CD644}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.Console", "examples\Example.Console\Example.Console.csproj", "{849FAC2E-8303-4154-8560-31B22194800E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.WorkerService", "examples\Example.WorkerService\Example.WorkerService.csproj", "{863CAB86-5EB0-4E9F-B01D-F51687EC6597}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppHost", "examples\AppHost\AppHost.csproj", "{206203BD-3EBA-4E9A-8881-1189D95AB037}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceDefaults", "examples\ServiceDefaults\ServiceDefaults.csproj", "{A3D1ED4D-863B-45D7-9829-305DD33B4CE5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.AutoInstrumentation", "examples\Example.AutoInstrumentation\Example.AutoInstrumentation.csproj", "{F3AA76EC-C7D8-42DA-947D-4376B6562772}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoInstrumentation.IntegrationTests", "tests\AutoInstrumentation.IntegrationTests\AutoInstrumentation.IntegrationTests.csproj", "{782E4DC1-8186-4BAC-B2F4-89E6DF22A4DD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.OpenTelemetry.AutoInstrumentation", "src\Elastic.OpenTelemetry.AutoInstrumentation\Elastic.OpenTelemetry.AutoInstrumentation.csproj", "{B1CA9165-89D9-4D6E-AFEF-5434A8D8A672}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "k8s", "k8s", "{21E61166-2640-4E38-8108-1BA510C07110}" - ProjectSection(SolutionItems) = preProject - examples\k8s\elastic-otel-dotnet.yml = examples\k8s\elastic-otel-dotnet.yml - examples\k8s\my-dotnet-application.yml = examples\k8s\my-dotnet-application.yml - examples\k8s\README.md = examples\k8s\README.md - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.AspNetCore.WebApiAot", "examples\Example.AspNetCore.WebApiAot\Example.AspNetCore.WebApiAot.csproj", "{D985352F-6741-4BB2-8BBC-38A69F624D26}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "applications", "applications", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi", "test-applications\WebApi\WebApi.csproj", "{2A1F61D6-EE54-4ECE-9814-A2BF34957415}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApiDotNet8", "test-applications\WebApiDotNet8\WebApiDotNet8\WebApiDotNet8.csproj", "{C8C543F8-5C7A-4748-A3E8-658D79E3FDC1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.OpenTelemetry.Core", "src\Elastic.OpenTelemetry.Core\Elastic.OpenTelemetry.Core.csproj", "{C5E2CD91-3BD4-4CB8-9F82-52D600003537}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {79C08F0E-7220-486C-AC0C-E3B287EB0B18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {79C08F0E-7220-486C-AC0C-E3B287EB0B18}.Debug|Any CPU.Build.0 = Debug|Any CPU - {79C08F0E-7220-486C-AC0C-E3B287EB0B18}.Release|Any CPU.ActiveCfg = Release|Any CPU - {79C08F0E-7220-486C-AC0C-E3B287EB0B18}.Release|Any CPU.Build.0 = Release|Any CPU - {872D0721-A4F2-405C-B0AB-036B340F1907}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {872D0721-A4F2-405C-B0AB-036B340F1907}.Debug|Any CPU.Build.0 = Debug|Any CPU - {872D0721-A4F2-405C-B0AB-036B340F1907}.Release|Any CPU.ActiveCfg = Release|Any CPU - {872D0721-A4F2-405C-B0AB-036B340F1907}.Release|Any CPU.Build.0 = Release|Any CPU - {22BF9223-3A6D-4197-8527-3E4E43A98A81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {22BF9223-3A6D-4197-8527-3E4E43A98A81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {22BF9223-3A6D-4197-8527-3E4E43A98A81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {22BF9223-3A6D-4197-8527-3E4E43A98A81}.Release|Any CPU.Build.0 = Release|Any CPU - {B701E33D-D777-4BD4-A4EC-1F63FE69AF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B701E33D-D777-4BD4-A4EC-1F63FE69AF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B701E33D-D777-4BD4-A4EC-1F63FE69AF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B701E33D-D777-4BD4-A4EC-1F63FE69AF7A}.Release|Any CPU.Build.0 = Release|Any CPU - {B970DBE1-6A04-4014-A285-6A9F36421025}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B970DBE1-6A04-4014-A285-6A9F36421025}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B970DBE1-6A04-4014-A285-6A9F36421025}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B970DBE1-6A04-4014-A285-6A9F36421025}.Release|Any CPU.Build.0 = Release|Any CPU - {397D7E8D-39C2-41D6-9D4D-F1D35666926A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {397D7E8D-39C2-41D6-9D4D-F1D35666926A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {397D7E8D-39C2-41D6-9D4D-F1D35666926A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {397D7E8D-39C2-41D6-9D4D-F1D35666926A}.Release|Any CPU.Build.0 = Release|Any CPU - {6D7D5234-BE86-46E0-A871-153FE96CD644}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6D7D5234-BE86-46E0-A871-153FE96CD644}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6D7D5234-BE86-46E0-A871-153FE96CD644}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6D7D5234-BE86-46E0-A871-153FE96CD644}.Release|Any CPU.Build.0 = Release|Any CPU - {849FAC2E-8303-4154-8560-31B22194800E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {849FAC2E-8303-4154-8560-31B22194800E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {849FAC2E-8303-4154-8560-31B22194800E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {849FAC2E-8303-4154-8560-31B22194800E}.Release|Any CPU.Build.0 = Release|Any CPU - {863CAB86-5EB0-4E9F-B01D-F51687EC6597}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {863CAB86-5EB0-4E9F-B01D-F51687EC6597}.Debug|Any CPU.Build.0 = Debug|Any CPU - {863CAB86-5EB0-4E9F-B01D-F51687EC6597}.Release|Any CPU.ActiveCfg = Release|Any CPU - {863CAB86-5EB0-4E9F-B01D-F51687EC6597}.Release|Any CPU.Build.0 = Release|Any CPU - {206203BD-3EBA-4E9A-8881-1189D95AB037}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {206203BD-3EBA-4E9A-8881-1189D95AB037}.Debug|Any CPU.Build.0 = Debug|Any CPU - {206203BD-3EBA-4E9A-8881-1189D95AB037}.Release|Any CPU.ActiveCfg = Release|Any CPU - {206203BD-3EBA-4E9A-8881-1189D95AB037}.Release|Any CPU.Build.0 = Release|Any CPU - {A3D1ED4D-863B-45D7-9829-305DD33B4CE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A3D1ED4D-863B-45D7-9829-305DD33B4CE5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A3D1ED4D-863B-45D7-9829-305DD33B4CE5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A3D1ED4D-863B-45D7-9829-305DD33B4CE5}.Release|Any CPU.Build.0 = Release|Any CPU - {F3AA76EC-C7D8-42DA-947D-4376B6562772}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F3AA76EC-C7D8-42DA-947D-4376B6562772}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F3AA76EC-C7D8-42DA-947D-4376B6562772}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F3AA76EC-C7D8-42DA-947D-4376B6562772}.Release|Any CPU.Build.0 = Release|Any CPU - {782E4DC1-8186-4BAC-B2F4-89E6DF22A4DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {782E4DC1-8186-4BAC-B2F4-89E6DF22A4DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {782E4DC1-8186-4BAC-B2F4-89E6DF22A4DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {782E4DC1-8186-4BAC-B2F4-89E6DF22A4DD}.Release|Any CPU.Build.0 = Release|Any CPU - {B1CA9165-89D9-4D6E-AFEF-5434A8D8A672}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1CA9165-89D9-4D6E-AFEF-5434A8D8A672}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B1CA9165-89D9-4D6E-AFEF-5434A8D8A672}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1CA9165-89D9-4D6E-AFEF-5434A8D8A672}.Release|Any CPU.Build.0 = Release|Any CPU - {D985352F-6741-4BB2-8BBC-38A69F624D26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D985352F-6741-4BB2-8BBC-38A69F624D26}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D985352F-6741-4BB2-8BBC-38A69F624D26}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D985352F-6741-4BB2-8BBC-38A69F624D26}.Release|Any CPU.Build.0 = Release|Any CPU - {2A1F61D6-EE54-4ECE-9814-A2BF34957415}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2A1F61D6-EE54-4ECE-9814-A2BF34957415}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2A1F61D6-EE54-4ECE-9814-A2BF34957415}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2A1F61D6-EE54-4ECE-9814-A2BF34957415}.Release|Any CPU.Build.0 = Release|Any CPU - {C8C543F8-5C7A-4748-A3E8-658D79E3FDC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C8C543F8-5C7A-4748-A3E8-658D79E3FDC1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C8C543F8-5C7A-4748-A3E8-658D79E3FDC1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C8C543F8-5C7A-4748-A3E8-658D79E3FDC1}.Release|Any CPU.Build.0 = Release|Any CPU - {C5E2CD91-3BD4-4CB8-9F82-52D600003537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C5E2CD91-3BD4-4CB8-9F82-52D600003537}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C5E2CD91-3BD4-4CB8-9F82-52D600003537}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C5E2CD91-3BD4-4CB8-9F82-52D600003537}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {79C08F0E-7220-486C-AC0C-E3B287EB0B18} = {E622CFF2-C6C4-40FB-BE42-7C4F2B38B75A} - {22BF9223-3A6D-4197-8527-3E4E43A98A81} = {AAD39891-0B70-47FA-A212-43E1AAE5DF56} - {B970DBE1-6A04-4014-A285-6A9F36421025} = {AAD39891-0B70-47FA-A212-43E1AAE5DF56} - {397D7E8D-39C2-41D6-9D4D-F1D35666926A} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {6D7D5234-BE86-46E0-A871-153FE96CD644} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {849FAC2E-8303-4154-8560-31B22194800E} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {863CAB86-5EB0-4E9F-B01D-F51687EC6597} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {206203BD-3EBA-4E9A-8881-1189D95AB037} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {A3D1ED4D-863B-45D7-9829-305DD33B4CE5} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {F3AA76EC-C7D8-42DA-947D-4376B6562772} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {782E4DC1-8186-4BAC-B2F4-89E6DF22A4DD} = {AAD39891-0B70-47FA-A212-43E1AAE5DF56} - {B1CA9165-89D9-4D6E-AFEF-5434A8D8A672} = {E622CFF2-C6C4-40FB-BE42-7C4F2B38B75A} - {21E61166-2640-4E38-8108-1BA510C07110} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {D985352F-6741-4BB2-8BBC-38A69F624D26} = {4E95C87B-655B-4BC3-8F2A-DF06B7AAB7E9} - {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {AAD39891-0B70-47FA-A212-43E1AAE5DF56} - {2A1F61D6-EE54-4ECE-9814-A2BF34957415} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {C8C543F8-5C7A-4748-A3E8-658D79E3FDC1} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {C5E2CD91-3BD4-4CB8-9F82-52D600003537} = {E622CFF2-C6C4-40FB-BE42-7C4F2B38B75A} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {573B2B5F-8CBB-4D52-A55A-4E65E282AAFB} - EndGlobalSection -EndGlobal diff --git a/Elastic.OpenTelemetry.sln.DotSettings b/Elastic.OpenTelemetry.sln.DotSettings deleted file mode 100644 index 15f3b96f..00000000 --- a/Elastic.OpenTelemetry.sln.DotSettings +++ /dev/null @@ -1,592 +0,0 @@ - - HINT - <?xml version="1.0" encoding="utf-16"?><Profile name="Quick Reformat"><FSReformatCode>True</FSReformatCode><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><CSReformatCode>True</CSReformatCode><IDEA_SETTINGS>&lt;profile version="1.0"&gt; - &lt;option name="myName" value="Quick Reformat" /&gt; - &lt;inspection_tool class="ES6ShorthandObjectProperty" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="JSArrowFunctionBracesCanBeRemoved" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="JSPrimitiveTypeWrapperUsage" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="JSRemoveUnnecessaryParentheses" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="JSUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="TypeScriptExplicitMemberType" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="UnnecessaryContinueJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="UnnecessaryLabelJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="UnnecessaryLabelOnBreakStatementJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="UnnecessaryLabelOnContinueStatementJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="UnnecessaryReturnJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; - &lt;inspection_tool class="WrongPropertyKeyValueDelimiter" enabled="false" level="WEAK WARNING" enabled_by_default="false" /&gt; -&lt;/profile&gt;</IDEA_SETTINGS><RIDER_SETTINGS>&lt;profile&gt; - &lt;Language id="AsciiDoc"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="CSS"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;Rearrange&gt;false&lt;/Rearrange&gt; - &lt;/Language&gt; - &lt;Language id="EditorConfig"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Gherkin"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="HTML"&gt; - &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;Rearrange&gt;false&lt;/Rearrange&gt; - &lt;/Language&gt; - &lt;Language id="HTTP Request"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Handlebars"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Ini"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="JSON"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Jade"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="JavaScript"&gt; - &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;Rearrange&gt;false&lt;/Rearrange&gt; - &lt;/Language&gt; - &lt;Language id="Markdown"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="PowerShell"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Properties"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="RELAX-NG"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Rust"&gt; - &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="SQL"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="TOML"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="XML"&gt; - &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;Rearrange&gt;false&lt;/Rearrange&gt; - &lt;/Language&gt; - &lt;Language id="yaml"&gt; - &lt;Reformat&gt;false&lt;/Reformat&gt; - &lt;/Language&gt; -&lt;/profile&gt;</RIDER_SETTINGS></Profile> - Licensed to Elasticsearch B.V under one or more agreements. -Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -See the LICENSE file in the project root for more information - True - True - 56A87048-9065-459B-826D-3DF68B409845/d:Views - - *.Doc.cs - True - HINT - <?xml version="1.0" encoding="utf-16"?><Profile name="SilentCodeCleanUp"><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><HtmlReformatCode>True</HtmlReformatCode><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>ALWAYS_IMPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSReorderTypeMembers>True</CSReorderTypeMembers><JsInsertSemicolon>True</JsInsertSemicolon><JsReformatCode>True</JsReformatCode><JsFormatDocComments>True</JsFormatDocComments><XMLReformatCode>True</XMLReformatCode><CssReformatCode>True</CssReformatCode><CssAlphabetizeProperties>True</CssAlphabetizeProperties><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><CSArrangeQualifiers>True</CSArrangeQualifiers><CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" /><IDEA_SETTINGS>&lt;profile version="1.0"&gt; - &lt;option name="myName" value="SilentCodeCleanUp" /&gt; -&lt;/profile&gt;</IDEA_SETTINGS><CSUpdateFileHeader>True</CSUpdateFileHeader><RIDER_SETTINGS>&lt;profile&gt; - &lt;Language id="AsciiDoc"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="CSS"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;Rearrange&gt;true&lt;/Rearrange&gt; - &lt;/Language&gt; - &lt;Language id="EditorConfig"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Gherkin"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="HTML"&gt; - &lt;OptimizeImports&gt;true&lt;/OptimizeImports&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;Rearrange&gt;true&lt;/Rearrange&gt; - &lt;/Language&gt; - &lt;Language id="HTTP Request"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Handlebars"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Ini"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="JSON"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Jade"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="JavaScript"&gt; - &lt;OptimizeImports&gt;true&lt;/OptimizeImports&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;Rearrange&gt;true&lt;/Rearrange&gt; - &lt;/Language&gt; - &lt;Language id="Markdown"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="PowerShell"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Properties"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="RELAX-NG"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="Rust"&gt; - &lt;OptimizeImports&gt;true&lt;/OptimizeImports&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="SQL"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="TOML"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; - &lt;Language id="XML"&gt; - &lt;OptimizeImports&gt;true&lt;/OptimizeImports&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;Rearrange&gt;true&lt;/Rearrange&gt; - &lt;/Language&gt; - &lt;Language id="yaml"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; -&lt;/profile&gt;</RIDER_SETTINGS></Profile> - SilentCodeCleanUp - SilentCodeCleanUp - False - OPTIMAL_FILL - 0 - 1 - 0 - 1 - 0 - TOGETHER_SAME_LINE - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - Tab - True - IF_OWNER_IS_SINGLE_LINE - IF_OWNER_IS_SINGLE_LINE - True - IF_OWNER_IS_SINGLE_LINE - True - True - False - True - True - False - False - True - True - True - True - False - CHOP_IF_LONG - 150 - CHOP_IF_LONG - DoNotTouch - DoNotTouch - <?xml version="1.0" encoding="utf-16"?> -<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> - <TypePattern DisplayName="COM interfaces or structs" RemoveRegions="All" Priority="100"> - <TypePattern.Match> - <Or> - <And> - <Kind Is="Interface" /> - <Or> - <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> - <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> - </Or> - </And> - <Kind Is="Struct" /> - </Or> - </TypePattern.Match> - </TypePattern> - <TypePattern DisplayName="Interfaces"> - <TypePattern.Match> - <Kind Is="Interface" /> - </TypePattern.Match> - <Entry DisplayName="Properties First"> - <Entry.Match> - <Kind Is="Property" /> - </Entry.Match> - <Entry.SortBy> - <Kind Is="Member" /> - <Name /> - </Entry.SortBy> - </Entry> - <Entry DisplayName="Rest sorted by kind and name"> - <Entry.SortBy> - <Kind Is="Member" /> - <Name /> - </Entry.SortBy> - </Entry> - </TypePattern> - <TypePattern DisplayName="Default Pattern" RemoveRegions="All" Priority="0"> - <Entry DisplayName="Public Delegates" Priority="100"> - <Entry.Match> - <And> - <Access Is="Public" /> - <Kind Is="Delegate" /> - </And> - </Entry.Match> - <Entry.SortBy> - <Name /> - </Entry.SortBy> - </Entry> - <Entry DisplayName="Public Enums" Priority="100"> - <Entry.Match> - <And> - <Access Is="Public" /> - <Kind Is="Enum" /> - </And> - </Entry.Match> - <Entry.SortBy> - <Name /> - </Entry.SortBy> - </Entry> - <Entry DisplayName="Static Fields and Constants"> - <Entry.Match> - <Or> - <Kind Is="Constant" /> - <And> - <Kind Is="Field" /> - <Static /> - </And> - </Or> - </Entry.Match> - <Entry.SortBy> - <Kind Is="Member" /> - <Name /> - </Entry.SortBy> - </Entry> - <Entry DisplayName="Readonly Fields"> - <Entry.Match> - <And> - <And> - <Kind Is="Field" /> - <Not> - <Static /> - </Not> - <Readonly /> - </And> - </And> - </Entry.Match> - <Entry.SortBy> - <Access /> - <Readonly /> - <Name /> - </Entry.SortBy> - </Entry> - <Entry DisplayName="Constructors"> - <Entry.Match> - <Kind Is="Constructor" /> - </Entry.Match> - <Entry.SortBy> - <Static /> - </Entry.SortBy> - </Entry> - <Entry DisplayName="Abstract members"> - <Entry.Match> - <Abstract /> - </Entry.Match> - <Entry.SortBy> - <Kind Is="Member" /> - <Name /> - </Entry.SortBy> - </Entry> - <Entry DisplayName="Properties, Indexers, Assignable Fields"> - <Entry.Match> - <Or> - <Kind Is="Property" /> - <Kind Is="Indexer" /> - <And> - <Kind Is="Field" /> - <Not> - <Readonly /> - </Not> - </And> - </Or> - </Entry.Match> - <Entry.SortBy> - <Name /> - </Entry.SortBy> - </Entry> - <Entry DisplayName="All other members" /> - <Entry DisplayName="Nested Types"> - <Entry.Match> - <Kind Is="Type" /> - </Entry.Match> - </Entry> - </TypePattern> -</Patterns> - <Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns"> - - <!--Do not reorder COM interfaces--> - <Pattern RemoveAllRegions="true"> - <Match> - <And Weight="100"> - <Kind Is="interface"/> - <HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/> - </And> - </Match> - </Pattern> - - <!--Special formatting of NUnit test fixture--> - <Pattern RemoveAllRegions="true"> - <Match> - <And Weight="100"> - <Kind Is="class"/> - <HasAttribute CLRName="NUnit.Framework.TestFixtureAttribute" Inherit="true"/> - </And> - </Match> - - <!--Setup/Teardown--> - <Entry> - <Match> - <And> - <Kind Is="method"/> - <Or> - <HasAttribute CLRName="NUnit.Framework.SetUpAttribute" Inherit="true"/> - <HasAttribute CLRName="NUnit.Framework.TearDownAttribute" Inherit="true"/> - <HasAttribute CLRName="NUnit.Framework.FixtureSetUpAttribute" Inherit="true"/> - <HasAttribute CLRName="NUnit.Framework.FixtureTearDownAttribute" Inherit="true"/> - </Or> - </And> - </Match> - </Entry> - - <!--All other members--> - <Entry/> - - <!--Test methods--> - <Entry> - <Match> - <And Weight="100"> - <Kind Is="method"/> - <HasAttribute CLRName="NUnit.Framework.TestAttribute" Inherit="false"/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - </Entry> - </Pattern> - - <!--Default pattern--> - <Pattern RemoveAllRegions="true"> - - <!--Delegates--> - <Entry> - <Match> - <And Weight="100"> - <Access Is="public"/> - <Kind Is="delegate"/> - </And> - </Match> - <Sort> - <Access Order="public internal protected-internal protected private" /> - <Name/> - </Sort> - </Entry> - - <!--Fields and constants--> - <Entry> - <Match> - <Or> - <Kind Is="field"/> - <Kind Is="constant"/> - </Or> - </Match> - <Sort> - <Access Order="public internal protected-internal protected private" /> - <Kind Order="constant"/> - <Readonly/> - <Static/> - <Name/> - </Sort> - </Entry> - - <!--Enums--> - <Entry> - <Match> - <Kind Is="enum"/> - </Match> - <Sort> - <Access Order="public internal protected-internal protected private" /> - <Name/> - </Sort> - </Entry> - - <!--Constructors. Place static one first--> - <Entry> - <Match> - <Kind Is="constructor"/> - </Match> - <Sort> - <Static/> - <Access Order="public internal protected-internal protected private" /> - </Sort> - </Entry> - - <!--Destructors. Place static one first--> - <Entry> - <Match> - <Kind Is="destructor"/> - </Match> - <Sort> - <Static/> - <Access Order="public internal protected-internal protected private" /> - </Sort> - </Entry> - - <!-- Events --> - <Entry> - <Match> - <Kind Is="event"/> - </Match> - <Sort> - <Access Order="public internal protected-internal protected private" /> - <Name/> - </Sort> - </Entry> - - <!--Properties--> - <Entry> - <Match> - <And> - <Kind Is="property"/> - <Not> - <Kind Is="indexer"/> - </Not> - </And> - </Match> - <Sort> - <Access Order="public internal protected-internal protected private" /> - <Static/> - <Abstract/> - <Virtual/> - <Override/> - <Name/> - </Sort> - </Entry> - - <!--Indexers--> - <Entry> - <Match> - <Kind Is="indexer"/> - </Match> - <Sort> - <Access Order="public internal protected-internal protected private" /> - <Static/> - <Abstract/> - <Virtual/> - <Override/> - <Name/> - </Sort> - </Entry> - - <!--Methods--> - <Entry> - <Match> - <And> - <Or> - <Kind Is="method"/> - <Kind Is="operator"/> - <HandlesEvent /> - </Or> - <Not> - <Kind Is="destructor"/> - </Not> - </And> - </Match> - <Sort> - <Access Order="public internal protected-internal protected private" /> - <Static/> - <Abstract/> - <Virtual/> - <Override/> - <Name/> - </Sort> - </Entry> - - <!--all other members--> - <Entry/> - - <!--nested types--> - <Entry> - <Match> - <Kind Is="type"/> - </Match> - <Sort> - <Access Order="public internal protected-internal protected private" /> - <Static/> - <Abstract/> - <Virtual/> - <Override/> - <Name/> - </Sort> - </Entry> - </Pattern> -</Patterns> - CustomLayout - False - False - False - True - Replace - True - False - True - Default body (from options) - True - Default body (from options) - True - False - KM - UI - False - True - True - True - True - True - True - True - True - False - True - HotTrack - Hack - (?<=\W|^)(?<TAG>HACK)(\W|$)(.*) - Warning - True - True - True - True - True - True - True - True - True - True - True diff --git a/Elastic.OpenTelemetry.slnx b/Elastic.OpenTelemetry.slnx new file mode 100644 index 00000000..af7ea526 --- /dev/null +++ b/Elastic.OpenTelemetry.slnx @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/build.fsproj b/build/build.fsproj index 271f9db0..5f0da37f 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -1,20 +1,18 @@ - net9.0 + net10.0 Exe $(NoWarn);NU1701 false - - - - - - - + + + + + diff --git a/build/scripts/BuildInformation.fs b/build/scripts/BuildInformation.fs index 30d4679f..c9964b76 100644 --- a/build/scripts/BuildInformation.fs +++ b/build/scripts/BuildInformation.fs @@ -16,7 +16,7 @@ open Fake.Tools.Git type Paths = static member Root = let mutable dir = DirectoryInfo(".") - while dir.GetFiles("*.sln").Length = 0 do dir <- dir.Parent + while dir.GetFiles("*.slnx").Length = 0 do dir <- dir.Parent Environment.CurrentDirectory <- dir.FullName dir @@ -38,12 +38,12 @@ type Software = static member GithubMoniker = $"%s{Software.Organization}/%s{Software.Repository}" static member SignKey = "069ca2728db333c1" - static let queryPackageRef upstreamPackage distroPackage = - let path = Paths.SrcPath [distroPackage; $"{distroPackage}.csproj"] + static let queryPackageRef upstreamPackage = + let path = DirectoryInfo(Path.Combine(Paths.Root.FullName, "Directory.Packages.props")) let project = XDocument.Load(path.FullName) - let packageRef = project.XPathSelectElement($"//PackageReference[@Include = '{upstreamPackage}']") + let packageRef = project.XPathSelectElement $"//PackageVersion[@Include = '{upstreamPackage}']" let upstreamVersion = packageRef.Attribute("Version").Value - SemVer.parse(upstreamVersion) + SemVer.parse upstreamVersion static let restore = Lazy((fun _ -> exec { run "dotnet" "tool" "restore" }), LazyThreadSafetyMode.ExecutionAndPublication) @@ -63,14 +63,11 @@ type Software = static member OpenTelemetryAutoInstrumentationVersion = let upstreamPackage = "OpenTelemetry.AutoInstrumentation"; - let distroPackage = $"Elastic.{upstreamPackage}" - queryPackageRef upstreamPackage distroPackage + queryPackageRef upstreamPackage static member OpenTelemetryVersion = let upstreamPackage = "OpenTelemetry"; - let distroPackage = $"Elastic.{upstreamPackage}" - queryPackageRef upstreamPackage distroPackage - + queryPackageRef upstreamPackage type OS = | OSX | Windows | Linux diff --git a/build/scripts/CommandLine.fs b/build/scripts/CommandLine.fs index 7b0ac5a8..78ebd209 100644 --- a/build/scripts/CommandLine.fs +++ b/build/scripts/CommandLine.fs @@ -9,7 +9,7 @@ open Microsoft.FSharp.Reflection open System open Bullseye -type TestSuite = All | Unit | Integration | E2E | Skip_All | Skip_E2E +type TestSuite = All | Unit | Integration | Skip_All with member this.SuitName = match FSharpValue.GetUnionFields(this, typeof) with @@ -24,7 +24,6 @@ type Build = | [] Unit_Test | [] Integrate - | [] End_To_End | [] Format @@ -53,7 +52,6 @@ with | Unit_Test -> "alias to providing: test --test-suite=unit" | Integrate -> "alias to providing: test --test-suite=integration" - | End_To_End -> "alias to providing: test --test-suite=e2e" | Test -> "runs a clean build and then runs all the tests unless --test-suite is provided" | Release -> "runs build, tests, and create and validates the packages shy of publishing them" | Format -> "runs dotnet format" diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index a0afe06d..91f17e0f 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -57,33 +57,24 @@ let private pristineCheck (arguments:ParseResults) = let private runTests suite _ = let logger = - // use junit xml logging locally, github actions logs using console out formats match BuildServer.isGitHubActionsBuild with | true -> "--logger:\"GitHubActions;summary.includePassedTests=false;summary.includeNotFoundTests=false\"" - | false -> - let testOutputPath = Paths.ArtifactPath "tests" - let junitOutput = Path.Combine(testOutputPath.FullName, "junit-{assembly}-{framework}-test-results.xml") - let loggerPathArgs = $"LogFilePath=%s{junitOutput}" - $"--logger:\"junit;%s{loggerPathArgs}\"" + | false -> "" + let filterArgs = match suite with - | All -> [ "--filter"; "FullyQualifiedName!~.EndToEndTests" ] + | All -> [] | Skip_All -> ["--filter"; "FullyQualifiedName~.SKIPPING.ALL.TESTS"] | Unit -> [ "--filter"; "FullyQualifiedName~.Tests" ] | Integration -> [ "--filter"; "FullyQualifiedName~.IntegrationTests" ] - | E2E -> [ "--filter"; "FullyQualifiedName~.EndToEndTests" ] - | Skip_E2E -> [ "--filter"; "FullyQualifiedName!~.EndToEndTests" ] - let settingsArg = ["-s"; "tests/.runsettings"] let tfmArgs = - if OS.Current = Windows then [] - elif suite.Equals(E2E) then ["-f"; "net8.0"] - else ["-f"; "net9.0"] + if OS.Current = Windows then [] + else ["-f"; "net10.0"] exec { env (Map ["TEST_SUITE", suite.SuitName]) run "dotnet" ( ["test"; "-c"; "release"; "--no-restore"; "--no-build"; logger] - @ settingsArg @ filterArgs @ tfmArgs @ ["--"; "RunConfiguration.CollectSourceInformation=true"] @@ -100,7 +91,7 @@ let private test (arguments:ParseResults) = | _ -> runTests suite arguments let private validateLicenses _ = - let args = ["-t"; "-i"; "Elastic.OpenTelemetry.sln"; + let args = ["-t"; "-i"; "Elastic.OpenTelemetry.slnx"; "--allowed-license-types";"build/allowed-licenses.json"; "--exclude-projects-matching"; "build/exclude-license-check.json"; "--ignored-packages"; "build/ignored-packages-license-check.json" "-o"; "JsonPretty"] @@ -172,7 +163,6 @@ let Setup (parsed:ParseResults) = | Compile -> Build.Step compile | Build -> Build.Cmd [Clean; CheckFormat; Compile] [] build - | End_To_End -> Build.Cmd [] [Build] <| runTests E2E | Integrate -> Build.Cmd [] [Build] <| runTests Integration | Unit_Test -> Build.Cmd [] [Build] <| runTests Unit | Test -> Build.Cmd [] [Build] test diff --git a/dotnet-tools.json b/dotnet-tools.json index 144988cd..75a00c24 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -3,25 +3,25 @@ "isRoot": true, "tools": { "minver-cli": { - "version": "5.0.0", + "version": "6.0.0", "commands": [ "minver" ] }, "assembly-differ": { - "version": "0.16.0", + "version": "0.17.0", "commands": [ "assembly-differ" ] }, "release-notes": { - "version": "0.6.0", + "version": "0.10.0", "commands": [ "release-notes" ] }, "nupkg-validator": { - "version": "0.7.0", + "version": "0.10.1", "commands": [ "nupkg-validator" ] diff --git a/examples/AppHost/AppHost.csproj b/examples/AppHost/AppHost.csproj index 51d51cc0..4d75b4de 100644 --- a/examples/AppHost/AppHost.csproj +++ b/examples/AppHost/AppHost.csproj @@ -1,17 +1,18 @@ - + Exe - net9.0 + net10.0 enable enable true + true - + diff --git a/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj b/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj index b232d593..92b82d9d 100644 --- a/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj +++ b/examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj @@ -1,11 +1,12 @@ - net9.0 + net10.0 enable enable Linux 1efafe93-6112-431d-b30f-786205a20ebe + true @@ -14,7 +15,7 @@ - + diff --git a/examples/Example.AspNetCore.WebApiAot/Example.AspNetCore.WebApiAot.csproj b/examples/Example.AspNetCore.WebApiAot/Example.AspNetCore.WebApiAot.csproj index 69f9f79b..30a230c7 100644 --- a/examples/Example.AspNetCore.WebApiAot/Example.AspNetCore.WebApiAot.csproj +++ b/examples/Example.AspNetCore.WebApiAot/Example.AspNetCore.WebApiAot.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable true @@ -9,10 +9,11 @@ 205c18a1-356e-4e59-b15f-2a297cb8d4b8 true latest + true - + diff --git a/examples/Example.AutoInstrumentation/Dockerfile b/examples/Example.AutoInstrumentation/Dockerfile index c34b2737..61eb8b65 100644 --- a/examples/Example.AutoInstrumentation/Dockerfile +++ b/examples/Example.AutoInstrumentation/Dockerfile @@ -18,7 +18,7 @@ ADD https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/relea RUN chmod +x otel-dotnet-auto-install.sh RUN OTEL_DOTNET_AUTO_HOME="/app/otel" sh otel-dotnet-auto-install.sh -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build_example +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build_example ENV _PROJECT="Example.AutoInstrumentation" ENV _PROJECTPATH="${_PROJECT}/${_PROJECT}.csproj" WORKDIR /work @@ -32,10 +32,11 @@ RUN dotnet build "${_PROJECT}.csproj" -c Release -o /app/build_example FROM build_example AS publish_example RUN dotnet publish "Example.AutoInstrumentation.csproj" -c Release -o /app/example /p:UseAppHost=false -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build_distro +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build_distro ENV _PROJECT="Elastic.OpenTelemetry" ENV _PROJECTPATH="${_PROJECT}/${_PROJECT}.csproj" WORKDIR /work +COPY "Directory.Packages.props" "Directory.Packages.props" COPY ["src/${_PROJECTPATH}", "src/${_PROJECT}/"] RUN dotnet restore "src/${_PROJECTPATH}" COPY . . diff --git a/examples/Example.AutoInstrumentation/Example.AutoInstrumentation.csproj b/examples/Example.AutoInstrumentation/Example.AutoInstrumentation.csproj index 06bd7cc3..b5aa541d 100644 --- a/examples/Example.AutoInstrumentation/Example.AutoInstrumentation.csproj +++ b/examples/Example.AutoInstrumentation/Example.AutoInstrumentation.csproj @@ -1,17 +1,18 @@ - - Exe - net9.0 - enable - enable - Linux - + + Exe + net9.0 + enable + enable + Linux + true + - - - .dockerignore - - + + + .dockerignore + + diff --git a/examples/Example.Console/Example.Console.csproj b/examples/Example.Console/Example.Console.csproj index 19251a4a..2e5994e4 100644 --- a/examples/Example.Console/Example.Console.csproj +++ b/examples/Example.Console/Example.Console.csproj @@ -1,20 +1,21 @@ - - Exe - net9.0 - enable - enable - + + Exe + net10.0 + enable + enable + true + - - - - - + + + + + - - - + + + diff --git a/examples/Example.MinimalApi/Example.MinimalApi.csproj b/examples/Example.MinimalApi/Example.MinimalApi.csproj index 7101206b..46f16a29 100644 --- a/examples/Example.MinimalApi/Example.MinimalApi.csproj +++ b/examples/Example.MinimalApi/Example.MinimalApi.csproj @@ -1,10 +1,11 @@  - net9.0 + net10.0 enable enable 4b1d6eb4-a323-4148-8195-1ec759984c7d + true @@ -13,7 +14,7 @@ - + diff --git a/examples/Example.MinimalApi/Program.cs b/examples/Example.MinimalApi/Program.cs index f207b9d6..08ff003e 100644 --- a/examples/Example.MinimalApi/Program.cs +++ b/examples/Example.MinimalApi/Program.cs @@ -15,12 +15,12 @@ // You can customize options here if needed }; -//// Force small batch size and no delay for quicker exports in this example -builder.Services.Configure(o => -{ - o.BatchExportProcessorOptions.MaxExportBatchSize = 1; - o.BatchExportProcessorOptions.ScheduledDelayMilliseconds = 1; -}); +// Force small batch size and no delay for quicker exports in this example +//builder.Services.Configure(o => +//{ +// o.BatchExportProcessorOptions.MaxExportBatchSize = 1; +// o.BatchExportProcessorOptions.ScheduledDelayMilliseconds = 1; +//}); //builder.Services.AddOpenTelemetry() // .WithTracing(t => t @@ -28,16 +28,16 @@ // .AddSource(Api.ActivitySourceName) // .AddProcessor(new CustomProcessor()))); -builder.Services.AddOpenTelemetry() - .WithElasticTracing(builder.Configuration, t => t - .AddSource(Api.ActivitySourceName) - .AddProcessor(new CustomProcessor())); +//builder.Services.AddOpenTelemetry() +// .WithElasticTracing(builder.Configuration, t => t +// .AddSource(Api.ActivitySourceName) +// .AddProcessor(new CustomProcessor())); // Preferred method to add Elastic OpenTelemetry integration -//builder.AddElasticOpenTelemetry(options, otelBuilder => otelBuilder -// .WithTracing(t => t -// .AddSource(Api.ActivitySourceName) -// .AddProcessor(new CustomProcessor()))); +builder.AddElasticOpenTelemetry(otelBuilder => otelBuilder + .WithTracing(t => t + .AddSource(Api.ActivitySourceName) + .AddProcessor(new CustomProcessor()))); builder.AddServiceDefaults(); diff --git a/examples/Example.WorkerService/Example.WorkerService.csproj b/examples/Example.WorkerService/Example.WorkerService.csproj index 808dfa2d..ec005129 100644 --- a/examples/Example.WorkerService/Example.WorkerService.csproj +++ b/examples/Example.WorkerService/Example.WorkerService.csproj @@ -1,15 +1,16 @@ - net9.0 + net10.0 enable enable dotnet-Example.Elastic.OpenTelemetry.Worker-3a9724de-5d6b-4e68-a21e-b90c655cc721 + true - - + + diff --git a/examples/ServiceDefaults/ServiceDefaults.csproj b/examples/ServiceDefaults/ServiceDefaults.csproj index e568d85f..e9871854 100644 --- a/examples/ServiceDefaults/ServiceDefaults.csproj +++ b/examples/ServiceDefaults/ServiceDefaults.csproj @@ -1,21 +1,22 @@ - net8.0;net9.0 + net8.0;net9.0;net10.0 enable enable true + true - - - - - - + + + + + + diff --git a/global.json b/global.json index 00b67cae..fe7e453b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100", + "version": "10.0.100", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 951c8867..38b8c0ef 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -29,8 +29,8 @@ - - + + diff --git a/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj b/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj index da4115eb..b67c81ef 100644 --- a/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj +++ b/src/Elastic.OpenTelemetry.AutoInstrumentation/Elastic.OpenTelemetry.AutoInstrumentation.csproj @@ -11,7 +11,7 @@ - + - + - - - + + + diff --git a/src/Elastic.OpenTelemetry.Core/Diagnostics/CompositeLogger.cs b/src/Elastic.OpenTelemetry.Core/Diagnostics/CompositeLogger.cs index 0b7950b2..bf3dcbd8 100644 --- a/src/Elastic.OpenTelemetry.Core/Diagnostics/CompositeLogger.cs +++ b/src/Elastic.OpenTelemetry.Core/Diagnostics/CompositeLogger.cs @@ -28,16 +28,14 @@ internal sealed class CompositeLogger(CompositeElasticOpenTelemetryOptions optio public void Dispose() { _isDisposed = true; - if (_additionalLogger is IDisposable ad) - ad.Dispose(); + _additionalLogger = null; FileLogger.Dispose(); } public async ValueTask DisposeAsync() { _isDisposed = true; - if (_additionalLogger is IAsyncDisposable ad) - await ad.DisposeAsync().ConfigureAwait(false); + _additionalLogger = null; await FileLogger.DisposeAsync().ConfigureAwait(false); } diff --git a/src/Elastic.OpenTelemetry.Core/Diagnostics/FileLogger.cs b/src/Elastic.OpenTelemetry.Core/Diagnostics/FileLogger.cs index 77899bd3..152d5693 100644 --- a/src/Elastic.OpenTelemetry.Core/Diagnostics/FileLogger.cs +++ b/src/Elastic.OpenTelemetry.Core/Diagnostics/FileLogger.cs @@ -19,7 +19,7 @@ internal sealed class FileLogger : IDisposable, IAsyncDisposable, ILogger private readonly LogLevel _configuredLogLevel; private readonly LoggerExternalScopeProvider _scopeProvider; - private bool _disposed; + private int _disposed; public bool FileLoggingEnabled { get; } @@ -67,20 +67,53 @@ public FileLogger(CompositeElasticOpenTelemetryOptions options) { var cancellationToken = _cancellationTokenSource.Token; - while (!cancellationToken.IsCancellationRequested) + while (true) { - await _logSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); + try + { + await _logSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); + } + catch (OperationCanceledException) + { + // Cancellation requested, exit the loop + break; + } + // Process all queued log entries while (_logQueue.TryDequeue(out var logEntry)) { - await _streamWriter.WriteLineAsync(logEntry).ConfigureAwait(false); + // Check if disposal has started before writing + if (Volatile.Read(ref _disposed) == 1) + return; + + try + { + await _streamWriter.WriteLineAsync(logEntry).ConfigureAwait(false); + } + catch (ObjectDisposedException) + { + // Stream was disposed during shutdown, exit gracefully + return; + } } } // Flush remaining log entries before exiting while (_logQueue.TryDequeue(out var logEntry)) { - await _streamWriter.WriteLineAsync(logEntry).ConfigureAwait(false); + // Check if disposal has started before writing + if (Volatile.Read(ref _disposed) == 1) + return; + + try + { + await _streamWriter.WriteLineAsync(logEntry).ConfigureAwait(false); + } + catch (ObjectDisposedException) + { + // Stream was disposed, exit gracefully + return; + } } }); @@ -130,35 +163,59 @@ public void Log(LogLevel logLevel, EventId eventId, TState state, Except public void Dispose() { - if (_disposed) + if (Interlocked.Exchange(ref _disposed, 1) != 0) return; _cancellationTokenSource.Cancel(); _logSemaphore.Release(); - WritingTask?.Wait(); + try + { + // Wait for the writing task to complete with a timeout to prevent hanging + WritingTask?.Wait(TimeSpan.FromSeconds(5)); + } + catch (AggregateException ex) when (ex.InnerException is OperationCanceledException) + { + // Expected when cancellation token is triggered + } + catch (OperationCanceledException) + { + // Expected when cancellation token is triggered + } _streamWriter.Dispose(); _logSemaphore.Dispose(); _cancellationTokenSource.Dispose(); - - _disposed = true; } public async ValueTask DisposeAsync() { - if (_disposed) + if (Interlocked.Exchange(ref _disposed, 1) != 0) return; _cancellationTokenSource.Cancel(); _logSemaphore.Release(); - await WritingTask.ConfigureAwait(false); + try + { + // Wait for the writing task to complete with a timeout to prevent hanging + await WritingTask.WaitAsync(TimeSpan.FromSeconds(5)).ConfigureAwait(false); + } + catch (TimeoutException) + { + // Task didn't complete in time, proceed with disposal + } + catch (OperationCanceledException) + { + // Expected when cancellation token is triggered + } +#if NET + await _streamWriter.DisposeAsync().ConfigureAwait(false); +#else _streamWriter.Dispose(); +#endif _logSemaphore.Dispose(); _cancellationTokenSource.Dispose(); - - _disposed = true; } } diff --git a/src/Elastic.OpenTelemetry.Core/Diagnostics/LoggerMessages.cs b/src/Elastic.OpenTelemetry.Core/Diagnostics/LoggerMessages.cs index 7ecfda58..2e8d6ab0 100644 --- a/src/Elastic.OpenTelemetry.Core/Diagnostics/LoggerMessages.cs +++ b/src/Elastic.OpenTelemetry.Core/Diagnostics/LoggerMessages.cs @@ -184,7 +184,7 @@ public static void LogDistroPreamble(this ILogger logger, SdkActivationMethod ac #if NET8_0 logger.LogDebug("Matched TFM: {TargetFrameworkMoniker}", "net8.0"); -#elif NET9_0 +#elif NET9_0_OR_GREATER logger.LogDebug("Matched TFM: {TargetFrameworkMoniker}", "net9.0"); #elif NETSTANDARD2_0 logger.LogDebug("Matched TFM: {TargetFrameworkMoniker}", "netstandard2.0"); diff --git a/src/Elastic.OpenTelemetry.Core/Elastic.OpenTelemetry.Core.csproj b/src/Elastic.OpenTelemetry.Core/Elastic.OpenTelemetry.Core.csproj index c378bb15..6c5fe4e6 100644 --- a/src/Elastic.OpenTelemetry.Core/Elastic.OpenTelemetry.Core.csproj +++ b/src/Elastic.OpenTelemetry.Core/Elastic.OpenTelemetry.Core.csproj @@ -10,16 +10,16 @@ - - - - - - + + + + + + - + diff --git a/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj index c2f5eee7..9da6874f 100644 --- a/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj +++ b/src/Elastic.OpenTelemetry/Elastic.OpenTelemetry.csproj @@ -26,30 +26,30 @@ - - - + + + - - + + - + - - + + - - + + - + - + diff --git a/src/Elastic.OpenTelemetry/Hosting/ElasticOpenTelemetryService.cs b/src/Elastic.OpenTelemetry/Hosting/ElasticOpenTelemetryService.cs index f47d33ad..c2486951 100644 --- a/src/Elastic.OpenTelemetry/Hosting/ElasticOpenTelemetryService.cs +++ b/src/Elastic.OpenTelemetry/Hosting/ElasticOpenTelemetryService.cs @@ -39,10 +39,7 @@ public Task StartingAsync(CancellationToken cancellationToken) public async Task StoppedAsync(CancellationToken cancellationToken) { - if (_components?.Logger is not null) - await _components.Logger.DisposeAsync().ConfigureAwait(false); - - if (_components?.LoggingEventListener is not null) - await _components.LoggingEventListener.DisposeAsync().ConfigureAwait(false); + if (_components is not null) + await _components.DisposeAsync().ConfigureAwait(false); } } diff --git a/test-applications/WebApi/Program.cs b/test-applications/WebApi/Program.cs index 65579294..b4973a41 100644 --- a/test-applications/WebApi/Program.cs +++ b/test-applications/WebApi/Program.cs @@ -16,5 +16,3 @@ }); app.Run(); - -public partial class Program { } diff --git a/test-applications/WebApi/WebApi.csproj b/test-applications/WebApi/WebApi.csproj index b639cb00..3eee56f0 100644 --- a/test-applications/WebApi/WebApi.csproj +++ b/test-applications/WebApi/WebApi.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable true @@ -12,7 +12,7 @@ - + diff --git a/test-applications/WebApiDotNet8/WebApiDotNet8/Program.cs b/test-applications/WebApiDotNet8/Program.cs similarity index 100% rename from test-applications/WebApiDotNet8/WebApiDotNet8/Program.cs rename to test-applications/WebApiDotNet8/Program.cs diff --git a/test-applications/WebApiDotNet8/WebApiDotNet8/Properties/launchSettings.json b/test-applications/WebApiDotNet8/Properties/launchSettings.json similarity index 100% rename from test-applications/WebApiDotNet8/WebApiDotNet8/Properties/launchSettings.json rename to test-applications/WebApiDotNet8/Properties/launchSettings.json diff --git a/test-applications/WebApiDotNet8/WebApiDotNet8/WebApiDotNet8.csproj b/test-applications/WebApiDotNet8/WebApiDotNet8.csproj similarity index 94% rename from test-applications/WebApiDotNet8/WebApiDotNet8/WebApiDotNet8.csproj rename to test-applications/WebApiDotNet8/WebApiDotNet8.csproj index 695dabf8..e634f9e7 100644 --- a/test-applications/WebApiDotNet8/WebApiDotNet8/WebApiDotNet8.csproj +++ b/test-applications/WebApiDotNet8/WebApiDotNet8.csproj @@ -12,7 +12,7 @@ - + diff --git a/test-applications/WebApiDotNet8/WebApiDotNet8/WebApiDotNet8.http b/test-applications/WebApiDotNet8/WebApiDotNet8.http similarity index 100% rename from test-applications/WebApiDotNet8/WebApiDotNet8/WebApiDotNet8.http rename to test-applications/WebApiDotNet8/WebApiDotNet8.http diff --git a/test-applications/WebApiDotNet8/WebApiDotNet8/appsettings.json b/test-applications/WebApiDotNet8/appsettings.json similarity index 100% rename from test-applications/WebApiDotNet8/WebApiDotNet8/appsettings.json rename to test-applications/WebApiDotNet8/appsettings.json diff --git a/test-applications/WebApiDotNet9/Program.cs b/test-applications/WebApiDotNet9/Program.cs new file mode 100644 index 00000000..53485aaf --- /dev/null +++ b/test-applications/WebApiDotNet9/Program.cs @@ -0,0 +1,26 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +namespace WebApiDotNet9; + +public class ProgramV9 +{ + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + var app = builder.Build(); + + app.MapGet("/", () => { }); + + app.MapGet("/http", static async ctx => + { + var client = new HttpClient(); + using var response = await client.GetAsync("https://example.com"); + ctx.Response.StatusCode = 200; + }); + + app.Run(); + } +} diff --git a/test-applications/WebApiDotNet9/Properties/launchSettings.json b/test-applications/WebApiDotNet9/Properties/launchSettings.json new file mode 100644 index 00000000..d847cc90 --- /dev/null +++ b/test-applications/WebApiDotNet9/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5134", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7208;http://localhost:5134", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/test-applications/WebApiDotNet9/README.md b/test-applications/WebApiDotNet9/README.md new file mode 100644 index 00000000..b02e98ac --- /dev/null +++ b/test-applications/WebApiDotNet9/README.md @@ -0,0 +1,4 @@ +# WebApi Test Application + +This is a .NET 9, minimal API project, used for in-memory integration testing via +the `WebApplicationBuilder` from `Microsoft.AspNetCore.Mvc.Testing`. \ No newline at end of file diff --git a/test-applications/WebApiDotNet9/WebApiDotNet9.csproj b/test-applications/WebApiDotNet9/WebApiDotNet9.csproj new file mode 100644 index 00000000..50655123 --- /dev/null +++ b/test-applications/WebApiDotNet9/WebApiDotNet9.csproj @@ -0,0 +1,18 @@ + + + + net9.0 + enable + enable + true + + + + + + + + + + + diff --git a/test-applications/WebApiDotNet9/appsettings.json b/test-applications/WebApiDotNet9/appsettings.json new file mode 100644 index 00000000..10f68b8c --- /dev/null +++ b/test-applications/WebApiDotNet9/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/tests/AutoInstrumentation.IntegrationTests/AutoInstrumentation.IntegrationTests.csproj b/tests/AutoInstrumentation.IntegrationTests/AutoInstrumentation.IntegrationTests.csproj index 76b2eb6d..2e71950b 100644 --- a/tests/AutoInstrumentation.IntegrationTests/AutoInstrumentation.IntegrationTests.csproj +++ b/tests/AutoInstrumentation.IntegrationTests/AutoInstrumentation.IntegrationTests.csproj @@ -1,16 +1,17 @@ - + - net8.0 + net10.0 enable enable + false + true Elastic.OpenTelemetry.AutoInstrumentation.IntegrationTests xUnit1041 - - + diff --git a/tests/AutoInstrumentation.IntegrationTests/ExampleApplicationContainer.cs b/tests/AutoInstrumentation.IntegrationTests/ExampleApplicationContainer.cs deleted file mode 100644 index 8f400784..00000000 --- a/tests/AutoInstrumentation.IntegrationTests/ExampleApplicationContainer.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.Runtime.InteropServices; -using DotNet.Testcontainers; -using DotNet.Testcontainers.Builders; -using DotNet.Testcontainers.Configurations; -using DotNet.Testcontainers.Containers; -using DotNet.Testcontainers.Images; -using Nullean.Xunit.Partitions; -using Nullean.Xunit.Partitions.Sdk; -using Xunit; - -[assembly: TestFramework(Partition.TestFramework, Partition.Assembly)] - -namespace Elastic.OpenTelemetry.AutoInstrumentation.IntegrationTests; - -// ReSharper disable once ClassNeverInstantiated.Global -public class ExampleApplicationContainer : IPartitionLifetime -{ - private readonly IContainer _container; - private readonly IOutputConsumer _output; - private readonly IFutureDockerImage _image; - - // docker build -t example.autoinstrumentation:latest -f examples/Example.AutoInstrumentation/Dockerfile . \ - // && docker run -it --rm -p 5000:8080 --name autoin example.autoinstrumentation:latest - - public ExampleApplicationContainer() - { - ConsoleLogger.Instance.DebugLogLevelEnabled = true; - var directory = CommonDirectoryPath.GetSolutionDirectory(); - _image = new ImageFromDockerfileBuilder() - .WithDockerfileDirectory(directory, string.Empty) - .WithDockerfile("examples/Example.AutoInstrumentation/Dockerfile") - .WithLogger(ConsoleLogger.Instance) - .WithBuildArgument("TARGETARCH", RuntimeInformation.ProcessArchitecture switch - { - Architecture.Arm64 => "arm64", - Architecture.X64 => "x64", - Architecture.X86 => "x86", - _ => "unsupported" - }) - .Build(); - - _output = Consume.RedirectStdoutAndStderrToStream(new MemoryStream(), new MemoryStream()); - _container = new ContainerBuilder() - .WithImage(_image) - .WithPortBinding(5000, 8080) - .WithLogger(ConsoleLogger.Instance) - .WithOutputConsumer(_output) - .Build(); - } - - public async Task InitializeAsync() - { - await _image.CreateAsync().ConfigureAwait(false); - - await _container.StartAsync().ConfigureAwait(false); - } - - public async Task DisposeAsync() => await _container.StopAsync().ConfigureAwait(false); - - public string FailureTestOutput() - { - _output.Stdout.Seek(0, SeekOrigin.Begin); - using var streamReader = new StreamReader(_output.Stdout, leaveOpen: true); - return streamReader.ReadToEnd(); - } - - public int? MaxConcurrency => null; -} diff --git a/tests/AutoInstrumentation.IntegrationTests/PluginLoaderTests.cs b/tests/AutoInstrumentation.IntegrationTests/PluginLoaderTests.cs index d70b6984..849d9699 100644 --- a/tests/AutoInstrumentation.IntegrationTests/PluginLoaderTests.cs +++ b/tests/AutoInstrumentation.IntegrationTests/PluginLoaderTests.cs @@ -3,19 +3,66 @@ // See the LICENSE file in the project root for more information using System.Runtime.InteropServices; -using Nullean.Xunit.Partitions.Sdk; +using DotNet.Testcontainers; +using DotNet.Testcontainers.Builders; +using DotNet.Testcontainers.Configurations; +using DotNet.Testcontainers.Containers; +using DotNet.Testcontainers.Images; using Xunit; namespace Elastic.OpenTelemetry.AutoInstrumentation.IntegrationTests; -public class PluginLoaderTests(ExampleApplicationContainer exampleApplicationContainer) : IPartitionFixture +public class PluginLoaderTests : IAsyncLifetime { + private readonly IContainer _container; + private readonly IOutputConsumer _output; + private readonly IFutureDockerImage _image; + + // docker build -t example.autoinstrumentation:latest -f examples/Example.AutoInstrumentation/Dockerfile . \ + // && docker run -it --rm -p 5000:8080 --name autoin example.autoinstrumentation:latest + + public PluginLoaderTests() + { + ConsoleLogger.Instance.DebugLogLevelEnabled = true; + var directory = CommonDirectoryPath.GetSolutionDirectory(); + _image = new ImageFromDockerfileBuilder() + .WithDockerfileDirectory(directory, string.Empty) + .WithDockerfile("examples/Example.AutoInstrumentation/Dockerfile") + .WithLogger(ConsoleLogger.Instance) + .WithBuildArgument("TARGETARCH", RuntimeInformation.ProcessArchitecture switch + { + Architecture.Arm64 => "arm64", + Architecture.X64 => "x64", + Architecture.X86 => "x86", + _ => "unsupported" + }) + .Build(); + + _output = Consume.RedirectStdoutAndStderrToStream(new MemoryStream(), new MemoryStream()); + _container = new ContainerBuilder() + .WithImage(_image) + .WithPortBinding(5000, 8080) + .WithLogger(ConsoleLogger.Instance) + .WithOutputConsumer(_output) + .Build(); + } + + public async Task InitializeAsync() + { + await _image.CreateAsync().ConfigureAwait(false); + await _container.StartAsync().ConfigureAwait(false); + } + + public async Task DisposeAsync() => await _container.StopAsync().ConfigureAwait(false); + [NotWindowsCiFact] public async Task ObserveDistributionPluginLoad() { await Task.Delay(TimeSpan.FromSeconds(3)); - var output = exampleApplicationContainer.FailureTestOutput(); + _output.Stdout.Seek(0, SeekOrigin.Begin); + using var streamReader = new StreamReader(_output.Stdout, leaveOpen: true); + var output = streamReader.ReadToEnd(); Assert.False(string.IsNullOrWhiteSpace(output)); Assert.Contains("Elastic Distribution of OpenTelemetry (EDOT) .NET:", output); diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 1d66a7e9..5ec188af 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -22,12 +22,12 @@ - - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ApmUIBrowserContext.cs b/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ApmUIBrowserContext.cs deleted file mode 100644 index 3a22c9f2..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ApmUIBrowserContext.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.Runtime.CompilerServices; -using Microsoft.Extensions.Configuration; -using Microsoft.Playwright; -using Xunit; - -namespace Elastic.OpenTelemetry.EndToEndTests.DistributedFixture; - -public class ApmUIBrowserContext : IAsyncLifetime -{ - private readonly IConfigurationRoot _configuration; - private readonly string _serviceName; - private readonly string _playwrightScreenshotsDir; - private readonly List _output; - - public ApmUIBrowserContext(IConfigurationRoot configuration, string serviceName, string playwrightScreenshotsDir, List output) - { - _configuration = configuration; - _serviceName = serviceName; - _playwrightScreenshotsDir = playwrightScreenshotsDir; - _output = output; - - //"https://{instance}.apm.us-east-1.aws.elastic.cloud:443" - // https://{instance}.kb.us-east-1.aws.elastic.cloud/app/apm/services?comparisonEnabled=true&environment=ENVIRONMENT_ALL&rangeFrom=now-15m&rangeTo=now&offset=1d - var endpoint = configuration["E2E:Endpoint"]?.Trim() ?? string.Empty; - var newBase = endpoint.Replace(".apm.", ".kb."); - KibanaAppUri = new Uri($"{newBase}/app/apm"); - } - - public Uri KibanaAppUri { get; } - - public IBrowser Browser { get; private set; } = null!; - public IPlaywright HeadlessTester { get; private set; } = null!; - - private const string BootstrapTraceName = "test_bootstrap"; - - public async Task InitializeAsync() - { - var username = _configuration["E2E:BrowserEmail"]?.Trim() ?? string.Empty; - var password = _configuration["E2E:BrowserPassword"]?.Trim() ?? string.Empty; - Program.Main(["install", "chromium"]); - HeadlessTester = await Playwright.CreateAsync(); - Browser = await HeadlessTester.Chromium.LaunchAsync(); - var page = await OpenApmLandingPage(BootstrapTraceName); - try - { - await page.GetByRole(AriaRole.Textbox, new() { Name = "email" }).FillAsync(username); - await page.GetByRole(AriaRole.Textbox, new() { Name = "password" }).FillAsync(password); - await page.GetByRole(AriaRole.Button, new() { Name = "Log in" }).ClickAsync(); - - await WaitForServiceOnOverview(page); - - StorageState = await page.Context.StorageStateAsync(); - - await StopTrace(page, success: true); - } - catch (Exception e) - { - await StopTrace(page, success: false); - Console.WriteLine(e); - throw; - } - } - - public string? StorageState { get; set; } - - public async Task NewProfiledPage(string testName) - { - var page = await Browser.NewPageAsync(new() { StorageState = StorageState }); - await page.Context.Tracing.StartAsync(new() - { - Title = testName, - Screenshots = true, - Snapshots = true, - Sources = false - }); - - return page; - } - - public async Task OpenApmLandingPage(string testName) - { - var page = await NewProfiledPage(testName); - await page.GotoAsync(KibanaAppUri.ToString()); - return page; - } - - private void Log(string message) - { - Console.WriteLine(message); - _output.Add(message); - } - - public async Task WaitForServiceOnOverview(IPage page) - { - var timeout = (float)TimeSpan.FromSeconds(30).TotalMilliseconds; - - var servicesHeader = page.GetByRole(AriaRole.Heading, new() { Name = "Services" }); - await servicesHeader.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = timeout }); - - await page.ScreenshotAsync(new() { Path = Path.Join(_playwrightScreenshotsDir, "services-loaded.jpeg"), FullPage = true }); - - Log($"Search for service name: {_serviceName}"); - - //service.name : dotnet-e2e-* - var queryBar = page.GetByRole(AriaRole.Searchbox, new() { Name = "Search services by name" }); - await queryBar.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = timeout }); - await queryBar.FillAsync(_serviceName); - await queryBar.PressAsync("Enter"); - - await page.ScreenshotAsync(new() { Path = Path.Join(_playwrightScreenshotsDir, "filter-services.jpeg"), FullPage = true }); - - Exception? observed = null; - - var refreshTimeout = (float)TimeSpan.FromSeconds(5).TotalMilliseconds; - for (var i = 0; i < 20; i++) - { - try - { - var serviceLink = page.GetByRole(AriaRole.Link, new() { Name = _serviceName }); - await serviceLink.WaitForAsync(new() { State = WaitForSelectorState.Visible, Timeout = refreshTimeout }); - observed = null; - break; - } - catch (Exception e) - { - observed ??= e; - } - finally - { - page.SetDefaultTimeout(refreshTimeout); - } - } - if (observed != null) - throw observed; //TODO proper rethrow with stack - } - - private int _unnamedTests; - public async Task StopTrace(IPage page, bool success, [CallerMemberName] string? testName = null) - { - testName ??= $"unknown_test_{_unnamedTests++}"; - - //only dump trace zip if tests failed - if (success) - { - await page.Context.Tracing.StopAsync(new()); - } - else - { - var root = DotNetRunApplication.GetSolutionRoot(); - var zip = Path.Combine(root.FullName, ".artifacts", "playwright-traces", $"{testName}.zip"); - await page.Context.Tracing.StopAsync(new() { Path = zip }); - - //using var archive = ZipFile.OpenRead(zip); - //var entries = archive.Entries.Where(e => e.FullName.StartsWith("resources") && e.FullName.EndsWith(".jpeg")).ToList(); - //var lastScreenshot = entries.MaxBy(e => e.LastWriteTime); - //lastScreenshot?.ExtractToFile(Path.Combine(root.FullName, ".artifacts", "playwright-traces", $"{testName}-screenshot.jpeg")); - } - await page.CloseAsync(); - } - - public async Task DisposeAsync() - { - await Browser.DisposeAsync(); - HeadlessTester.Dispose(); - } -} diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DistributedApplicationFixture.cs b/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DistributedApplicationFixture.cs deleted file mode 100644 index bad61def..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DistributedApplicationFixture.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.Globalization; -using System.Security.Cryptography; -using System.Text; -using Microsoft.Extensions.Configuration; -using Nullean.Xunit.Partitions.Sdk; -using Xunit.Abstractions; - -namespace Elastic.OpenTelemetry.EndToEndTests.DistributedFixture; - -public class DistributedApplicationFixture : IPartitionLifetime -{ - private readonly ITrafficSimulator[] _trafficSimulators = [new DefaultTrafficSimulator()]; - - public string ServiceName { get; } = $"dotnet-e2e-{ShaForCurrentTicks()}"; - - public bool Started => AspNetApplication.ProcessId.HasValue; - - public string PlaywrightScreenshotsDirectory { get; } = Path.Combine(DotNetRunApplication.GetSolutionRoot().FullName, ".artifacts", "playwright-traces", "screenshots"); - - private readonly List _output = []; - - public int? MaxConcurrency => null; - - private ApmUIBrowserContext? _apmUI; - - public ApmUIBrowserContext ApmUI - { - get => _apmUI ?? - throw new NullReferenceException($"{nameof(DistributedApplicationFixture)} no yet initialized"); - private set => _apmUI = value; - } - - private AspNetCoreExampleApplication? _aspNetApplication; - - public AspNetCoreExampleApplication AspNetApplication - { - get => _aspNetApplication - ?? throw new NullReferenceException($"{nameof(DistributedApplicationFixture)} no yet initialized"); - private set => _aspNetApplication = value; - } - - private static string ShaForCurrentTicks() - { - var buffer = Encoding.UTF8.GetBytes(DateTime.UtcNow.Ticks.ToString(DateTimeFormatInfo.InvariantInfo)); - return Convert.ToHexStringLower(SHA1.HashData(buffer)).Substring(0, 12); - } - - public string FailureTestOutput() - { - var logLines = new List(); - if (_aspNetApplication?.ProcessId.HasValue ?? false) - { - DotNetRunApplication.IterateOverLog(s => - { - Console.WriteLine(s); - logLines.Add(s); - }); - } - - var messages = string.Join(Environment.NewLine, _output.Concat(logLines)); - return messages; - - } - - public void WriteFailureTestOutput(ITestOutputHelper testOutputHelper) - { - foreach (var line in _output) - testOutputHelper.WriteLine(line); - - DotNetRunApplication.IterateOverLog(s => - { - Console.WriteLine(s); - testOutputHelper.WriteLine(s); - }); - } - - public async Task DisposeAsync() - { - _aspNetApplication?.Dispose(); - await (_apmUI?.DisposeAsync() ?? Task.CompletedTask); - } - - private void Log(string message) - { - Console.WriteLine(message); - _output.Add(message); - } - - public async Task InitializeAsync() - { - var configuration = new ConfigurationBuilder() - .AddEnvironmentVariables() - .AddUserSecrets() - .Build(); - - Log("Created configuration"); - - AspNetApplication = new AspNetCoreExampleApplication(ServiceName, configuration); - - Log("Started ASP.NET application"); - - ApmUI = new ApmUIBrowserContext(configuration, ServiceName, PlaywrightScreenshotsDirectory, _output); - - Log("Started UI Browser context"); - - foreach (var trafficSimulator in _trafficSimulators) - await trafficSimulator.Start(this); - - Log("Simulated traffic"); - - // TODO query OTEL_BSP_SCHEDULE_DELAY? - await Task.Delay(5000); - - Log("Waited for OTEL_BSP_SCHEDULE_DELAY"); - - // Stateless refresh - //https://github.com/elastic/elasticsearch/blob/main/server/src/main/java/org/elasticsearch/index/IndexSettings.java#L286 - await Task.Delay(TimeSpan.FromSeconds(15)); - - Log("Waited for Stateless refresh"); - - await ApmUI.InitializeAsync(); - } -} - -public class AspNetCoreExampleApplication : DotNetRunApplication -{ - public AspNetCoreExampleApplication(string serviceName, IConfiguration configuration) - : base(serviceName, configuration, "Example.AspNetCore.Mvc") => - HttpClient = new HttpClient { BaseAddress = new Uri("http://localhost:5247") }; - - public HttpClient HttpClient { get; } - - public override void Dispose() - { - base.Dispose(); - HttpClient.Dispose(); - } -}; diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DotNetRunApplication.cs b/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DotNetRunApplication.cs deleted file mode 100644 index dd9ca6ef..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/DotNetRunApplication.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.Reflection; -using System.Text.RegularExpressions; -using Microsoft.Extensions.Configuration; -using ProcNet; - -namespace Elastic.OpenTelemetry.EndToEndTests.DistributedFixture; - -public abstract partial class DotNetRunApplication -{ - private static readonly DirectoryInfo CurrentDirectory = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory!; - private static readonly Regex ProcessIdMatch = ProcessIdMatchRegex(); - - public static readonly DirectoryInfo Root = GetSolutionRoot(); - public static readonly DirectoryInfo LogDirectory = new(Path.Combine(Root.FullName, ".artifacts", "tests")); - - private readonly LongRunningApplicationSubscription _app; - private readonly string _applicationName; - private readonly string _authorization; - private readonly string _endpoint; - private readonly string _serviceName; - - protected DotNetRunApplication(string serviceName, IConfiguration configuration, string applicationName) - { - _serviceName = serviceName; - _applicationName = applicationName; - _endpoint = configuration["E2E:Endpoint"]?.Trim() ?? string.Empty; - _authorization = configuration["E2E:Authorization"]?.Trim() ?? string.Empty; - - var args = CreateStartArgs(); - _app = Proc.StartLongRunning(args, TimeSpan.FromSeconds(30)); - } - - public int? ProcessId { get; private set; } - - protected virtual string[] GetArguments() => []; - - public static DirectoryInfo GetSolutionRoot() - { - var root = CurrentDirectory; - while (root != null && root.GetFiles("*.sln").Length == 0) - root = root.Parent; - - if (root == null) - throw new Exception($"Could not locate root starting from {CurrentDirectory}"); - - return root; - } - - private LongRunningArguments CreateStartArgs() - { - var project = Path.Combine(Root.FullName, "examples", _applicationName); - - var arguments = new[] { "run", "--project", project }; - var applicationArguments = GetArguments(); - if (applicationArguments.Length > 0) - arguments = [.. arguments, "--", .. applicationArguments]; - - return new("dotnet", arguments) - { - Environment = new Dictionary - { - { "OTEL_EXPORTER_OTLP_ENDPOINT", _endpoint }, - { "OTEL_EXPORTER_OTLP_HEADERS", _authorization }, - { "OTEL_METRICS_EXPORTER", "otlp" }, - { "OTEL_LOGS_EXPORTER", "otlp" }, - { "OTEL_BSP_SCHEDULE_DELAY", "1000" }, - { "OTEL_BSP_MAX_EXPORT_BATCH_SIZE", "5" }, - { "OTEL_RESOURCE_ATTRIBUTES", $"service.name={_serviceName},service.version=1.0,1,deployment.environment=e2e" }, - { "ELASTIC_OTEL_LOG_DIRECTORY", LogDirectory.FullName }, - { "ELASTIC_OTEL_LOG_LEVEL", "INFO" }, - }, - StartedConfirmationHandler = l => - { - //Grab actual process id to send SIGINT to. - if (l.Line == null) - return false; - var processIdMatch = ProcessIdMatch.Match(l.Line); - if (processIdMatch.Success) - ProcessId = int.Parse(processIdMatch.Groups["processid"].Value); - - return l.Line.Contains("Application started."); - } - }; - } - - public static void IterateOverLog(Action write) - { - var logFile = LogDirectory - //TODO get last of this app specifically - //.GetFiles($"{_app.Process.Binary}_*.log") - .GetFiles($"*.log") - .MaxBy(f => f.CreationTimeUtc); - - if (logFile == null) - write($"Could not locate log files in {LogDirectory}"); - else - { - write($"Contents of: {logFile.FullName}"); - using var sr = logFile.OpenText(); - // ReSharper disable once RedundantAssignment - var s = string.Empty; - while ((s = sr.ReadLine()) != null) - write(s); - } - } - - public virtual void Dispose() - { - if (ProcessId.HasValue) - _app.SendControlC(ProcessId.Value); - _app.Dispose(); - } - - [GeneratedRegex(@"^\s*Process Id (?\d+)")] - private static partial Regex ProcessIdMatchRegex(); -} diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ITrafficSimulator.cs b/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ITrafficSimulator.cs deleted file mode 100644 index 19c316c8..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/DistributedFixture/ITrafficSimulator.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.Net; -using Xunit; - -namespace Elastic.OpenTelemetry.EndToEndTests.DistributedFixture; - -public interface ITrafficSimulator -{ - Task Start(DistributedApplicationFixture distributedInfra); -} - -public class DefaultTrafficSimulator : ITrafficSimulator -{ - public async Task Start(DistributedApplicationFixture distributedInfra) - { - for (var i = 0; i < 10; i++) - { - var get = await distributedInfra.AspNetApplication.HttpClient.GetAsync("e2e"); - Assert.Equal(HttpStatusCode.OK, get.StatusCode); - _ = await get.Content.ReadAsStringAsync(); - } - } -} diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj b/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj deleted file mode 100644 index 446b2945..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/Elastic.OpenTelemetry.EndToEndTests.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - enable - enable - false - true - xUnit1041 - 588f828e-db42-4b45-9783-023f03243753 - - - - - - - - - - - - diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/EndToEndOptions.cs b/tests/Elastic.OpenTelemetry.EndToEndTests/EndToEndOptions.cs deleted file mode 100644 index f382015b..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/EndToEndOptions.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using Elastic.OpenTelemetry.EndToEndTests; -using Elastic.OpenTelemetry.EndToEndTests.DistributedFixture; -using Microsoft.Extensions.Configuration; -using Nullean.Xunit.Partitions; -using Xunit; - -[assembly: TestFramework(Partition.TestFramework, Partition.Assembly)] -[assembly: PartitionOptions(typeof(EndToEndOptions))] - -namespace Elastic.OpenTelemetry.EndToEndTests; - -public class EndToEndOptions : PartitionOptions -{ - public override void OnBeforeTestsRun() - { - var configuration = new ConfigurationBuilder() - .AddEnvironmentVariables() - .AddUserSecrets() - .Build(); - - var testSuite = Environment.GetEnvironmentVariable("TEST_SUITE"); - - //only validate credentials if we are actually running the e2e suite - if (testSuite == null || ( - !testSuite.Equals("e2e", StringComparison.InvariantCultureIgnoreCase) - && !testSuite.Equals("all", StringComparison.InvariantCultureIgnoreCase)) - ) - return; - - try - { - Assert.False(string.IsNullOrWhiteSpace(configuration["E2E:Endpoint"]), userMessage: "Missing E2E:Endpoint configuration"); - Assert.False(string.IsNullOrWhiteSpace(configuration["E2E:Authorization"]), userMessage: "Missing E2E:Authorization configuration"); - Assert.False(string.IsNullOrWhiteSpace(configuration["E2E:BrowserEmail"]), userMessage: "Missing E2E:BrowserEmail configuration"); - Assert.False(string.IsNullOrWhiteSpace(configuration["E2E:BrowserPassword"]), userMessage: "Missing E2E:BrowserPassword configuration"); - } - catch (Exception e) - { - Console.WriteLine(); - Console.WriteLine(e.Message); - Console.WriteLine(); - throw; - } - } -} diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/README.md b/tests/Elastic.OpenTelemetry.EndToEndTests/README.md deleted file mode 100644 index 44aaede2..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# E2E Tests: Elastic's .NET OpenTelemetry Distribution - - -## Target Environment - -Requires an already running serverless observability project on cloud. - -The configuration can be provided either as asp.net secrets or environment variables. - -```bash -dotnet user-secrets set "E2E:Endpoint" "" --project tests/Elastic.OpenTelemetry.EndToEndTests -dotnet user-secrets set "E2E:Authorization" "
" --project tests/Elastic.OpenTelemetry.EndToEndTests -``` - -The equivalent environment variables are `E2E__ENDPOINT` and `E2E__AUTHORIZATION`. For local development setting -secrets is preferred. - -This ensures the instrumented applications will send OTLP data. - -## Browser authentication - -The tests require a headless browser to login. This requires a non OAuth login to be setup on your serverless -observability project. - -To do this is to invite an email address you own to your organization: - -https://cloud.elastic.co/account/members - -This user only needs instance access to the `Target Environment`. - -**NOTE:** since you can only be part of a single organization on cloud be sure that the organization you are part of is -not used for any production usecases and you have clearance from the organization owner. - -By default accounts on cloud are part of their own personal organization. - -Once invited and accepted the invited email can be used to login during the automated tests. - -These can be provided again as user secrets: - -```bash -dotnet user-secrets set "E2E:BrowserEmail" "" --project tests/Elastic.OpenTelemetry.EndToEndTests -dotnet user-secrets set "E2E:BrowserPassword" "" --project tests/Elastic.OpenTelemetry.EndToEndTests -``` - -or environment variables (`E2E__BROWSEREMAIL` and `E2E__BROWSERPASSWORD`). diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/ServiceTests.cs b/tests/Elastic.OpenTelemetry.EndToEndTests/ServiceTests.cs deleted file mode 100644 index f73edcb6..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/ServiceTests.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using Elastic.OpenTelemetry.EndToEndTests.DistributedFixture; -using Microsoft.Playwright; -using Nullean.Xunit.Partitions.Sdk; -using Xunit; -using Xunit.Abstractions; -using static Microsoft.Playwright.Assertions; - -namespace Elastic.OpenTelemetry.EndToEndTests; - -public class EndToEndTests(ITestOutputHelper output, DistributedApplicationFixture fixture) - : IPartitionFixture, IAsyncLifetime -{ - public ITestOutputHelper Output { get; } = output; - private readonly string _testName = string.Empty; - private IPage _page = null!; - - [Fact] - public void EnsureApplicationWasStarted() => Assert.True(fixture.Started); - - [Fact] - public async Task LatencyShowsAGraph() - { - var timeout = (float)TimeSpan.FromSeconds(30).TotalMilliseconds; - - // click on service in service overview page. - var uri = new Uri(fixture.ApmUI.KibanaAppUri, $"/app/apm/services/{fixture.ServiceName}/overview").ToString(); - await _page.GotoAsync(uri, new() { Timeout = timeout }); - await Expect(_page.GetByRole(AriaRole.Heading, new() { Name = "Latency", Exact = true })) - .ToBeVisibleAsync(new() { Timeout = timeout }); - } - - public async Task InitializeAsync() => _page = await fixture.ApmUI.NewProfiledPage(_testName); - - public async Task DisposeAsync() - { - var success = PartitionContext.TestException == null; - await fixture.ApmUI.StopTrace(_page, success, _testName); - - if (success) - return; - - fixture.WriteFailureTestOutput(Output); - } -} diff --git a/tests/Elastic.OpenTelemetry.EndToEndTests/test.runsettings b/tests/Elastic.OpenTelemetry.EndToEndTests/test.runsettings deleted file mode 100644 index d6211ccc..00000000 --- a/tests/Elastic.OpenTelemetry.EndToEndTests/test.runsettings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/tests/Elastic.OpenTelemetry.Tests/Aot/NativeAotCompatibilityTests.cs b/tests/Elastic.OpenTelemetry.Tests/Aot/NativeAotCompatibilityTests.cs index abe521bd..efb468df 100644 --- a/tests/Elastic.OpenTelemetry.Tests/Aot/NativeAotCompatibilityTests.cs +++ b/tests/Elastic.OpenTelemetry.Tests/Aot/NativeAotCompatibilityTests.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information // Just testing on one platform for now to speed up tests -#if NET9_0 +#if NET10_0 using System.Runtime.InteropServices; using Xunit.Abstractions; diff --git a/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj b/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj index 84619bd9..1a8976d1 100644 --- a/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj +++ b/tests/Elastic.OpenTelemetry.Tests/Elastic.OpenTelemetry.Tests.csproj @@ -1,7 +1,7 @@ - + - net8.0;net9.0 + net8.0;net9.0;net10.0 enable enable false @@ -10,15 +10,15 @@ - - - + + - - + + + diff --git a/tests/Elastic.OpenTelemetry.Tests/InstrumentationScanningTests.cs b/tests/Elastic.OpenTelemetry.Tests/InstrumentationScanningTests.cs index d41183ce..20f30ed1 100644 --- a/tests/Elastic.OpenTelemetry.Tests/InstrumentationScanningTests.cs +++ b/tests/Elastic.OpenTelemetry.Tests/InstrumentationScanningTests.cs @@ -15,6 +15,11 @@ public partial class InstrumentationScanningTests(WebApplicationFactory> { private readonly WebApplicationFactory _factory = factory; +#elif NET9_0 +public partial class InstrumentationScanningTests(WebApplicationFactory factory, ITestOutputHelper output) + : IClassFixture> +{ + private readonly WebApplicationFactory _factory = factory; #else public partial class InstrumentationScanningTests(WebApplicationFactory factory, ITestOutputHelper output) : IClassFixture> @@ -29,7 +34,7 @@ public partial class InstrumentationScanningTests(WebApplicationFactory [GeneratedRegex(@"^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\]\[\d{6}\]\[-*\]\[Debug\]\s+Added contrib instrumentation 'HTTP' to MeterProviderBuilder*")] private static partial Regex HttpMeterProviderBuilderRegex(); -#elif NET9_0 +#elif NET9_0_OR_GREATER [GeneratedRegex(@"^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\]\[\d{6}\]\[-*\]\[Debug\]\s+Added 'System.Net.Http' to TracerProviderBuilder.*")] private static partial Regex HttpTracerProviderBuilderRegex(); From 850d9b25a26048accd3ed4a074895e09c170d80a Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Wed, 26 Nov 2025 08:05:52 +0000 Subject: [PATCH 2/2] Fix typo in internal class name --- .../AutoInstrumentationPlugin.cs | 4 ++-- ...ensions.cs => ElasticTracerProviderBuilderExtensions.cs} | 2 +- .../Extensions/TracerProviderBuilderExtensions.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) rename src/Elastic.OpenTelemetry.Core/Extensions/{TracerProviderBuilderExtensions.cs => ElasticTracerProviderBuilderExtensions.cs} (99%) diff --git a/src/Elastic.OpenTelemetry.AutoInstrumentation/AutoInstrumentationPlugin.cs b/src/Elastic.OpenTelemetry.AutoInstrumentation/AutoInstrumentationPlugin.cs index 58cbe41b..d7a31848 100644 --- a/src/Elastic.OpenTelemetry.AutoInstrumentation/AutoInstrumentationPlugin.cs +++ b/src/Elastic.OpenTelemetry.AutoInstrumentation/AutoInstrumentationPlugin.cs @@ -45,8 +45,8 @@ public TracerProviderBuilder BeforeConfigureTracerProvider(TracerProviderBuilder builder.ConfigureServices(sc => sc.Configure(OtlpExporterDefaults.OtlpExporterOptions)); logger.LogConfiguredOtlpExporterOptions(); - TracerProvderBuilderExtensions.AddActivitySourceWithLogging(builder, logger, "Elastic.Transport", ""); - TracerProvderBuilderExtensions.AddElasticProcessorsCore(builder, null, _components, null); + ElasticTracerProviderBuilderExtensions.AddActivitySourceWithLogging(builder, logger, "Elastic.Transport", ""); + ElasticTracerProviderBuilderExtensions.AddElasticProcessorsCore(builder, null, _components, null); logger.LogConfiguredSignalProvider("Traces", nameof(TracerProviderBuilder), ""); diff --git a/src/Elastic.OpenTelemetry.Core/Extensions/TracerProviderBuilderExtensions.cs b/src/Elastic.OpenTelemetry.Core/Extensions/ElasticTracerProviderBuilderExtensions.cs similarity index 99% rename from src/Elastic.OpenTelemetry.Core/Extensions/TracerProviderBuilderExtensions.cs rename to src/Elastic.OpenTelemetry.Core/Extensions/ElasticTracerProviderBuilderExtensions.cs index 1d48dd8d..bd71b680 100644 --- a/src/Elastic.OpenTelemetry.Core/Extensions/TracerProviderBuilderExtensions.cs +++ b/src/Elastic.OpenTelemetry.Core/Extensions/ElasticTracerProviderBuilderExtensions.cs @@ -20,7 +20,7 @@ namespace OpenTelemetry.Trace; /// Provides extension methods on the used to register /// the Elastic Distribution of OpenTelemetry (EDOT) .NET defaults. /// -internal static class TracerProvderBuilderExtensions +internal static class ElasticTracerProviderBuilderExtensions { private static int AddElasticProcessorsCallCount; diff --git a/src/Elastic.OpenTelemetry/Extensions/TracerProviderBuilderExtensions.cs b/src/Elastic.OpenTelemetry/Extensions/TracerProviderBuilderExtensions.cs index bdb1d559..5a1b8d38 100644 --- a/src/Elastic.OpenTelemetry/Extensions/TracerProviderBuilderExtensions.cs +++ b/src/Elastic.OpenTelemetry/Extensions/TracerProviderBuilderExtensions.cs @@ -402,11 +402,11 @@ private static void ConfigureBuilder(BuilderContext build } else { - TracerProvderBuilderExtensions.AddActivitySourceWithLogging(builder, logger, "System.Net.Http", builderState.InstanceIdentifier); + Trace.ElasticTracerProviderBuilderExtensions.AddActivitySourceWithLogging(builder, logger, "System.Net.Http", builderState.InstanceIdentifier); } #endif - TracerProvderBuilderExtensions.AddActivitySourceWithLogging(builder, logger, "Elastic.Transport", builderState.InstanceIdentifier); + Trace.ElasticTracerProviderBuilderExtensions.AddActivitySourceWithLogging(builder, logger, "Elastic.Transport", builderState.InstanceIdentifier); #if NET if (RuntimeFeature.IsDynamicCodeSupported) @@ -420,7 +420,7 @@ private static void ConfigureBuilder(BuilderContext build AddAspNetCoreInstrumentation(builder, builderState); } - TracerProvderBuilderExtensions.AddElasticProcessorsCore(builder, builderState, null, services); + Trace.ElasticTracerProviderBuilderExtensions.AddElasticProcessorsCore(builder, builderState, null, services); var userProvidedConfigureBuilder = builderContext.BuilderOptions.UserProvidedConfigureBuilder; if (userProvidedConfigureBuilder is not null)