Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Resources.Azure] Rename Azure detector namespace #1840

Merged
merged 9 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ body:
- OpenTelemetry.PersistentStorage.Abstractions
- OpenTelemetry.PersistentStorage.FileSystem
- OpenTelemetry.ResourceDetectors.AWS
- OpenTelemetry.ResourceDetectors.Azure
- OpenTelemetry.ResourceDetectors.Container
- OpenTelemetry.Resources.Azure
- OpenTelemetry.Resources.Gcp
- OpenTelemetry.Resources.Host
- OpenTelemetry.Resources.Process
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ body:
- OpenTelemetry.PersistentStorage.Abstractions
- OpenTelemetry.PersistentStorage.FileSystem
- OpenTelemetry.ResourceDetectors.AWS
- OpenTelemetry.ResourceDetectors.Azure
- OpenTelemetry.ResourceDetectors.Container
- OpenTelemetry.Resources.Azure
- OpenTelemetry.Resources.Gcp
- OpenTelemetry.Resources.Host
- OpenTelemetry.Resources.Process
Expand Down
4 changes: 2 additions & 2 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ flags:
- src/OpenTelemetry.PersistentStorage.Abstractions
- src/OpenTelemetry.PersistentStorage.FileSystem

unittests-ResourceDetectors.Azure:
unittests-Resources.Azure:
carryforward: true
paths:
- src/OpenTelemetry.ResourceDetectors.Azure
- src/OpenTelemetry.Resources.Azure

unittests-Resources.Gcp:
carryforward: true
Expand Down
12 changes: 6 additions & 6 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ components:
src/OpenTelemetry.ResourceDetectors.AWS/:
- srprash
- ppittle
src/OpenTelemetry.ResourceDetectors.Azure/:
- rajkumar-rangaraj
- vishweshbankwar
src/OpenTelemetry.ResourceDetectors.Container/:
- iskiselev
src/OpenTelemetry.Resources.Azure/:
- rajkumar-rangaraj
- vishweshbankwar
src/OpenTelemetry.Resources.Host/:
- Kielek
- lachmatt
Expand Down Expand Up @@ -152,11 +152,11 @@ components:
test/OpenTelemetry.ResourceDetectors.AWS.Tests/:
- srprash
- ppittle
test/OpenTelemetry.ResourceDetectors.Azure.Tests/:
- rajkumar-rangaraj
- vishweshbankwar
test/OpenTelemetry.ResourceDetectors.Container.Tests/:
- iskiselev
test/OpenTelemetry.Resources.Azure.Tests/:
- rajkumar-rangaraj
- vishweshbankwar
test/OpenTelemetry.Resources.Host.Tests/:
- Kielek
- lachmatt
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:
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-azure: ['*/OpenTelemetry.Resources.Azure*/**', '!**/*.md']
resources-gcp: ['*/OpenTelemetry.Resources.Gcp*/**', '!**/*.md']
resources-host: ['*/OpenTelemetry.Resources.Host*/**', '!**/*.md']
resources-process: ['*/OpenTelemetry.Resources.Process/**', '*/OpenTelemetry.Resources.Process.Tests/**', '!**/*.md']
Expand Down Expand Up @@ -409,27 +409,27 @@ jobs:
project-name: Component[OpenTelemetry.ResourceDetectors.AWS]
code-cov-name: ResourceDetectors.AWS

build-test-resourcedetectors-azure:
build-test-resourcedetectors-container:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'resourcedetectors-azure')
contains(needs.detect-changes.outputs.changes, 'resourcedetectors-container')
|| 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.Azure]
code-cov-name: ResourceDetectors.Azure
project-name: Component[OpenTelemetry.ResourceDetectors.Container]
code-cov-name: ResourceDetectors.Container

build-test-resourcedetectors-container:
build-test-resources-azure:
needs: detect-changes
if: |
contains(needs.detect-changes.outputs.changes, 'resourcedetectors-container')
contains(needs.detect-changes.outputs.changes, 'resources-azure')
|| 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.Container]
code-cov-name: ResourceDetectors.Container
project-name: Component[OpenTelemetry.Resources.Azure]
code-cov-name: Resources.Azure

build-test-resources-gcp:
needs: detect-changes
Expand Down Expand Up @@ -525,8 +525,8 @@ jobs:
|| contains(needs.detect-changes.outputs.changes, 'instrumentation-sqlclient')
|| contains(needs.detect-changes.outputs.changes, 'instrumentation-stackexchangeredis')
|| contains(needs.detect-changes.outputs.changes, 'resourcedetectors-aws')
|| contains(needs.detect-changes.outputs.changes, 'resourcedetectors-azure')
|| contains(needs.detect-changes.outputs.changes, 'resourcedetectors-container')
|| contains(needs.detect-changes.outputs.changes, 'resources-azure')
|| contains(needs.detect-changes.outputs.changes, 'resources-host')
|| contains(needs.detect-changes.outputs.changes, 'resources-process')
|| contains(needs.detect-changes.outputs.changes, 'resources-processruntime')
Expand Down Expand Up @@ -572,9 +572,9 @@ jobs:
build-test-instrumentation-stackexchangeredis-integration,
build-test-instrumentation-wcf,
build-test-persistentstorage,
build-test-resourcedetectors-azure,
build-test-resourcedetectors-aws,
build-test-resourcedetectors-container,
build-test-resources-azure,
build-test-resources-gcp,
build-test-resources-host,
build-test-resources-process,
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-dotnet-contrib.sln
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentati
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.Cassandra.Tests", "test\OpenTelemetry.Instrumentation.Cassandra.Tests\OpenTelemetry.Instrumentation.Cassandra.Tests.csproj", "{FB48DC44-8C56-4329-9988-AEDF931E81E8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.Azure", "src\OpenTelemetry.ResourceDetectors.Azure\OpenTelemetry.ResourceDetectors.Azure.csproj", "{B07DC3CB-F724-40A5-889A-DA6601F462F3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.Azure", "src\OpenTelemetry.Resources.Azure\OpenTelemetry.Resources.Azure.csproj", "{B07DC3CB-F724-40A5-889A-DA6601F462F3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.Azure.Tests", "test\OpenTelemetry.ResourceDetectors.Azure.Tests\OpenTelemetry.ResourceDetectors.Azure.Tests.csproj", "{DFC6A4A9-5262-4507-B747-CC6B814205E6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.Azure.Tests", "test\OpenTelemetry.Resources.Azure.Tests\OpenTelemetry.Resources.Azure.Tests.csproj", "{DFC6A4A9-5262-4507-B747-CC6B814205E6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.OneCollector", "src\OpenTelemetry.Exporter.OneCollector\OpenTelemetry.Exporter.OneCollector.csproj", "{73C10993-03AC-42F4-85BB-96EAAA8212D9}"
EndProject
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions src/OpenTelemetry.ResourceDetectors.Azure/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OpenTelemetry.Resources.AzureResourceBuilderExtensions
static OpenTelemetry.Resources.AzureResourceBuilderExtensions.AddAppServiceResourceDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder!
static OpenTelemetry.Resources.AzureResourceBuilderExtensions.AddAzureVMResourceDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder!
static OpenTelemetry.Resources.AzureResourceBuilderExtensions.AddAzureContainerAppsResourceDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder!
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

using System;
using System.Collections.Generic;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;

namespace OpenTelemetry.ResourceDetectors.Azure;
namespace OpenTelemetry.Resources.Azure;

/// <summary>
/// Resource detector for Azure AppService environment.
/// </summary>
public sealed class AppServiceResourceDetector : IResourceDetector
internal sealed class AppServiceResourceDetector : IResourceDetector
{
internal static readonly IReadOnlyDictionary<string, string> AppServiceResourceAttributes = new Dictionary<string, string>
{
Expand Down
10 changes: 10 additions & 0 deletions src/OpenTelemetry.Resources.Azure/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

using System.Runtime.CompilerServices;

#if SIGNED
[assembly: InternalsVisibleTo("OpenTelemetry.Resources.Azure.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
#else
[assembly: InternalsVisibleTo("OpenTelemetry.Resources.Azure.Tests")]
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

using System;
using System.Collections.Generic;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;

namespace OpenTelemetry.ResourceDetectors.Azure;
namespace OpenTelemetry.Resources.Azure;

/// <summary>
/// Resource detector for Azure Container Apps environment.
/// </summary>
public sealed class AzureContainerAppsResourceDetector : IResourceDetector
internal sealed class AzureContainerAppsResourceDetector : IResourceDetector
{
internal static readonly IReadOnlyDictionary<string, string> AzureContainerResourceAttributes = new Dictionary<string, string>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

using OpenTelemetry.Internal;
using OpenTelemetry.Resources.Azure;

namespace OpenTelemetry.Resources;

/// <summary>
/// Extension methods to simplify registering of Azure resource detectors.
/// </summary>
public static class AzureResourceBuilderExtensions
{
/// <summary>
/// Enables Azure AppService resource detector.
/// </summary>
/// <param name="builder"><see cref="ResourceBuilder" /> being configured.</param>
/// <returns>The instance of <see cref="ResourceBuilder" /> being configured.</returns>
public static ResourceBuilder AddAppServiceResourceDetector(this ResourceBuilder builder)
matt-hensley marked this conversation as resolved.
Show resolved Hide resolved
{
Guard.ThrowIfNull(builder);
return builder.AddDetector(new AppServiceResourceDetector());
}

/// <summary>
/// Enables Azure VM resource detector.
/// </summary>
/// <param name="builder"><see cref="ResourceBuilder" /> being configured.</param>
/// <returns>The instance of <see cref="ResourceBuilder" /> being configured.</returns>
public static ResourceBuilder AddAzureVMResourceDetector(this ResourceBuilder builder)
Kielek marked this conversation as resolved.
Show resolved Hide resolved
{
Guard.ThrowIfNull(builder);
return builder.AddDetector(new AzureVMResourceDetector());
}

/// <summary>
/// Enables Azure Container Apps resource detector.
/// </summary>
/// <param name="builder"><see cref="ResourceBuilder" /> being configured.</param>
/// <returns>The instance of <see cref="ResourceBuilder" /> being configured.</returns>
public static ResourceBuilder AddAzureContainerAppsResourceDetector(this ResourceBuilder builder)
Kielek marked this conversation as resolved.
Show resolved Hide resolved
{
Guard.ThrowIfNull(builder);
return builder.AddDetector(new AzureContainerAppsResourceDetector());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
// SPDX-License-Identifier: Apache-2.0

using System.Collections.Generic;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;

namespace OpenTelemetry.ResourceDetectors.Azure;
namespace OpenTelemetry.Resources.Azure;

/// <summary>
/// Resource detector for Azure VM environment.
/// </summary>
public sealed class AzureVMResourceDetector : IResourceDetector
internal sealed class AzureVMResourceDetector : IResourceDetector
{
internal static readonly IReadOnlyCollection<string> ExpectedAzureAmsFields = new string[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Net.Http;
using System.Text.Json;

namespace OpenTelemetry.ResourceDetectors.Azure;
namespace OpenTelemetry.Resources.Azure;

internal static class AzureVmMetaDataRequestor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text.Json.Serialization;
using OpenTelemetry.Trace;

namespace OpenTelemetry.ResourceDetectors.Azure;
namespace OpenTelemetry.Resources.Azure;

internal sealed class AzureVmMetadataResponse
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

## Unreleased

* **Breaking Change**: Renamed package from `OpenTelemetry.ResourceDetectors.Azure`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 very nicely written changelog.

to `OpenTelemetry.Resources.Azure`.
([#1840](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1840))
* **Breaking Change**: `AppServiceResourceDetector` type is now internal, use `ResourceBuilder`
extension method `AddAppServiceResourceDetector` to enable the detector.
([#1840](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1840))
* **Breaking Change**: `AzureVMResourceDetector` type is now internal, use `ResourceBuilder`
extension method `AddAzureVMResourceDetector` to enable the detector.
([#1840](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1840))
* **Breaking Change**: `AzureContainerAppsResourceDetector` type is now
internal, use `ResourceBuilder` extension method `AddAzureContainerAppsResourceDetector`
to enable the detector.
([#1840](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1840))
* Update OpenTelemetry SDK version to `1.8.1`.
([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<Description>OpenTelemetry Resource Detectors for Azure cloud environments</Description>
<PackageTags>$(PackageTags);ResourceDetector</PackageTags>
<MinVerTagPrefix>ResourceDetectors.Azure-</MinVerTagPrefix>
<MinVerTagPrefix>Resources.Azure-</MinVerTagPrefix>
</PropertyGroup>

<!--Do not run Package Baseline Validation as this package has never released a stable version.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Resource Detectors for Azure cloud environments

[![NuGet version badge](https://img.shields.io/nuget/v/OpenTelemetry.ResourceDetectors.Azure)](https://www.nuget.org/packages/OpenTelemetry.ResourceDetectors.Azure)
[![NuGet download count badge](https://img.shields.io/nuget/dt/OpenTelemetry.ResourceDetectors.Azure)](https://www.nuget.org/packages/OpenTelemetry.ResourceDetectors.Azure)
[![codecov.io](https://codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/branch/main/graphs/badge.svg?flag=unittests-ResourceDetectors.Azure)](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib?flags[0]=unittests-ResourceDetectors.Azure)
[![NuGet version badge](https://img.shields.io/nuget/v/OpenTelemetry.Resources.Azure)](https://www.nuget.org/packages/OpenTelemetry.Resources.Azure)
[![NuGet download count badge](https://img.shields.io/nuget/dt/OpenTelemetry.Resources.Azure)](https://www.nuget.org/packages/OpenTelemetry.Resources.Azure)
[![codecov.io](https://codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/branch/main/graphs/badge.svg?flag=unittests-Resources.Azure)](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib?flags[0]=unittests-Resources.Azure)

This package contains [Resource
Detectors](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#detecting-resource-information-from-the-environment)
Expand All @@ -11,7 +11,7 @@ for applications running in Azure environment.
## Installation

```shell
dotnet add package --prerelease OpenTelemetry.ResourceDetectors.Azure
dotnet add package --prerelease OpenTelemetry.Resources.Azure
```

## App Service Resource Detector
Expand All @@ -23,12 +23,11 @@ as well.

```csharp
using OpenTelemetry;
using OpenTelemetry.ResourceDetectors.Azure;
using OpenTelemetry.Resources;

var tracerProvider = Sdk.CreateTracerProviderBuilder()
// other configurations
.ConfigureResource(resource => resource.AddDetector(new AppServiceResourceDetector()))
.ConfigureResource(resource => resource.AddAppServiceResourceDetector())
Kielek marked this conversation as resolved.
Show resolved Hide resolved
.Build();
```

Expand All @@ -53,12 +52,11 @@ as well.

```csharp
using OpenTelemetry;
using OpenTelemetry.ResourceDetectors.Azure;
using OpenTelemetry.Resources;

var tracerProvider = Sdk.CreateTracerProviderBuilder()
// other configurations
.ConfigureResource(resource => resource.AddDetector(new AzureVMResourceDetector()))
.ConfigureResource(resource => resource.AddAzureVMResourceDetector())
.Build();
```

Expand Down Expand Up @@ -86,12 +84,11 @@ well.

```csharp
using OpenTelemetry;
using OpenTelemetry.ResourceDetectors.Azure;
using OpenTelemetry.Resources;

var tracerProvider = Sdk.CreateTracerProviderBuilder()
// other configurations
.ConfigureResource(resource => resource.AddDetector(new AzureContainerAppsResourceDetector()))
.ConfigureResource(resource => resource.AddAzureContainerAppsResourceDetector())
.Build();
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

namespace OpenTelemetry.ResourceDetectors.Azure;
namespace OpenTelemetry.Resources.Azure;

internal sealed class ResourceAttributeConstants
{
Expand Down
Loading
Loading