From 3ecf0154f8a78199c2483c4c68c409636de3ad87 Mon Sep 17 00:00:00 2001 From: joegoldman2 <147369450+joegoldman@users.noreply.github.com> Date: Thu, 23 May 2024 19:15:57 +0000 Subject: [PATCH 1/6] [Resources.AWS] Rename AWS detector namespace --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- .github/component_owners.yml | 12 ++-- .github/workflows/ci.yml | 24 ++++---- opentelemetry-dotnet-contrib.sln | 4 +- .../.publicApi/PublicAPI.Unshipped.txt | 6 -- .../.publicApi/net6.0/PublicAPI.Unshipped.txt | 6 -- .../AssemblyInfo.cs | 10 ---- .../.publicApi/PublicAPI.Shipped.txt | 0 .../.publicApi/PublicAPI.Unshipped.txt | 3 + .../.publicApi/net6.0/PublicAPI.Shipped.txt | 0 .../.publicApi/net6.0/PublicAPI.Unshipped.txt | 2 + .../AWSEBSResourceDetector.cs | 11 ++-- .../AWSEC2ResourceDetector.cs | 7 +-- .../AWSECSResourceDetector.cs | 5 +- .../AWSEKSResourceDetector.cs | 10 ++-- .../AWSResourceBuilderExtensions.cs | 59 +++++++++++++++++++ .../AWSResourcesEventSource.cs | 2 +- .../AWSSemanticConventions.cs | 2 +- .../AssemblyInfo.cs | 10 ++++ .../CHANGELOG.md | 0 .../Models/AWSEBSMetadataModel.cs | 2 +- .../Models/AWSEC2IdentityDocumentModel.cs | 2 +- .../Models/AWSEKSClusterDataModel.cs | 2 +- .../Models/AWSEKSClusterInformationModel.cs | 2 +- .../OpenTelemetry.Resources.AWS.csproj} | 2 +- .../README.md | 12 ++-- .../ResourceDetectorUtils.cs | 2 +- .../SourceGenerationContext.cs | 4 +- ...IServerCertificateValidationEventSource.cs | 2 +- .../ServerCertificateValidationHandler.cs | 2 +- .../ServerCertificateValidationProvider.cs | 2 +- ...nTelemetry.AotCompatibility.TestApp.csproj | 2 +- .../AWSEBSResourceDetectorTests.cs | 2 +- .../AWSEC2ResourceDetectorTests.cs | 2 +- .../AWSECSResourceDetectorTests.cs | 2 +- .../AWSEKSResourceDetectorTests.cs | 2 +- .../Http/CertificateUploader.cs | 2 +- ...pServerCertificateValidationEventSource.cs | 2 +- ...ServerCertificateValidationHandlerTests.cs | 2 +- ...erverCertificateValidationProviderTests.cs | 2 +- .../OpenTelemetry.Resources.AWS.Tests.csproj} | 2 +- .../SampleAWSEBSMetadataModel.cs | 4 +- .../SampleAWSEC2IdentityDocumentModel.cs | 4 +- .../SampleMetadataFiles/environment.conf | 0 .../SampleMetadataFiles/testcgroup | 0 .../SampleMetadataFiles/testekstoken | 0 .../metadatav4-response-container-ec2.json | 0 ...metadatav4-response-container-fargate.json | 0 .../metadatav4-response-task-ec2.json | 0 .../metadatav4-response-task-fargate.json | 0 51 files changed, 143 insertions(+), 96 deletions(-) delete mode 100644 src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/PublicAPI.Unshipped.txt delete mode 100644 src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/net6.0/PublicAPI.Unshipped.txt delete mode 100644 src/OpenTelemetry.ResourceDetectors.AWS/AssemblyInfo.cs rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/.publicApi/PublicAPI.Shipped.txt (100%) create mode 100644 src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/.publicApi/net6.0/PublicAPI.Shipped.txt (100%) create mode 100644 src/OpenTelemetry.Resources.AWS/.publicApi/net6.0/PublicAPI.Unshipped.txt rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/AWSEBSResourceDetector.cs (90%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/AWSEC2ResourceDetector.cs (95%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/AWSECSResourceDetector.cs (98%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/AWSEKSResourceDetector.cs (96%) create mode 100644 src/OpenTelemetry.Resources.AWS/AWSResourceBuilderExtensions.cs rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/AWSResourcesEventSource.cs (98%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/AWSSemanticConventions.cs (97%) create mode 100644 src/OpenTelemetry.Resources.AWS/AssemblyInfo.cs rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/CHANGELOG.md (100%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/Models/AWSEBSMetadataModel.cs (88%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/Models/AWSEC2IdentityDocumentModel.cs (91%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/Models/AWSEKSClusterDataModel.cs (82%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/Models/AWSEKSClusterInformationModel.cs (82%) rename src/{OpenTelemetry.ResourceDetectors.AWS/OpenTelemetry.ResourceDetectors.AWS.csproj => OpenTelemetry.Resources.AWS/OpenTelemetry.Resources.AWS.csproj} (96%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/README.md (81%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/ResourceDetectorUtils.cs (98%) rename src/{OpenTelemetry.ResourceDetectors.AWS => OpenTelemetry.Resources.AWS}/SourceGenerationContext.cs (91%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/AWSEBSResourceDetectorTests.cs (97%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/AWSEC2ResourceDetectorTests.cs (98%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/AWSECSResourceDetectorTests.cs (99%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/AWSEKSResourceDetectorTests.cs (98%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/Http/CertificateUploader.cs (97%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/Http/NoopServerCertificateValidationEventSource.cs (91%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/Http/ServerCertificateValidationHandlerTests.cs (94%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/Http/ServerCertificateValidationProviderTests.cs (97%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests/OpenTelemetry.ResourceDetectors.AWS.Tests.csproj => OpenTelemetry.Resources.AWS.Tests/OpenTelemetry.Resources.AWS.Tests.csproj} (96%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/SampleAWSEBSMetadataModel.cs (76%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/SampleAWSEC2IdentityDocumentModel.cs (81%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/SampleMetadataFiles/environment.conf (100%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/SampleMetadataFiles/testcgroup (100%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/SampleMetadataFiles/testekstoken (100%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/ecs_metadata/metadatav4-response-container-ec2.json (100%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/ecs_metadata/metadatav4-response-container-fargate.json (100%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/ecs_metadata/metadatav4-response-task-ec2.json (100%) rename test/{OpenTelemetry.ResourceDetectors.AWS.Tests => OpenTelemetry.Resources.AWS.Tests}/ecs_metadata/metadatav4-response-task-fargate.json (100%) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 2d9e8e82e6..8036657882 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -48,9 +48,9 @@ body: - OpenTelemetry.Instrumentation.Wcf - OpenTelemetry.PersistentStorage.Abstractions - OpenTelemetry.PersistentStorage.FileSystem - - OpenTelemetry.ResourceDetectors.AWS - OpenTelemetry.ResourceDetectors.Azure - OpenTelemetry.ResourceDetectors.Container + - OpenTelemetry.Resources.AWS - OpenTelemetry.Resources.Gcp - OpenTelemetry.Resources.Host - OpenTelemetry.Resources.Process diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 9e5b95ad58..6f1d647797 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -48,9 +48,9 @@ body: - OpenTelemetry.Instrumentation.Wcf - OpenTelemetry.PersistentStorage.Abstractions - OpenTelemetry.PersistentStorage.FileSystem - - OpenTelemetry.ResourceDetectors.AWS - OpenTelemetry.ResourceDetectors.Azure - OpenTelemetry.ResourceDetectors.Container + - OpenTelemetry.Resources.AWS - OpenTelemetry.Resources.Gcp - OpenTelemetry.Resources.Host - OpenTelemetry.Resources.Process diff --git a/.github/component_owners.yml b/.github/component_owners.yml index d9a50eb243..e3bfcc7d02 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -59,14 +59,14 @@ components: - vishweshbankwar src/OpenTelemetry.PersistentStorage.FileSystem/: - vishweshbankwar - src/OpenTelemetry.ResourceDetectors.AWS/: - - srprash - - ppittle src/OpenTelemetry.ResourceDetectors.Azure/: - rajkumar-rangaraj - vishweshbankwar src/OpenTelemetry.ResourceDetectors.Container/: - iskiselev + src/OpenTelemetry.Resources.AWS/: + - srprash + - ppittle src/OpenTelemetry.Resources.Host/: - Kielek - lachmatt @@ -149,14 +149,14 @@ components: - codeblanch test/OpenTelemetry.PersistentStorage.FileSystem.Tests/: - vishweshbankwar - test/OpenTelemetry.ResourceDetectors.AWS.Tests/: - - srprash - - ppittle test/OpenTelemetry.ResourceDetectors.Azure.Tests/: - rajkumar-rangaraj - vishweshbankwar test/OpenTelemetry.ResourceDetectors.Container.Tests/: - iskiselev + test/OpenTelemetry.Resources.AWS.Tests/: + - srprash + - ppittle test/OpenTelemetry.Resources.Host.Tests/: - Kielek - lachmatt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b647d2f63d..5c42612228 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,9 +51,9 @@ jobs: instrumentation-stackexchangeredis: ['*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**', 'examples/redis/**', '!**/*.md'] instrumentation-wcf: ['*/OpenTelemetry.Instrumentation.Wcf*/**', 'examples/wcf/**', '!**/*.md'] persistentstorage: ['*/OpenTelemetry.PersistentStorage*/**', '!**/*.md'] - resourcedetectors-aws: ['*/OpenTelemetry.ResourceDetectors.AWS*/**', '!**/*.md'] resourcedetectors-azure: ['*/OpenTelemetry.ResourceDetectors.Azure*/**', '!**/*.md'] resourcedetectors-container: ['*/OpenTelemetry.ResourceDetectors.Container*/**', '!**/*.md'] + resources-aws: ['*/OpenTelemetry.Resources.AWS*/**', '!**/*.md'] resources-gcp: ['*/OpenTelemetry.Resources.Gcp*/**', '!**/*.md'] resources-host: ['*/OpenTelemetry.Resources.Host*/**', '!**/*.md'] resources-process: ['*/OpenTelemetry.Resources.Process/**', '*/OpenTelemetry.Resources.Process.Tests/**', '!**/*.md'] @@ -398,17 +398,6 @@ jobs: project-name: OpenTelemetry.PersistentStorage code-cov-name: PersistentStorage - build-test-resourcedetectors-aws: - needs: detect-changes - if: | - contains(needs.detect-changes.outputs.changes, 'resourcedetectors-aws') - || contains(needs.detect-changes.outputs.changes, 'build') - || contains(needs.detect-changes.outputs.changes, 'shared') - uses: ./.github/workflows/Component.BuildTest.yml - with: - project-name: Component[OpenTelemetry.ResourceDetectors.AWS] - code-cov-name: ResourceDetectors.AWS - build-test-resourcedetectors-azure: needs: detect-changes if: | @@ -431,6 +420,17 @@ jobs: project-name: Component[OpenTelemetry.ResourceDetectors.Container] code-cov-name: ResourceDetectors.Container + build-test-resources-aws: + needs: detect-changes + if: | + contains(needs.detect-changes.outputs.changes, 'resources-aws') + || contains(needs.detect-changes.outputs.changes, 'build') + || contains(needs.detect-changes.outputs.changes, 'shared') + uses: ./.github/workflows/Component.BuildTest.yml + with: + project-name: Component[OpenTelemetry.Resources.AWS] + code-cov-name: Resources.AWS + build-test-resources-gcp: needs: detect-changes if: | diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index a22def56b0..f99a0e859b 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -258,9 +258,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{1FCC8E src\Shared\UriHelper.cs = src\Shared\UriHelper.cs EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.AWS", "src\OpenTelemetry.ResourceDetectors.AWS\OpenTelemetry.ResourceDetectors.AWS.csproj", "{71BABAC0-E299-48BF-93E2-C11C3840B037}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.AWS", "src\OpenTelemetry.Resources.AWS\OpenTelemetry.Resources.AWS.csproj", "{71BABAC0-E299-48BF-93E2-C11C3840B037}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.AWS.Tests", "test\OpenTelemetry.ResourceDetectors.AWS.Tests\OpenTelemetry.ResourceDetectors.AWS.Tests.csproj", "{DE898A1E-920E-476F-B0DB-A98AFD6E3BF4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.AWS.Tests", "test\OpenTelemetry.Resources.AWS.Tests\OpenTelemetry.Resources.AWS.Tests.csproj", "{DE898A1E-920E-476F-B0DB-A98AFD6E3BF4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.InfluxDB", "src\OpenTelemetry.Exporter.InfluxDB\OpenTelemetry.Exporter.InfluxDB.csproj", "{FD5E9AC8-DC05-4C64-BDC6-D26F5552808E}" EndProject diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/PublicAPI.Unshipped.txt deleted file mode 100644 index 2ca53c2ade..0000000000 --- a/src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/PublicAPI.Unshipped.txt +++ /dev/null @@ -1,6 +0,0 @@ -OpenTelemetry.ResourceDetectors.AWS.AWSEBSResourceDetector -OpenTelemetry.ResourceDetectors.AWS.AWSEBSResourceDetector.AWSEBSResourceDetector() -> void -OpenTelemetry.ResourceDetectors.AWS.AWSEBSResourceDetector.Detect() -> OpenTelemetry.Resources.Resource! -OpenTelemetry.ResourceDetectors.AWS.AWSEC2ResourceDetector -OpenTelemetry.ResourceDetectors.AWS.AWSEC2ResourceDetector.AWSEC2ResourceDetector() -> void -OpenTelemetry.ResourceDetectors.AWS.AWSEC2ResourceDetector.Detect() -> OpenTelemetry.Resources.Resource! diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/net6.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/net6.0/PublicAPI.Unshipped.txt deleted file mode 100644 index 2ac5b3257b..0000000000 --- a/src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/net6.0/PublicAPI.Unshipped.txt +++ /dev/null @@ -1,6 +0,0 @@ -OpenTelemetry.ResourceDetectors.AWS.AWSECSResourceDetector -OpenTelemetry.ResourceDetectors.AWS.AWSECSResourceDetector.AWSECSResourceDetector() -> void -OpenTelemetry.ResourceDetectors.AWS.AWSECSResourceDetector.Detect() -> OpenTelemetry.Resources.Resource! -OpenTelemetry.ResourceDetectors.AWS.AWSEKSResourceDetector -OpenTelemetry.ResourceDetectors.AWS.AWSEKSResourceDetector.AWSEKSResourceDetector() -> void -OpenTelemetry.ResourceDetectors.AWS.AWSEKSResourceDetector.Detect() -> OpenTelemetry.Resources.Resource! diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/AssemblyInfo.cs b/src/OpenTelemetry.ResourceDetectors.AWS/AssemblyInfo.cs deleted file mode 100644 index 85c339d6bd..0000000000 --- a/src/OpenTelemetry.ResourceDetectors.AWS/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.AWS.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] -#else -[assembly: InternalsVisibleTo("OpenTelemetry.ResourceDetectors.AWS.Tests")] -#endif diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/PublicAPI.Shipped.txt b/src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Shipped.txt similarity index 100% rename from src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/PublicAPI.Shipped.txt rename to src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Shipped.txt diff --git a/src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt new file mode 100644 index 0000000000..38b93830ad --- /dev/null +++ b/src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt @@ -0,0 +1,3 @@ +OpenTelemetry.Resources.AWSResourceBuilderExtensions +static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEBSResourceDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! +static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEC2ResourceDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/net6.0/PublicAPI.Shipped.txt b/src/OpenTelemetry.Resources.AWS/.publicApi/net6.0/PublicAPI.Shipped.txt similarity index 100% rename from src/OpenTelemetry.ResourceDetectors.AWS/.publicApi/net6.0/PublicAPI.Shipped.txt rename to src/OpenTelemetry.Resources.AWS/.publicApi/net6.0/PublicAPI.Shipped.txt diff --git a/src/OpenTelemetry.Resources.AWS/.publicApi/net6.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Resources.AWS/.publicApi/net6.0/PublicAPI.Unshipped.txt new file mode 100644 index 0000000000..d744910a0c --- /dev/null +++ b/src/OpenTelemetry.Resources.AWS/.publicApi/net6.0/PublicAPI.Unshipped.txt @@ -0,0 +1,2 @@ +static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSECSResourceDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! +static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEKSResourceDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/AWSEBSResourceDetector.cs b/src/OpenTelemetry.Resources.AWS/AWSEBSResourceDetector.cs similarity index 90% rename from src/OpenTelemetry.ResourceDetectors.AWS/AWSEBSResourceDetector.cs rename to src/OpenTelemetry.Resources.AWS/AWSEBSResourceDetector.cs index 442ffe406c..45510ccc38 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/AWSEBSResourceDetector.cs +++ b/src/OpenTelemetry.Resources.AWS/AWSEBSResourceDetector.cs @@ -6,15 +6,14 @@ #if NET6_0_OR_GREATER using System.Runtime.InteropServices; #endif -using OpenTelemetry.ResourceDetectors.AWS.Models; -using OpenTelemetry.Resources; +using OpenTelemetry.Resources.AWS.Models; -namespace OpenTelemetry.ResourceDetectors.AWS; +namespace OpenTelemetry.Resources.AWS; /// -/// Resource detector for application running in AWS ElasticBeanstalk environment. +/// Resource detector for application running in AWS Elastic Beanstalk environment. /// -public sealed class AWSEBSResourceDetector : IResourceDetector +internal sealed class AWSEBSResourceDetector : IResourceDetector { private const string AWSEBSMetadataWindowsFilePath = "C:\\Program Files\\Amazon\\XRay\\environment.conf"; #if NET6_0_OR_GREATER @@ -22,7 +21,7 @@ public sealed class AWSEBSResourceDetector : IResourceDetector #endif /// - /// Detector the required and optional resource attributes from AWS ElasticBeanstalk. + /// Detector the required and optional resource attributes from AWS Elastic Beanstalk. /// /// Resource with key-value pairs of resource attributes. public Resource Detect() diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/AWSEC2ResourceDetector.cs b/src/OpenTelemetry.Resources.AWS/AWSEC2ResourceDetector.cs similarity index 95% rename from src/OpenTelemetry.ResourceDetectors.AWS/AWSEC2ResourceDetector.cs rename to src/OpenTelemetry.Resources.AWS/AWSEC2ResourceDetector.cs index ce5e0bfffc..d00d0997a8 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/AWSEC2ResourceDetector.cs +++ b/src/OpenTelemetry.Resources.AWS/AWSEC2ResourceDetector.cs @@ -3,15 +3,14 @@ using System; using System.Collections.Generic; -using OpenTelemetry.ResourceDetectors.AWS.Models; -using OpenTelemetry.Resources; +using OpenTelemetry.Resources.AWS.Models; -namespace OpenTelemetry.ResourceDetectors.AWS; +namespace OpenTelemetry.Resources.AWS; /// /// Resource detector for application running on AWS EC2 instance. /// -public sealed class AWSEC2ResourceDetector : IResourceDetector +internal sealed class AWSEC2ResourceDetector : IResourceDetector { private const string AWSEC2MetadataTokenTTLHeader = "X-aws-ec2-metadata-token-ttl-seconds"; private const string AWSEC2MetadataTokenHeader = "X-aws-ec2-metadata-token"; diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/AWSECSResourceDetector.cs b/src/OpenTelemetry.Resources.AWS/AWSECSResourceDetector.cs similarity index 98% rename from src/OpenTelemetry.ResourceDetectors.AWS/AWSECSResourceDetector.cs rename to src/OpenTelemetry.Resources.AWS/AWSECSResourceDetector.cs index 709c56560d..fe6019f5ff 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/AWSECSResourceDetector.cs +++ b/src/OpenTelemetry.Resources.AWS/AWSECSResourceDetector.cs @@ -7,14 +7,13 @@ using System.Net.Http; using System.Text.Json; using System.Text.RegularExpressions; -using OpenTelemetry.Resources; -namespace OpenTelemetry.ResourceDetectors.AWS; +namespace OpenTelemetry.Resources.AWS; /// /// Resource detector for application running in AWS ECS. /// -public sealed class AWSECSResourceDetector : IResourceDetector +internal sealed class AWSECSResourceDetector : IResourceDetector { private const string AWSECSMetadataPath = "/proc/self/cgroup"; private const string AWSECSMetadataURLKey = "ECS_CONTAINER_METADATA_URI"; diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/AWSEKSResourceDetector.cs b/src/OpenTelemetry.Resources.AWS/AWSEKSResourceDetector.cs similarity index 96% rename from src/OpenTelemetry.ResourceDetectors.AWS/AWSEKSResourceDetector.cs rename to src/OpenTelemetry.Resources.AWS/AWSEKSResourceDetector.cs index c8a616f2b7..8efcafa656 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/AWSEKSResourceDetector.cs +++ b/src/OpenTelemetry.Resources.AWS/AWSEKSResourceDetector.cs @@ -1,21 +1,19 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#if !NETFRAMEWORK - +#if !NETFRAMEWORK using System; using System.Collections.Generic; using System.Net.Http; using System.Text; -using OpenTelemetry.ResourceDetectors.AWS.Models; -using OpenTelemetry.Resources; +using OpenTelemetry.Resources.AWS.Models; -namespace OpenTelemetry.ResourceDetectors.AWS; +namespace OpenTelemetry.Resources.AWS; /// /// Resource detector for application running in AWS EKS. /// -public sealed class AWSEKSResourceDetector : IResourceDetector +internal sealed class AWSEKSResourceDetector : IResourceDetector { private const string AWSEKSCertificatePath = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"; private const string AWSEKSCredentialPath = "/var/run/secrets/kubernetes.io/serviceaccount/token"; diff --git a/src/OpenTelemetry.Resources.AWS/AWSResourceBuilderExtensions.cs b/src/OpenTelemetry.Resources.AWS/AWSResourceBuilderExtensions.cs new file mode 100644 index 0000000000..572af5aba9 --- /dev/null +++ b/src/OpenTelemetry.Resources.AWS/AWSResourceBuilderExtensions.cs @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +using OpenTelemetry.Internal; +using OpenTelemetry.Resources.AWS; + +namespace OpenTelemetry.Resources; + +/// +/// Extension methods to simplify registering of AWS resource detectors. +/// +public static class AWSResourceBuilderExtensions +{ + /// + /// Enables AWS Elastic Beanstalk resource detector. + /// + /// being configured. + /// The instance of being configured. + public static ResourceBuilder AddAWSEBSResourceDetector(this ResourceBuilder builder) + { + Guard.ThrowIfNull(builder); + return builder.AddDetector(new AWSEBSResourceDetector()); + } + + /// + /// Enables AWS EC2 resource detector. + /// + /// being configured. + /// The instance of being configured. + public static ResourceBuilder AddAWSEC2ResourceDetector(this ResourceBuilder builder) + { + Guard.ThrowIfNull(builder); + return builder.AddDetector(new AWSEC2ResourceDetector()); + } + +#if !NETFRAMEWORK + /// + /// Enables AWS ECS resource detector. + /// + /// being configured. + /// The instance of being configured. + public static ResourceBuilder AddAWSECSResourceDetector(this ResourceBuilder builder) + { + Guard.ThrowIfNull(builder); + return builder.AddDetector(new AWSECSResourceDetector()); + } + + /// + /// Enables AWS EKS resource detector. + /// + /// being configured. + /// The instance of being configured. + public static ResourceBuilder AddAWSEKSResourceDetector(this ResourceBuilder builder) + { + Guard.ThrowIfNull(builder); + return builder.AddDetector(new AWSEKSResourceDetector()); + } +#endif +} diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/AWSResourcesEventSource.cs b/src/OpenTelemetry.Resources.AWS/AWSResourcesEventSource.cs similarity index 98% rename from src/OpenTelemetry.ResourceDetectors.AWS/AWSResourcesEventSource.cs rename to src/OpenTelemetry.Resources.AWS/AWSResourcesEventSource.cs index b956947a95..b3d4ebb864 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/AWSResourcesEventSource.cs +++ b/src/OpenTelemetry.Resources.AWS/AWSResourcesEventSource.cs @@ -5,7 +5,7 @@ using System.Diagnostics.Tracing; using OpenTelemetry.Internal; -namespace OpenTelemetry.ResourceDetectors.AWS; +namespace OpenTelemetry.Resources.AWS; [EventSource(Name = "OpenTelemetry-ResourceDetectors-AWS")] internal sealed class AWSResourcesEventSource : EventSource, IServerCertificateValidationEventSource diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/AWSSemanticConventions.cs b/src/OpenTelemetry.Resources.AWS/AWSSemanticConventions.cs similarity index 97% rename from src/OpenTelemetry.ResourceDetectors.AWS/AWSSemanticConventions.cs rename to src/OpenTelemetry.Resources.AWS/AWSSemanticConventions.cs index 850e6f4a44..1f5cd829d8 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/AWSSemanticConventions.cs +++ b/src/OpenTelemetry.Resources.AWS/AWSSemanticConventions.cs @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -namespace OpenTelemetry.ResourceDetectors.AWS; +namespace OpenTelemetry.Resources.AWS; internal static class AWSSemanticConventions { diff --git a/src/OpenTelemetry.Resources.AWS/AssemblyInfo.cs b/src/OpenTelemetry.Resources.AWS/AssemblyInfo.cs new file mode 100644 index 0000000000..3fb32600ed --- /dev/null +++ b/src/OpenTelemetry.Resources.AWS/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.AWS.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")] +#else +[assembly: InternalsVisibleTo("OpenTelemetry.Resources.AWS.Tests")] +#endif diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/CHANGELOG.md b/src/OpenTelemetry.Resources.AWS/CHANGELOG.md similarity index 100% rename from src/OpenTelemetry.ResourceDetectors.AWS/CHANGELOG.md rename to src/OpenTelemetry.Resources.AWS/CHANGELOG.md diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEBSMetadataModel.cs b/src/OpenTelemetry.Resources.AWS/Models/AWSEBSMetadataModel.cs similarity index 88% rename from src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEBSMetadataModel.cs rename to src/OpenTelemetry.Resources.AWS/Models/AWSEBSMetadataModel.cs index a806fb8f69..223e5f9b47 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEBSMetadataModel.cs +++ b/src/OpenTelemetry.Resources.AWS/Models/AWSEBSMetadataModel.cs @@ -3,7 +3,7 @@ using System.Text.Json.Serialization; -namespace OpenTelemetry.ResourceDetectors.AWS.Models; +namespace OpenTelemetry.Resources.AWS.Models; internal class AWSEBSMetadataModel { diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEC2IdentityDocumentModel.cs b/src/OpenTelemetry.Resources.AWS/Models/AWSEC2IdentityDocumentModel.cs similarity index 91% rename from src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEC2IdentityDocumentModel.cs rename to src/OpenTelemetry.Resources.AWS/Models/AWSEC2IdentityDocumentModel.cs index 4bd2f4dfef..665318c356 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEC2IdentityDocumentModel.cs +++ b/src/OpenTelemetry.Resources.AWS/Models/AWSEC2IdentityDocumentModel.cs @@ -3,7 +3,7 @@ using System.Text.Json.Serialization; -namespace OpenTelemetry.ResourceDetectors.AWS.Models; +namespace OpenTelemetry.Resources.AWS.Models; internal class AWSEC2IdentityDocumentModel { diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEKSClusterDataModel.cs b/src/OpenTelemetry.Resources.AWS/Models/AWSEKSClusterDataModel.cs similarity index 82% rename from src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEKSClusterDataModel.cs rename to src/OpenTelemetry.Resources.AWS/Models/AWSEKSClusterDataModel.cs index 0284548085..06c7e7c6ce 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEKSClusterDataModel.cs +++ b/src/OpenTelemetry.Resources.AWS/Models/AWSEKSClusterDataModel.cs @@ -3,7 +3,7 @@ using System.Text.Json.Serialization; -namespace OpenTelemetry.ResourceDetectors.AWS.Models; +namespace OpenTelemetry.Resources.AWS.Models; internal sealed class AWSEKSClusterDataModel { diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEKSClusterInformationModel.cs b/src/OpenTelemetry.Resources.AWS/Models/AWSEKSClusterInformationModel.cs similarity index 82% rename from src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEKSClusterInformationModel.cs rename to src/OpenTelemetry.Resources.AWS/Models/AWSEKSClusterInformationModel.cs index b732eb7795..3fe0f39482 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/Models/AWSEKSClusterInformationModel.cs +++ b/src/OpenTelemetry.Resources.AWS/Models/AWSEKSClusterInformationModel.cs @@ -3,7 +3,7 @@ using System.Text.Json.Serialization; -namespace OpenTelemetry.ResourceDetectors.AWS.Models; +namespace OpenTelemetry.Resources.AWS.Models; internal sealed class AWSEKSClusterInformationModel { diff --git a/src/OpenTelemetry.ResourceDetectors.AWS/OpenTelemetry.ResourceDetectors.AWS.csproj b/src/OpenTelemetry.Resources.AWS/OpenTelemetry.Resources.AWS.csproj similarity index 96% rename from src/OpenTelemetry.ResourceDetectors.AWS/OpenTelemetry.ResourceDetectors.AWS.csproj rename to src/OpenTelemetry.Resources.AWS/OpenTelemetry.Resources.AWS.csproj index b8d2ea3cd7..102b4946b0 100644 --- a/src/OpenTelemetry.ResourceDetectors.AWS/OpenTelemetry.ResourceDetectors.AWS.csproj +++ b/src/OpenTelemetry.Resources.AWS/OpenTelemetry.Resources.AWS.csproj @@ -5,7 +5,7 @@ net6.0 $(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion) OpenTelemetry Extensions - AWS Resource Detectors for ElasticBeanstalk, EC2, ECS, EKS. - ResourceDetectors.AWS- + Resources.AWS-