From c7dc6aeadd681dc35a89c0dfd141ae0de21cf345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Thu, 16 May 2024 22:15:28 +0200 Subject: [PATCH 1/5] [repo] Migrate shared code tests from main repository (#1806) Co-authored-by: Cijo Thomas --- ...nTelemetry.AotCompatibility.TestApp.csproj | 5 + .../Program.cs | 15 +- .../PropertyFetcherAotTest.cs | 56 +++++++ .../ActivityInstrumentationHelperTest.cs | 39 +++++ .../OpenTelemetry.Contrib.Shared.Tests.csproj | 3 + .../PropertyFetcherTest.cs | 156 ++++++++++++++++++ .../RedactionHelperTest.cs | 31 ++++ 7 files changed, 303 insertions(+), 2 deletions(-) create mode 100644 test/OpenTelemetry.AotCompatibility.TestApp/PropertyFetcherAotTest.cs create mode 100644 test/OpenTelemetry.Contrib.Shared.Tests/ActivityInstrumentationHelperTest.cs create mode 100644 test/OpenTelemetry.Contrib.Shared.Tests/PropertyFetcherTest.cs create mode 100644 test/OpenTelemetry.Contrib.Shared.Tests/RedactionHelperTest.cs diff --git a/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj b/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj index d9df364776..a4811723db 100644 --- a/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj +++ b/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj @@ -7,8 +7,13 @@ false true true + enable + + + + + + + + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/Projects/OpenTelemetry.Exporter.Geneva.proj b/build/Projects/OpenTelemetry.Exporter.Geneva.proj index 2d51435254..acdfbd03af 100644 --- a/build/Projects/OpenTelemetry.Exporter.Geneva.proj +++ b/build/Projects/OpenTelemetry.Exporter.Geneva.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Exporter.Geneva- diff --git a/build/Projects/OpenTelemetry.Exporter.OneCollector.proj b/build/Projects/OpenTelemetry.Exporter.OneCollector.proj index 534e3e326d..7ea413ce8e 100644 --- a/build/Projects/OpenTelemetry.Exporter.OneCollector.proj +++ b/build/Projects/OpenTelemetry.Exporter.OneCollector.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Exporter.OneCollector- diff --git a/build/Projects/OpenTelemetry.Extensions.proj b/build/Projects/OpenTelemetry.Extensions.proj index eb57800c45..e617435b2b 100644 --- a/build/Projects/OpenTelemetry.Extensions.proj +++ b/build/Projects/OpenTelemetry.Extensions.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Extensions- diff --git a/build/Projects/OpenTelemetry.Instrumentation.AspNet.proj b/build/Projects/OpenTelemetry.Instrumentation.AspNet.proj index e42df6e094..ffbb1c643d 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.AspNet.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.AspNet.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.AspNet- diff --git a/build/Projects/OpenTelemetry.Instrumentation.AspNetCore.proj b/build/Projects/OpenTelemetry.Instrumentation.AspNetCore.proj index 0e86e80ccf..3f550fe523 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.AspNetCore.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.AspNetCore.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.AspNetCore- diff --git a/build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj b/build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj index 28db30bced..06b2b83666 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.EventCounters.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.EventCounters- diff --git a/build/Projects/OpenTelemetry.Instrumentation.GrpcNetClient.proj b/build/Projects/OpenTelemetry.Instrumentation.GrpcNetClient.proj index 86cbf25ef5..03411cc713 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.GrpcNetClient.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.GrpcNetClient.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.GrpcNetClient- diff --git a/build/Projects/OpenTelemetry.Instrumentation.Http.proj b/build/Projects/OpenTelemetry.Instrumentation.Http.proj index 2e8b444448..5cd5154bb9 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.Http.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.Http.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.Http- diff --git a/build/Projects/OpenTelemetry.Instrumentation.Owin.proj b/build/Projects/OpenTelemetry.Instrumentation.Owin.proj index 4742b9765f..2b375f5491 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.Owin.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.Owin.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.Owin- diff --git a/build/Projects/OpenTelemetry.Instrumentation.Process.proj b/build/Projects/OpenTelemetry.Instrumentation.Process.proj index 2eb64b6afd..79dc69a913 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.Process.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.Process.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.Process- diff --git a/build/Projects/OpenTelemetry.Instrumentation.Runtime.proj b/build/Projects/OpenTelemetry.Instrumentation.Runtime.proj index b57a3a224c..3386a32a56 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.Runtime.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.Runtime.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.Runtime- diff --git a/build/Projects/OpenTelemetry.Instrumentation.SqlClient.proj b/build/Projects/OpenTelemetry.Instrumentation.SqlClient.proj index 3cde77cdda..82d5eb5f75 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.SqlClient.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.SqlClient.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.SqlClient- diff --git a/build/Projects/OpenTelemetry.Instrumentation.StackExchangeRedis.proj b/build/Projects/OpenTelemetry.Instrumentation.StackExchangeRedis.proj index 051686d22a..1570dee1f1 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.StackExchangeRedis.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.StackExchangeRedis.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.StackExchangeRedis- diff --git a/build/Projects/OpenTelemetry.Instrumentation.Wcf.proj b/build/Projects/OpenTelemetry.Instrumentation.Wcf.proj index 515f7ca280..b3c80fc7ee 100644 --- a/build/Projects/OpenTelemetry.Instrumentation.Wcf.proj +++ b/build/Projects/OpenTelemetry.Instrumentation.Wcf.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Instrumentation.Wcf- diff --git a/build/Projects/OpenTelemetry.PersistentStorage.proj b/build/Projects/OpenTelemetry.PersistentStorage.proj index 714e728846..758b9b968f 100644 --- a/build/Projects/OpenTelemetry.PersistentStorage.proj +++ b/build/Projects/OpenTelemetry.PersistentStorage.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + PersistentStorage- diff --git a/build/Projects/OpenTelemetry.ResourceDetectors.Azure.proj b/build/Projects/OpenTelemetry.ResourceDetectors.Azure.proj index 149ae576c5..a20c1b6e0b 100644 --- a/build/Projects/OpenTelemetry.ResourceDetectors.Azure.proj +++ b/build/Projects/OpenTelemetry.ResourceDetectors.Azure.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + ResourceDetectors.Azure- diff --git a/build/Projects/OpenTelemetry.ResourceDetectors.Host.proj b/build/Projects/OpenTelemetry.ResourceDetectors.Host.proj index b3e56c12b0..c32258e331 100644 --- a/build/Projects/OpenTelemetry.ResourceDetectors.Host.proj +++ b/build/Projects/OpenTelemetry.ResourceDetectors.Host.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + ResourceDetectors.Host- diff --git a/build/Projects/OpenTelemetry.ResourceDetectors.ProcessRuntime.proj b/build/Projects/OpenTelemetry.ResourceDetectors.ProcessRuntime.proj index c3d9bb68a4..0fb4b5e97d 100644 --- a/build/Projects/OpenTelemetry.ResourceDetectors.ProcessRuntime.proj +++ b/build/Projects/OpenTelemetry.ResourceDetectors.ProcessRuntime.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + ResourceDetectors.ProcessRuntime- diff --git a/build/Projects/OpenTelemetry.Resources.Gcp.proj b/build/Projects/OpenTelemetry.Resources.Gcp.proj index 19364c3155..ad0a81c2a4 100644 --- a/build/Projects/OpenTelemetry.Resources.Gcp.proj +++ b/build/Projects/OpenTelemetry.Resources.Gcp.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Resources.Gcp- diff --git a/build/Projects/OpenTelemetry.Resources.Process.proj b/build/Projects/OpenTelemetry.Resources.Process.proj index 364b4c2358..b2e067bdc6 100644 --- a/build/Projects/OpenTelemetry.Resources.Process.proj +++ b/build/Projects/OpenTelemetry.Resources.Process.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Resources.Process- diff --git a/build/Projects/OpenTelemetry.SemanticConventions.proj b/build/Projects/OpenTelemetry.SemanticConventions.proj index 91d459a156..5f8e5ebcf7 100644 --- a/build/Projects/OpenTelemetry.SemanticConventions.proj +++ b/build/Projects/OpenTelemetry.SemanticConventions.proj @@ -2,6 +2,7 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) + Exporter.SemanticConventions- diff --git a/build/scripts/build.psm1 b/build/scripts/build.psm1 new file mode 100644 index 0000000000..df0ff22140 --- /dev/null +++ b/build/scripts/build.psm1 @@ -0,0 +1,58 @@ +function ResolveProjectForTag { + param( + [Parameter()][string]$tag + ) + + if ([string]::IsNullOrEmpty($tag)) + { + # Scheduled builds. No tag, build solution. + echo "title=opentelemetry-dotnet-contrib.proj" >> $env:GITHUB_OUTPUT + echo "project=opentelemetry-dotnet-contrib.proj" >> $env:GITHUB_OUTPUT + } + else { + $match = [regex]::Match($tag, '^(.*?-)(.*)$') + if ($match.Success -eq $false) + { + throw 'Could not parse prefix or version from tag' + } + + $tagPrefix = $match.Groups[1].Value + $version = $match.Groups[2].Value + + # Step 1: Look for a .proj file in build\Projects with a matching MinVerTagPrefix + $buildProjects = @(Get-ChildItem -Path build\Projects\*.proj | Select-String "$tagPrefix" -List | Select Path) + + if ($buildProjects.Length -gt 1) + { + throw 'Multiple build project files found matching tag prefix' + } + elseif ($buildProjects.Length -eq 1) + { + $buildProject = [System.IO.Path]::GetFileNameWithoutExtension($buildProjects[0].Path) + + echo "title=$buildProject.proj" >> $env:GITHUB_OUTPUT + echo "project=.\build\Projects\$buildProject.proj" >> $env:GITHUB_OUTPUT + Return + } + + # Step 2: If no .proj file found use component build for the csproj found matching MinVerTagPrefix + $projects = @(Get-ChildItem -Path src\**\*.csproj | Select-String "$tagPrefix" -List | Select Path) + + if ($projects.Length -gt 1) + { + throw 'Multiple project files found matching tag prefix' + } + elseif ($projects.Length -ne 1) + { + throw 'No project file found matching tag prefix' + } + + $project = [System.IO.Path]::GetFileNameWithoutExtension($projects[0].Path) + + echo "title=Component.proj[$project]" >> $env:GITHUB_OUTPUT + echo "project=.\build\Projects\Component.proj" >> $env:GITHUB_OUTPUT + echo "BUILD_COMPONENT=$project" >> $env:GITHUB_ENV + } +} + +Export-ModuleMember -Function ResolveProjectForTag diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index 4962985e93..180999ecfa 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -33,47 +33,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ .github\workflows\ci.yml = .github\workflows\ci.yml .github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml .github\workflows\Component.BuildTest.yml = .github\workflows\Component.BuildTest.yml - .github\workflows\Component.Package.yml = .github\workflows\Component.Package.yml .github\workflows\dotnet-format.yml = .github\workflows\dotnet-format.yml .github\workflows\integration.yml = .github\workflows\integration.yml .github\workflows\markdownlint.yml = .github\workflows\markdownlint.yml - .github\workflows\package-Exporter.Geneva.yml = .github\workflows\package-Exporter.Geneva.yml - .github\workflows\package-Exporter.InfluxDB.yml = .github\workflows\package-Exporter.InfluxDB.yml - .github\workflows\package-Exporter.Instana.yml = .github\workflows\package-Exporter.Instana.yml - .github\workflows\package-Exporter.OneCollector.yml = .github\workflows\package-Exporter.OneCollector.yml - .github\workflows\package-Exporter.Stackdriver.yml = .github\workflows\package-Exporter.Stackdriver.yml - .github\workflows\package-Extensions.AWS.yml = .github\workflows\package-Extensions.AWS.yml - .github\workflows\package-Extensions.Enrichment.yml = .github\workflows\package-Extensions.Enrichment.yml - .github\workflows\package-Extensions.yml = .github\workflows\package-Extensions.yml - .github\workflows\package-Instrumentation.AspNet.yml = .github\workflows\package-Instrumentation.AspNet.yml - .github\workflows\package-Instrumentation.AspNetCore.yml = .github\workflows\package-Instrumentation.AspNetCore.yml - .github\workflows\package-Instrumentation.AWS.yml = .github\workflows\package-Instrumentation.AWS.yml - .github\workflows\package-Instrumentation.AWSLambda.yml = .github\workflows\package-Instrumentation.AWSLambda.yml - .github\workflows\package-Instrumentation.Cassandra.yml = .github\workflows\package-Instrumentation.Cassandra.yml - .github\workflows\package-Instrumentation.Elasticsearch.yml = .github\workflows\package-Instrumentation.Elasticsearch.yml - .github\workflows\package-Instrumentation.EntityFrameworkCore.yml = .github\workflows\package-Instrumentation.EntityFrameworkCore.yml - .github\workflows\package-Instrumentation.EventCounters.yml = .github\workflows\package-Instrumentation.EventCounters.yml - .github\workflows\package-Instrumentation.GrpcCore.yml = .github\workflows\package-Instrumentation.GrpcCore.yml - .github\workflows\package-Instrumentation.GrpcNetClient.yml = .github\workflows\package-Instrumentation.GrpcNetClient.yml - .github\workflows\package-Instrumentation.Hangfire.yml = .github\workflows\package-Instrumentation.Hangfire.yml - .github\workflows\package-Instrumentation.Http.yml = .github\workflows\package-Instrumentation.Http.yml - .github\workflows\package-Instrumentation.Owin.yml = .github\workflows\package-Instrumentation.Owin.yml - .github\workflows\package-Instrumentation.Process.yml = .github\workflows\package-Instrumentation.Process.yml - .github\workflows\package-Instrumentation.Quartz.yml = .github\workflows\package-Instrumentation.Quartz.yml - .github\workflows\package-Instrumentation.Runtime.yml = .github\workflows\package-Instrumentation.Runtime.yml - .github\workflows\package-Instrumentation.SqlClient.yml = .github\workflows\package-Instrumentation.SqlClient.yml - .github\workflows\package-Instrumentation.StackExchangeRedis.yml = .github\workflows\package-Instrumentation.StackExchangeRedis.yml - .github\workflows\package-Instrumentation.Wcf.yml = .github\workflows\package-Instrumentation.Wcf.yml - .github\workflows\package-PersistentStorage.yml = .github\workflows\package-PersistentStorage.yml - .github\workflows\package-ResourceDetectors.AWS.yml = .github\workflows\package-ResourceDetectors.AWS.yml - .github\workflows\package-ResourceDetectors.Azure.yml = .github\workflows\package-ResourceDetectors.Azure.yml - .github\workflows\package-ResourceDetectors.Container.yml = .github\workflows\package-ResourceDetectors.Container.yml - .github\workflows\package-ResourceDetectors.Host.yml = .github\workflows\package-ResourceDetectors.Host.yml - .github\workflows\package-ResourceDetectors.ProcessRuntime.yml = .github\workflows\package-ResourceDetectors.ProcessRuntime.yml - .github\workflows\package-Resources.Gcp.yml = .github\workflows\package-Resources.Gcp.yml - .github\workflows\package-Resources.Process.yml = .github\workflows\package-Resources.Process.yml - .github\workflows\package-Sampler.AWS.yml = .github\workflows\package-Sampler.AWS.yml - .github\workflows\package-SemanticConventions.yml = .github\workflows\package-SemanticConventions.yml + .github\workflows\publish-packages.yml = .github\workflows\publish-packages.yml .github\workflows\sanitycheck.yml = .github\workflows\sanitycheck.yml .github\workflows\stale.yml = .github\workflows\stale.yml .github\workflows\verifyaotcompat.yml = .github\workflows\verifyaotcompat.yml @@ -318,6 +281,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{9B EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{048509D6-FB49-4B84-832A-90E55520B97B}" ProjectSection(SolutionItems) = preProject + build\Projects\Component.proj = build\Projects\Component.proj + build\Projects\OpenTelemetry.Contrib.Shared.Tests.proj = build\Projects\OpenTelemetry.Contrib.Shared.Tests.proj build\Projects\OpenTelemetry.Exporter.Geneva.proj = build\Projects\OpenTelemetry.Exporter.Geneva.proj build\Projects\OpenTelemetry.Exporter.OneCollector.proj = build\Projects\OpenTelemetry.Exporter.OneCollector.proj build\Projects\OpenTelemetry.Extensions.proj = build\Projects\OpenTelemetry.Extensions.proj @@ -335,9 +300,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{04 build\Projects\OpenTelemetry.PersistentStorage.proj = build\Projects\OpenTelemetry.PersistentStorage.proj build\Projects\OpenTelemetry.ResourceDetectors.Azure.proj = build\Projects\OpenTelemetry.ResourceDetectors.Azure.proj build\Projects\OpenTelemetry.ResourceDetectors.Host.proj = build\Projects\OpenTelemetry.ResourceDetectors.Host.proj - build\Projects\OpenTelemetry.ResourceDetectors.Process.proj = build\Projects\OpenTelemetry.ResourceDetectors.Process.proj build\Projects\OpenTelemetry.ResourceDetectors.ProcessRuntime.proj = build\Projects\OpenTelemetry.ResourceDetectors.ProcessRuntime.proj build\Projects\OpenTelemetry.Resources.Gcp.proj = build\Projects\OpenTelemetry.Resources.Gcp.proj + build\Projects\OpenTelemetry.Resources.Process.proj = build\Projects\OpenTelemetry.Resources.Process.proj build\Projects\OpenTelemetry.SemanticConventions.proj = build\Projects\OpenTelemetry.SemanticConventions.proj EndProjectSection EndProject @@ -404,6 +369,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{45D29DAA-0DB9-4808-B879-1AECC37EF366}" ProjectSection(SolutionItems) = preProject build\scripts\add-labels.ps1 = build\scripts\add-labels.ps1 + build\scripts\build.psm1 = build\scripts\build.psm1 build\scripts\finalize-publicapi.ps1 = build\scripts\finalize-publicapi.ps1 build\scripts\post-release.psm1 = build\scripts\post-release.psm1 build\scripts\sanitycheck.py = build\scripts\sanitycheck.py @@ -910,6 +876,8 @@ Global {048509D6-FB49-4B84-832A-90E55520B97B} = {824BD1DE-3FA8-4FE0-823A-FD365EAC78AF} {95372E82-CA5B-4C61-BD6C-74E6AB1970D4} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} {B6157646-8EBA-464C-99B9-C386D474CB12} = {2097345F-4DD3-477D-BC54-A922F9B2B402} + {A5FCDD8F-20FF-4657-804E-707EAD4FE31D} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} + {A5EF701C-439E-407F-8BB4-394166000C6D} = {2097345F-4DD3-477D-BC54-A922F9B2B402} {033CA8D4-1529-413A-B244-07958D5F9A48} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63} {36271347-2055-438E-9659-B71542A17A73} = {2097345F-4DD3-477D-BC54-A922F9B2B402} {7AD707F9-DC6D-430A-8834-D5DCD517BF6E} = {2097345F-4DD3-477D-BC54-A922F9B2B402} From e2c1e71ddf8bb8becb1488e79c8ce3a616d79bcb Mon Sep 17 00:00:00 2001 From: Matt Hensley <130569+matt-hensley@users.noreply.github.com> Date: Thu, 16 May 2024 18:56:35 -0400 Subject: [PATCH 3/5] [Resources.ProcessRuntime] Rename processruntime detector namespace (#1767) Co-authored-by: Mikel Blanchard --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- .github/codecov.yml | 8 +++---- .github/component_owners.yml | 8 +++---- .github/workflows/ci.yml | 14 +++++------ ...enTelemetry.Resources.ProcessRuntime.proj} | 10 ++++---- opentelemetry-dotnet-contrib.sln | 6 ++--- .../.publicApi/PublicAPI.Unshipped.txt | 3 --- .../AssemblyInfo.cs | 10 -------- .../.publicApi/PublicAPI.Shipped.txt | 0 .../.publicApi/PublicAPI.Unshipped.txt | 2 ++ .../AssemblyInfo.cs | 10 ++++++++ .../CHANGELOG.md | 6 +++++ ...Telemetry.Resources.ProcessRuntime.csproj} | 6 ++++- .../ProcessRuntimeDetector.cs | 5 ++-- ...ProcessRuntimeResourceBuilderExtensions.cs | 24 +++++++++++++++++++ .../ProcessRuntimeSemanticConventions.cs | 2 +- .../README.md | 12 +++++----- ...nTelemetry.AotCompatibility.TestApp.csproj | 2 +- ...try.Resources.ProcessRuntime.Tests.csproj} | 2 +- .../ProcessRuntimeDetectorTests.cs | 3 +-- 21 files changed, 84 insertions(+), 53 deletions(-) rename build/Projects/{OpenTelemetry.ResourceDetectors.ProcessRuntime.proj => OpenTelemetry.Resources.ProcessRuntime.proj} (68%) delete mode 100644 src/OpenTelemetry.ResourceDetectors.ProcessRuntime/.publicApi/PublicAPI.Unshipped.txt delete mode 100644 src/OpenTelemetry.ResourceDetectors.ProcessRuntime/AssemblyInfo.cs rename src/{OpenTelemetry.ResourceDetectors.ProcessRuntime => OpenTelemetry.Resources.ProcessRuntime}/.publicApi/PublicAPI.Shipped.txt (100%) create mode 100644 src/OpenTelemetry.Resources.ProcessRuntime/.publicApi/PublicAPI.Unshipped.txt create mode 100644 src/OpenTelemetry.Resources.ProcessRuntime/AssemblyInfo.cs rename src/{OpenTelemetry.ResourceDetectors.ProcessRuntime => OpenTelemetry.Resources.ProcessRuntime}/CHANGELOG.md (59%) rename src/{OpenTelemetry.ResourceDetectors.ProcessRuntime/OpenTelemetry.ResourceDetectors.ProcessRuntime.csproj => OpenTelemetry.Resources.ProcessRuntime/OpenTelemetry.Resources.ProcessRuntime.csproj} (86%) rename src/{OpenTelemetry.ResourceDetectors.ProcessRuntime => OpenTelemetry.Resources.ProcessRuntime}/ProcessRuntimeDetector.cs (95%) create mode 100644 src/OpenTelemetry.Resources.ProcessRuntime/ProcessRuntimeResourceBuilderExtensions.cs rename src/{OpenTelemetry.ResourceDetectors.ProcessRuntime => OpenTelemetry.Resources.ProcessRuntime}/ProcessRuntimeSemanticConventions.cs (87%) rename src/{OpenTelemetry.ResourceDetectors.ProcessRuntime => OpenTelemetry.Resources.ProcessRuntime}/README.md (69%) rename test/{OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests.csproj => OpenTelemetry.Resources.ProcessRuntime.Tests/OpenTelemetry.Resources.ProcessRuntime.Tests.csproj} (86%) rename test/{OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests => OpenTelemetry.Resources.ProcessRuntime.Tests}/ProcessRuntimeDetectorTests.cs (93%) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index c33c1fe1e1..1ab022a96a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -52,9 +52,9 @@ body: - OpenTelemetry.ResourceDetectors.Azure - OpenTelemetry.ResourceDetectors.Container - OpenTelemetry.ResourceDetectors.Host - - OpenTelemetry.ResourceDetectors.ProcessRuntime - OpenTelemetry.Resources.Gcp - OpenTelemetry.Resources.Process + - OpenTelemetry.Resources.ProcessRuntime - OpenTelemetry.Sampler.AWS - OpenTelemetry.SemanticConventions validations: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 48af8837b3..a2833eeb8a 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -52,9 +52,9 @@ body: - OpenTelemetry.ResourceDetectors.Azure - OpenTelemetry.ResourceDetectors.Container - OpenTelemetry.ResourceDetectors.Host - - OpenTelemetry.ResourceDetectors.ProcessRuntime - OpenTelemetry.Resources.Gcp - OpenTelemetry.Resources.Process + - OpenTelemetry.Resources.ProcessRuntime - OpenTelemetry.Sampler.AWS - OpenTelemetry.SemanticConventions diff --git a/.github/codecov.yml b/.github/codecov.yml index 0664709197..25bd105893 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -129,15 +129,15 @@ flags: paths: - src/OpenTelemetry.ResourceDetectors.Host - unittests-ResourceDetectors.ProcessRuntime: + unittests-Resources.Process: carryforward: true paths: - - src/OpenTelemetry.ResourceDetectors.ProcessRuntime + - src/OpenTelemetry.Resources.Process - unittests-Resources.Process: + unittests-Resources.ProcessRuntime: carryforward: true paths: - - src/OpenTelemetry.Resources.Process + - src/OpenTelemetry.Resources.ProcessRuntime unittests-SemanticConventions: carryforward: true diff --git a/.github/component_owners.yml b/.github/component_owners.yml index 505c9fb1d3..f79f7aa99f 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -73,10 +73,10 @@ components: src/OpenTelemetry.ResourceDetectors.Host/: - Kielek - lachmatt - src/OpenTelemetry.ResourceDetectors.ProcessRuntime/: + src/OpenTelemetry.Resources.Process/: - Kielek - lachmatt - src/OpenTelemetry.Resources.Process/: + src/OpenTelemetry.Resources.ProcessRuntime/: - Kielek - lachmatt src/OpenTelemetry.Resources.Gcp/: @@ -166,10 +166,10 @@ components: test/OpenTelemetry.ResourceDetectors.Host.Tests/: - Kielek - lachmatt - test/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/: + test/OpenTelemetry.Resources.Process.Tests/: - Kielek - lachmatt - test/OpenTelemetry.Resources.Process.Tests/: + test/OpenTelemetry.Resources.ProcessRuntime.Tests/: - Kielek - lachmatt test/OpenTelemetry.Resources.Gcp.Tests/: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0961674d75..caca6c4f9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: persistentstorage: ['*/OpenTelemetry.PersistentStorage*/**', '!**/*.md'] process: ['*/OpenTelemetry.Instrumentation.Process*/**', 'examples/process-instrumentation/**', '!**/*.md'] processdetector: ['*/OpenTelemetry.Resources.Process/**', '*/OpenTelemetry.Resources.Process.Tests/**', '!**/*.md'] - processruntime: ['*/OpenTelemetry.ResourceDetectors.ProcessRuntime/**', '*/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/**', '!**/*.md'] + processruntime: ['*/OpenTelemetry.Resources.ProcessRuntime/**', '*/OpenTelemetry.Resources.ProcessRuntime.Tests/**', '!**/*.md'] redis: ['*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**', 'examples/redis/**', '!**/*.md'] resourcedetectors: ['*/OpenTelemetry.ResourceDetectors.*/**', '!**/*.md'] runtime: ['*/OpenTelemetry.Instrumentation.Runtime*/**', 'examples/runtime-instrumentation/**', '!**/*.md'] @@ -57,11 +57,11 @@ jobs: '!examples/AspNet/**', '!*/OpenTelemetry.ResourceDetectors.Azure*/**', '!*/OpenTelemetry.ResourceDetectors.Host*/**', - '!*/OpenTelemetry.ResourceDetectors.ProcessRuntime/**', - '!*/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/**', '!*/OpenTelemetry.Resources.Gcp*/**', '!*/OpenTelemetry.Resources.Process/**', '!*/OpenTelemetry.Resources.Process.Tests/**', + '!*/OpenTelemetry.Resources.ProcessRuntime/**', + '!*/OpenTelemetry.Resources.ProcessRuntime.Tests/**', '!*/OpenTelemetry.Instrumentation.EventCounters*/**', '!examples/event-counters/**', '!*/OpenTelemetry.Extensions/**', @@ -280,8 +280,8 @@ jobs: || contains(needs.detect-changes.outputs.changes, 'shared') uses: ./.github/workflows/Component.BuildTest.yml with: - project-name: OpenTelemetry.ResourceDetectors.ProcessRuntime - code-cov-name: ResourceDetectors.ProcessRuntime + project-name: OpenTelemetry.Resources.ProcessRuntime + code-cov-name: Resources.ProcessRuntime build-test-redis: needs: detect-changes @@ -405,9 +405,9 @@ jobs: OpenTelemetry.PersistentStorage.FileSystem.Tests.csproj, OpenTelemetry.ResourceDetectors.Azure.Tests.csproj, OpenTelemetry.ResourceDetectors.Host.Tests.csproj, - OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests.csproj, OpenTelemetry.Resources.Gcp.Tests.csproj, - OpenTelemetry.Resources.Process.Tests.csproj + OpenTelemetry.Resources.Process.Tests.csproj, + OpenTelemetry.Resources.ProcessRuntime.Tests.csproj $failedProjects = @() diff --git a/build/Projects/OpenTelemetry.ResourceDetectors.ProcessRuntime.proj b/build/Projects/OpenTelemetry.Resources.ProcessRuntime.proj similarity index 68% rename from build/Projects/OpenTelemetry.ResourceDetectors.ProcessRuntime.proj rename to build/Projects/OpenTelemetry.Resources.ProcessRuntime.proj index 0fb4b5e97d..6f428a4ff7 100644 --- a/build/Projects/OpenTelemetry.ResourceDetectors.ProcessRuntime.proj +++ b/build/Projects/OpenTelemetry.Resources.ProcessRuntime.proj @@ -2,16 +2,16 @@ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName) - ResourceDetectors.ProcessRuntime- + Resources.ProcessRuntime- - - + + - + - + diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index 180999ecfa..bb6fe9ffc6 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -300,15 +300,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{04 build\Projects\OpenTelemetry.PersistentStorage.proj = build\Projects\OpenTelemetry.PersistentStorage.proj build\Projects\OpenTelemetry.ResourceDetectors.Azure.proj = build\Projects\OpenTelemetry.ResourceDetectors.Azure.proj build\Projects\OpenTelemetry.ResourceDetectors.Host.proj = build\Projects\OpenTelemetry.ResourceDetectors.Host.proj - build\Projects\OpenTelemetry.ResourceDetectors.ProcessRuntime.proj = build\Projects\OpenTelemetry.ResourceDetectors.ProcessRuntime.proj build\Projects\OpenTelemetry.Resources.Gcp.proj = build\Projects\OpenTelemetry.Resources.Gcp.proj build\Projects\OpenTelemetry.Resources.Process.proj = build\Projects\OpenTelemetry.Resources.Process.proj + build\Projects\OpenTelemetry.Resources.ProcessRuntime.proj = build\Projects\OpenTelemetry.Resources.ProcessRuntime.proj build\Projects\OpenTelemetry.SemanticConventions.proj = build\Projects\OpenTelemetry.SemanticConventions.proj EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.ProcessRuntime", "src\OpenTelemetry.ResourceDetectors.ProcessRuntime\OpenTelemetry.ResourceDetectors.ProcessRuntime.csproj", "{95372E82-CA5B-4C61-BD6C-74E6AB1970D4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.ProcessRuntime", "src\OpenTelemetry.Resources.ProcessRuntime\OpenTelemetry.Resources.ProcessRuntime.csproj", "{95372E82-CA5B-4C61-BD6C-74E6AB1970D4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests", "test\OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests\OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests.csproj", "{B6157646-8EBA-464C-99B9-C386D474CB12}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.ProcessRuntime.Tests", "test\OpenTelemetry.Resources.ProcessRuntime.Tests\OpenTelemetry.Resources.ProcessRuntime.Tests.csproj", "{B6157646-8EBA-464C-99B9-C386D474CB12}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.Process", "src\OpenTelemetry.Resources.Process\OpenTelemetry.Resources.Process.csproj", "{A5FCDD8F-20FF-4657-804E-707EAD4FE31D}" EndProject diff --git a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/.publicApi/PublicAPI.Unshipped.txt deleted file mode 100644 index a4c8a74d8a..0000000000 --- a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/.publicApi/PublicAPI.Unshipped.txt +++ /dev/null @@ -1,3 +0,0 @@ -OpenTelemetry.ResourceDetectors.ProcessRuntime.ProcessRuntimeDetector -OpenTelemetry.ResourceDetectors.ProcessRuntime.ProcessRuntimeDetector.Detect() -> OpenTelemetry.Resources.Resource! -OpenTelemetry.ResourceDetectors.ProcessRuntime.ProcessRuntimeDetector.ProcessRuntimeDetector() -> void diff --git a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/AssemblyInfo.cs b/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/AssemblyInfo.cs deleted file mode 100644 index 6f887cadae..0000000000 --- a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -using System.Runtime.CompilerServices; - -#if SIGNED -[assembly: InternalsVisibleTo("OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] -#else -[assembly: InternalsVisibleTo("OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests")] -#endif diff --git a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/.publicApi/PublicAPI.Shipped.txt b/src/OpenTelemetry.Resources.ProcessRuntime/.publicApi/PublicAPI.Shipped.txt similarity index 100% rename from src/OpenTelemetry.ResourceDetectors.ProcessRuntime/.publicApi/PublicAPI.Shipped.txt rename to src/OpenTelemetry.Resources.ProcessRuntime/.publicApi/PublicAPI.Shipped.txt diff --git a/src/OpenTelemetry.Resources.ProcessRuntime/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Resources.ProcessRuntime/.publicApi/PublicAPI.Unshipped.txt new file mode 100644 index 0000000000..a0981630a9 --- /dev/null +++ b/src/OpenTelemetry.Resources.ProcessRuntime/.publicApi/PublicAPI.Unshipped.txt @@ -0,0 +1,2 @@ +OpenTelemetry.Resources.ProcessRuntimeResourceBuilderExtensions +static OpenTelemetry.Resources.ProcessRuntimeResourceBuilderExtensions.AddProcessRuntimeDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! diff --git a/src/OpenTelemetry.Resources.ProcessRuntime/AssemblyInfo.cs b/src/OpenTelemetry.Resources.ProcessRuntime/AssemblyInfo.cs new file mode 100644 index 0000000000..7668e61904 --- /dev/null +++ b/src/OpenTelemetry.Resources.ProcessRuntime/AssemblyInfo.cs @@ -0,0 +1,10 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +using System.Runtime.CompilerServices; + +#if SIGNED +[assembly: InternalsVisibleTo("OpenTelemetry.Resources.ProcessRuntime.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] +#else +[assembly: InternalsVisibleTo("OpenTelemetry.Resources.ProcessRuntime.Tests")] +#endif diff --git a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/CHANGELOG.md b/src/OpenTelemetry.Resources.ProcessRuntime/CHANGELOG.md similarity index 59% rename from src/OpenTelemetry.ResourceDetectors.ProcessRuntime/CHANGELOG.md rename to src/OpenTelemetry.Resources.ProcessRuntime/CHANGELOG.md index bea8688334..ee5bba5ec7 100644 --- a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/CHANGELOG.md +++ b/src/OpenTelemetry.Resources.ProcessRuntime/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +* **Breaking Change**: Renamed package from `OpenTelemetry.ResourceDetectors.ProcessRuntime` + to `OpenTelemetry.Resources.ProcessRuntime`. + ([#1767](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1767)) +* **Breaking Change**: `ProcessRuntimeDetector` type is now internal, use `ResourceBuilder` + extension method `AddProcessRuntimeDetector` to enable the detector. + ([#1767](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1767)) * Update OpenTelemetry SDK version to `1.8.1`. ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) diff --git a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/OpenTelemetry.ResourceDetectors.ProcessRuntime.csproj b/src/OpenTelemetry.Resources.ProcessRuntime/OpenTelemetry.Resources.ProcessRuntime.csproj similarity index 86% rename from src/OpenTelemetry.ResourceDetectors.ProcessRuntime/OpenTelemetry.ResourceDetectors.ProcessRuntime.csproj rename to src/OpenTelemetry.Resources.ProcessRuntime/OpenTelemetry.Resources.ProcessRuntime.csproj index 613ed57702..de63279f70 100644 --- a/src/OpenTelemetry.ResourceDetectors.ProcessRuntime/OpenTelemetry.ResourceDetectors.ProcessRuntime.csproj +++ b/src/OpenTelemetry.Resources.ProcessRuntime/OpenTelemetry.Resources.ProcessRuntime.csproj @@ -4,7 +4,7 @@ net6.0 $(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion) OpenTelemetry Extensions - Process Runtime Resource Detector for .NET runtime. - ResourceDetectors.ProcessRuntime- + Resources.ProcessRuntime-