Skip to content

Commit

Permalink
[Resources.Process] Rename process detector namespace (#1717)
Browse files Browse the repository at this point in the history
Co-authored-by: Piotr Kiełkowicz <[email protected]>
  • Loading branch information
matt-hensley and Kielek authored May 15, 2024
1 parent c5e8f19 commit cf0258d
Show file tree
Hide file tree
Showing 22 changed files with 86 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ body:
- OpenTelemetry.ResourceDetectors.Azure
- OpenTelemetry.ResourceDetectors.Container
- OpenTelemetry.ResourceDetectors.Host
- OpenTelemetry.ResourceDetectors.Process
- OpenTelemetry.ResourceDetectors.ProcessRuntime
- OpenTelemetry.Resources.Gcp
- OpenTelemetry.Resources.Process
- OpenTelemetry.Sampler.AWS
- OpenTelemetry.SemanticConventions
validations:
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 @@ -52,9 +52,9 @@ body:
- OpenTelemetry.ResourceDetectors.Azure
- OpenTelemetry.ResourceDetectors.Container
- OpenTelemetry.ResourceDetectors.Host
- OpenTelemetry.ResourceDetectors.Process
- OpenTelemetry.ResourceDetectors.ProcessRuntime
- OpenTelemetry.Resources.Gcp
- OpenTelemetry.Resources.Process
- OpenTelemetry.Sampler.AWS
- OpenTelemetry.SemanticConventions

Expand Down
8 changes: 4 additions & 4 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ flags:
paths:
- src/OpenTelemetry.ResourceDetectors.Host

unittests-ResourceDetectors.Process:
unittests-ResourceDetectors.ProcessRuntime:
carryforward: true
paths:
- src/OpenTelemetry.ResourceDetectors.Process
- src/OpenTelemetry.ResourceDetectors.ProcessRuntime

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

unittests-SemanticConventions:
carryforward: true
Expand Down
8 changes: 4 additions & 4 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ components:
src/OpenTelemetry.ResourceDetectors.Host/:
- Kielek
- lachmatt
src/OpenTelemetry.ResourceDetectors.Process/:
src/OpenTelemetry.ResourceDetectors.ProcessRuntime/:
- Kielek
- lachmatt
src/OpenTelemetry.ResourceDetectors.ProcessRuntime/:
src/OpenTelemetry.Resources.Process/:
- Kielek
- lachmatt
src/OpenTelemetry.Resources.Gcp/:
Expand Down Expand Up @@ -166,10 +166,10 @@ components:
test/OpenTelemetry.ResourceDetectors.Host.Tests/:
- Kielek
- lachmatt
test/OpenTelemetry.ResourceDetectors.Process.Tests/:
test/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/:
- Kielek
- lachmatt
test/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/:
test/OpenTelemetry.Resources.Process.Tests/:
- Kielek
- lachmatt
test/OpenTelemetry.Resources.Gcp.Tests/:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
owin: ['*/OpenTelemetry.Instrumentation.Owin*/**', 'examples/owin/**', '!**/*.md']
persistentstorage: ['*/OpenTelemetry.PersistentStorage*/**', '!**/*.md']
process: ['*/OpenTelemetry.Instrumentation.Process*/**', 'examples/process-instrumentation/**', '!**/*.md']
processdetector: ['*/OpenTelemetry.ResourceDetectors.Process/**', '*/OpenTelemetry.ResourceDetectors.Process.Tests/**', '!**/*.md']
processdetector: ['*/OpenTelemetry.Resources.Process/**', '*/OpenTelemetry.Resources.Process.Tests/**', '!**/*.md']
processruntime: ['*/OpenTelemetry.ResourceDetectors.ProcessRuntime/**', '*/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/**', '!**/*.md']
redis: ['*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**', 'examples/redis/**', '!**/*.md']
resourcedetectors: ['*/OpenTelemetry.ResourceDetectors.*/**', '!**/*.md']
Expand All @@ -56,11 +56,11 @@ jobs:
'!examples/AspNet/**',
'!*/OpenTelemetry.ResourceDetectors.Azure*/**',
'!*/OpenTelemetry.ResourceDetectors.Host*/**',
'!*/OpenTelemetry.ResourceDetectors.Process/**',
'!*/OpenTelemetry.ResourceDetectors.Process.Tests/**',
'!*/OpenTelemetry.ResourceDetectors.ProcessRuntime/**',
'!*/OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests/**',
'!*/OpenTelemetry.Resources.Gcp*/**',
'!*/OpenTelemetry.Resources.Process/**',
'!*/OpenTelemetry.Resources.Process.Tests/**',
'!*/OpenTelemetry.Instrumentation.EventCounters*/**',
'!examples/event-counters/**',
'!*/OpenTelemetry.Extensions/**',
Expand Down Expand Up @@ -267,8 +267,8 @@ jobs:
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/Component.BuildTest.yml
with:
project-name: OpenTelemetry.ResourceDetectors.Process
code-cov-name: ResourceDetectors.Process
project-name: OpenTelemetry.Resources.Process
code-cov-name: Resources.Process

build-test-processruntime:
needs: detect-changes
Expand Down Expand Up @@ -391,9 +391,9 @@ jobs:
OpenTelemetry.PersistentStorage.FileSystem.Tests.csproj,
OpenTelemetry.ResourceDetectors.Azure.Tests.csproj,
OpenTelemetry.ResourceDetectors.Host.Tests.csproj,
OpenTelemetry.ResourceDetectors.Process.Tests.csproj,
OpenTelemetry.ResourceDetectors.ProcessRuntime.Tests.csproj,
OpenTelemetry.Resources.Gcp.Tests.csproj
OpenTelemetry.Resources.Gcp.Tests.csproj,
OpenTelemetry.Resources.Process.Tests.csproj
$failedProjects = @()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pack OpenTelemetry.ResourceDetectors.Process
name: Pack OpenTelemetry.Resources.Process

on:
workflow_dispatch:
Expand All @@ -9,13 +9,13 @@ on:
default: 'warning'
push:
tags:
- 'ResourceDetectors.Process-*' # trigger when we create a tag with prefix "ResourceDetectors.Process-"
- 'Resources.Process-*' # trigger when we create a tag with prefix "Resources.Process-"

jobs:
call-build-test-pack:
permissions:
contents: write
uses: ./.github/workflows/Component.Package.yml
with:
project-name: OpenTelemetry.ResourceDetectors.Process
project-name: OpenTelemetry.Resources.Process
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
</PropertyGroup>

<ItemGroup>
<SolutionProjects Include="$(RepoRoot)\src\OpenTelemetry.ResourceDetectors.Process\OpenTelemetry.ResourceDetectors.Process.csproj" />
<SolutionProjects Include="$(RepoRoot)\test\OpenTelemetry.ResourceDetectors.Process.Tests\OpenTelemetry.ResourceDetectors.Process.Tests.csproj" />
<SolutionProjects Include="$(RepoRoot)\src\OpenTelemetry.Resources.Process\OpenTelemetry.Resources.Process.csproj" />
<SolutionProjects Include="$(RepoRoot)\test\OpenTelemetry.Resources.Process.Tests\OpenTelemetry.Resources.Process.Tests.csproj" />

<PackProjects Include="$(RepoRoot)\src\OpenTelemetry.ResourceDetectors.Process\OpenTelemetry.ResourceDetectors.Process.csproj" />
<PackProjects Include="$(RepoRoot)\src\OpenTelemetry.Resources.Process\OpenTelemetry.Resources.Process.csproj" />

<TestProjects Include="$(RepoRoot)\test\OpenTelemetry.ResourceDetectors.Process.Tests\OpenTelemetry.ResourceDetectors.Process.Tests.csproj" />
<TestProjects Include="$(RepoRoot)\test\OpenTelemetry.Resources.Process.Tests\OpenTelemetry.Resources.Process.Tests.csproj" />
</ItemGroup>

<Target Name="Build">
Expand Down
8 changes: 4 additions & 4 deletions opentelemetry-dotnet-contrib.sln
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.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.Process.yml = .github\workflows\package-ResourceDetectors.Process.yml
.github\workflows\package-ResourceDetectors.ProcessRuntime.yml = .github\workflows\package-ResourceDetectors.ProcessRuntime.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\sanitycheck.yml = .github\workflows\sanitycheck.yml
Expand Down Expand Up @@ -335,19 +335,19 @@ 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
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.ProcessRuntime", "src\OpenTelemetry.ResourceDetectors.ProcessRuntime\OpenTelemetry.ResourceDetectors.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}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.Process", "src\OpenTelemetry.ResourceDetectors.Process\OpenTelemetry.ResourceDetectors.Process.csproj", "{A5FCDD8F-20FF-4657-804E-707EAD4FE31D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.Process", "src\OpenTelemetry.Resources.Process\OpenTelemetry.Resources.Process.csproj", "{A5FCDD8F-20FF-4657-804E-707EAD4FE31D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.Process.Tests", "test\OpenTelemetry.ResourceDetectors.Process.Tests\OpenTelemetry.ResourceDetectors.Process.Tests.csproj", "{A5EF701C-439E-407F-8BB4-394166000C6D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Resources.Process.Tests", "test\OpenTelemetry.Resources.Process.Tests\OpenTelemetry.Resources.Process.Tests.csproj", "{A5EF701C-439E-407F-8BB4-394166000C6D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetectors.Host", "src\OpenTelemetry.ResourceDetectors.Host\OpenTelemetry.ResourceDetectors.Host.csproj", "{033CA8D4-1529-413A-B244-07958D5F9A48}"
EndProject
Expand Down

This file was deleted.

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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OpenTelemetry.Resources.ProcessResourceBuilderExtensions
static OpenTelemetry.Resources.ProcessResourceBuilderExtensions.AddProcessDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder!
10 changes: 10 additions & 0 deletions src/OpenTelemetry.Resources.Process/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.Process.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051c1562a090fb0c9f391012a32198b5e5d9a60e9b80fa2d7b434c9e5ccb7259bd606e66f9660676afc6692b8cdc6793d190904551d2103b7b22fa636dcbb8208839785ba402ea08fc00c8f1500ccef28bbf599aa64ffb1e1d5dc1bf3420a3777badfe697856e9d52070a50c3ea5821c80bef17ca3acffa28f89dd413f096f898")]
#else
[assembly: InternalsVisibleTo("OpenTelemetry.Resources.Process.Tests")]
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

* **Breaking Change**: Renamed package from `OpenTelemetry.ResourceDetectors.Process`
to `OpenTelemetry.Resources.Process`.
([#1717](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1717))
* **Breaking Change**: `ProcessDetector` type is now internal, use `ResourceBuilder`
extension method `AddProcessDetector` to enable the detector.
([#1717](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1717))
* 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 @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion)</TargetFrameworks>
<Description>OpenTelemetry Extensions - Process Resource Detector.</Description>
<MinVerTagPrefix>ResourceDetectors.Process-</MinVerTagPrefix>
<MinVerTagPrefix>Resources.Process-</MinVerTagPrefix>
</PropertyGroup>

<!--Do not run Package Baseline Validation as this package has never released a stable version.
Expand All @@ -16,4 +16,8 @@
<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

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

namespace OpenTelemetry.ResourceDetectors.Process;
namespace OpenTelemetry.Resources.Process;

/// <summary>
/// Process detector.
/// </summary>
public sealed class ProcessDetector : IResourceDetector
internal sealed class ProcessDetector : IResourceDetector
{
/// <summary>
/// Detects the resource attributes for process.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

using OpenTelemetry.Internal;
using OpenTelemetry.Resources.Process;

namespace OpenTelemetry.Resources;

/// <summary>
/// Extension methods to simplify registering of process resource detectors.
/// </summary>
public static class ProcessResourceBuilderExtensions
{
/// <summary>
/// Enables process 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 AddProcessDetector(this ResourceBuilder builder)
{
Guard.ThrowIfNull(builder);
return builder.AddDetector(new ProcessDetector());
}
}
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.Process;
namespace OpenTelemetry.Resources.Process;

internal static class ProcessSemanticConventions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Process Resource Detectors

[![NuGet version badge](https://img.shields.io/nuget/v/OpenTelemetry.ResourceDetectors.Process)](https://www.nuget.org/packages/OpenTelemetry.ResourceDetectors.Process)
[![NuGet download count badge](https://img.shields.io/nuget/dt/OpenTelemetry.ResourceDetectors.Process)](https://www.nuget.org/packages/OpenTelemetry.ResourceDetectors.Process)
[![NuGet version badge](https://img.shields.io/nuget/v/OpenTelemetry.Resources.Process)](https://www.nuget.org/packages/OpenTelemetry.Resources.Process)
[![NuGet download count badge](https://img.shields.io/nuget/dt/OpenTelemetry.Resources.Process)](https://www.nuget.org/packages/OpenTelemetry.Resources.Process)

> [!IMPORTANT]
> Resources detected by this packages are defined by [experimental semantic convention](https://github.com/open-telemetry/semantic-conventions/blob/v1.24.0/docs/resource/process.md#process).
Expand All @@ -10,11 +10,11 @@
## Getting Started

You need to install the
`OpenTelemetry.ResourceDetectors.Process` package to be able to use the
`OpenTelemetry.Resources.Process` package to be able to use the
Process Runtime Resource Detectors.

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

## Usage
Expand All @@ -24,12 +24,11 @@ the `TracerProvider` with the following example below.

```csharp
using OpenTelemetry;
using OpenTelemetry.ResourceDetectors.Process;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<TrimmerRootAssembly Include="OpenTelemetry.ResourceDetectors.Azure" />
<TrimmerRootAssembly Include="OpenTelemetry.ResourceDetectors.Container" />
<TrimmerRootAssembly Include="OpenTelemetry.ResourceDetectors.Host" />
<TrimmerRootAssembly Include="OpenTelemetry.ResourceDetectors.Process" />
<TrimmerRootAssembly Include="OpenTelemetry.ResourceDetectors.ProcessRuntime" />
<TrimmerRootAssembly Include="OpenTelemetry.Resources.Process" />
<TrimmerRootAssembly Include="OpenTelemetry.Sampler.AWS" />

<TrimmerRootAssembly Update="@(TrimmerRootAssembly)" Path="$(RepoRoot)\src\%(Identity)\%(Identity).csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.ResourceDetectors.Process\OpenTelemetry.ResourceDetectors.Process.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Resources.Process\OpenTelemetry.Resources.Process.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// SPDX-License-Identifier: Apache-2.0

using System.Linq;
using OpenTelemetry.Resources;
using Xunit;

namespace OpenTelemetry.ResourceDetectors.Process.Tests;
namespace OpenTelemetry.Resources.Process.Tests;

public class ProcessDetectorTests
{
Expand Down

0 comments on commit cf0258d

Please sign in to comment.