diff --git a/CHANGELOG.md b/CHANGELOG.md index 66933fbf7..dd1a1a31e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,8 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h - Following packages updated - `MongoDB.Driver.Core.Extensions.DiagnosticSources` from `1.4.0` to `1.5.0`, - `OpenTelemetry.Exporter.Prometheus.HttpListener` from `1.9.0-beta.1` to `1.9.0-beta.2`, - - `OpenTelemetry.Shims.OpenTracing` from `1.9.0-beta.1` to `1.9.0-beta.2`. + - `OpenTelemetry.Shims.OpenTracing` from `1.9.0-beta.1` to `1.9.0-beta.2`, + - `OpenTelemetry.Resources.Host` from `0.1.0-beta.2` to `0.1.0-beta.3`. - .NET only, following packages updated - `OpenTelemetry.Instrumentation.StackExchangeRedis` from `1.0.0-rc9.15` to `1.9.0-beta.1`. - .NET Framework only, following packages updated diff --git a/docs/config.md b/docs/config.md index d552e5e1e..4097af097 100644 --- a/docs/config.md +++ b/docs/config.md @@ -93,8 +93,8 @@ The following resource detectors are included and enabled by default: |-------------------|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------| | `AZUREAPPSERVICE` | Azure App Service detector | [Azure resource detector documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Resources.Azure-1.0.0-beta.8/src/OpenTelemetry.Resources.Azure/README.md) | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) | | `CONTAINER` | Container detector | [Container resource detector documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Resources.Container-1.0.0-beta.9/src/OpenTelemetry.Resources.Container/README.md) **Not supported on .NET Framework** | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) | -| `HOST` | Host detector | [Host resource detector documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Resources.Host-0.1.0-beta.2/src/OpenTelemetry.Resources.Host/README.md) | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) | -| `OPERATINGSYSTEM` | Operating System detector | [Operating System resource detector documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Resources.OperatingSystem-0.1.0-alpha.2/src/OpenTelemetry.Resources.OperatingSystem/README.md) | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) | +| `HOST` | Host detector | [Host resource detector documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Resources.Host-0.1.0-beta.3/src/OpenTelemetry.Resources.Host/README.md) | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) | +| `OPERATINGSYSTEM` | Operating System detector | [Operating System resource detector documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Resources.OperatingSystem-0.1.0-alpha.3/src/OpenTelemetry.Resources.OperatingSystem/README.md) | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) | | `PROCESS` | Process detector | [Process resource detector documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Resources.Process-0.1.0-beta.2/src/OpenTelemetry.Resources.Process/README.md) | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) | | `PROCESSRUNTIME` | Process Runtime detector | [Process Runtime resource detector documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/Resources.ProcessRuntime-0.1.0-beta.2/src/OpenTelemetry.Resources.ProcessRuntime/README.md) | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) | diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 749864050..305fc0eb9 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -28,8 +28,8 @@ - - + + diff --git a/src/OpenTelemetry.AutoInstrumentation.Native/netfx_assembly_redirection.h b/src/OpenTelemetry.AutoInstrumentation.Native/netfx_assembly_redirection.h index a058a7954..4398abf75 100644 --- a/src/OpenTelemetry.AutoInstrumentation.Native/netfx_assembly_redirection.h +++ b/src/OpenTelemetry.AutoInstrumentation.Native/netfx_assembly_redirection.h @@ -55,8 +55,8 @@ void CorProfiler::InitNetFxAssemblyRedirectsMap() { L"OpenTelemetry.Instrumentation.SqlClient", {1, 9, 0, 43} }, { L"OpenTelemetry.Instrumentation.Wcf", {1, 0, 0, 47} }, { L"OpenTelemetry.Resources.Azure", {1, 0, 0, 52} }, - { L"OpenTelemetry.Resources.Host", {0, 1, 0, 53} }, - { L"OpenTelemetry.Resources.OperatingSystem", {0, 1, 0, 95} }, + { L"OpenTelemetry.Resources.Host", {0, 1, 0, 139} }, + { L"OpenTelemetry.Resources.OperatingSystem", {0, 1, 0, 140} }, { L"OpenTelemetry.Resources.Process", {0, 1, 0, 55} }, { L"OpenTelemetry.Resources.ProcessRuntime", {0, 1, 0, 56} }, { L"OpenTelemetry.Shims.OpenTracing", {1, 0, 0, 0} }, diff --git a/test/IntegrationTests/Helpers/OtlpResourceExpector.cs b/test/IntegrationTests/Helpers/OtlpResourceExpector.cs index 567d20fb0..b1daa42ee 100644 --- a/test/IntegrationTests/Helpers/OtlpResourceExpector.cs +++ b/test/IntegrationTests/Helpers/OtlpResourceExpector.cs @@ -12,6 +12,7 @@ namespace IntegrationTests.Helpers; public class OtlpResourceExpector : IDisposable { private readonly List _resourceExpectations = new(); + private readonly List _existenceChecks = new(); private readonly ManualResetEvent _resourceAttributesEvent = new(false); // synchronizes access to _resourceAttributes private RepeatedField? _resourceAttributes; // protobuf type @@ -31,6 +32,11 @@ public class OtlpResourceExpector : IDisposable } } + public void Exist(string key) + { + _existenceChecks.Add(key); + } + public void Expect(string key, string value) { _resourceExpectations.Add(new ResourceExpectation(key, value)); @@ -43,7 +49,7 @@ public class OtlpResourceExpector : IDisposable public void AssertExpectations(TimeSpan? timeout = null) { - if (_resourceExpectations.Count == 0) + if (_resourceExpectations.Count == 0 && _existenceChecks.Count == 0) { throw new InvalidOperationException("Expectations were not set"); } @@ -58,6 +64,27 @@ public class OtlpResourceExpector : IDisposable return; } + if (_resourceAttributes == null) + { + Assert.Fail("No resource attributes have been collected"); + } + + var message = new StringBuilder(); + + foreach (var key in _existenceChecks) + { + var keyExists = _resourceAttributes.Any(attr => attr.Key == key); + if (!keyExists) + { + message.AppendLine($"Resource attribute \"{key}\" was not found"); + } + } + + if (message.Length > 0) + { + Assert.Fail(message.ToString()); + } + AssertResource(_resourceExpectations, _resourceAttributes); } catch (ArgumentOutOfRangeException) diff --git a/test/IntegrationTests/SmokeTests.cs b/test/IntegrationTests/SmokeTests.cs index e0c6e4708..5f36cba0c 100644 --- a/test/IntegrationTests/SmokeTests.cs +++ b/test/IntegrationTests/SmokeTests.cs @@ -602,6 +602,7 @@ public class SmokeTests : TestHelper resourceExpector.Expect("process.pid", processId); resourceExpector.Expect("host.name", Environment.MachineName); + #if NETFRAMEWORK resourceExpector.Expect("process.runtime.name", ".NET Framework"); #else @@ -616,6 +617,9 @@ public class SmokeTests : TestHelper _ => throw new PlatformNotSupportedException($"Unknown platform") }; resourceExpector.Expect("os.type", expectedPlatform); + resourceExpector.Exist("os.description"); + resourceExpector.Exist("os.name"); + resourceExpector.Exist("os.version"); } private void VerifyTestApplicationInstrumented(TestAppStartupMode startupMode = TestAppStartupMode.Auto)