diff --git a/.github/workflows/ci-instrumentation-libraries.yml b/.github/workflows/ci-instrumentation-libraries.yml index 546a0ae7447..35408d14250 100644 --- a/.github/workflows/ci-instrumentation-libraries.yml +++ b/.github/workflows/ci-instrumentation-libraries.yml @@ -23,9 +23,6 @@ jobs: runs-on: ${{ matrix.os }} - env: - RunningDotNetPack: true - steps: - uses: actions/checkout@v4 with: @@ -35,10 +32,10 @@ jobs: uses: actions/setup-dotnet@v3 - name: Install dependencies - run: dotnet restore ./build/InstrumentationLibraries.proj + run: dotnet restore ./build/InstrumentationLibraries.proj -p:RunningDotNetPack=true - name: Build - run: dotnet build ./build/InstrumentationLibraries.proj --configuration Release --no-restore + run: dotnet build ./build/InstrumentationLibraries.proj --configuration Release --no-restore -p:RunningDotNetPack=true - name: Test ${{ matrix.version }} - run: dotnet test **/bin/Release/${{ matrix.version }}/OpenTelemetry.Instrumentation*.Tests.dll --logger:"console;verbosity=detailed" + run: dotnet test **/bin/Release/${{ matrix.version }}/OpenTelemetry.Instrumentation*.Tests.dll --framework ${{ matrix.version }} --configuration Release --no-restore --no-build --logger:"console;verbosity=detailed" diff --git a/Directory.Packages.props b/Directory.Packages.props index fd00f3ef3dd..a2245fd9315 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,13 +4,6 @@ 1.6.0 - - - true - $(OTelLatestStableVer) - - - @@ -17,9 +16,6 @@ - - - diff --git a/build/Common.prod.props b/build/Common.prod.props index af8760b3ad7..baca9ebdffd 100644 --- a/build/Common.prod.props +++ b/build/Common.prod.props @@ -4,6 +4,7 @@ $(MSBuildThisFileDirectory)/OpenTelemetry.prod.ruleset true + false diff --git a/build/InstrumentationLibraries.proj b/build/InstrumentationLibraries.proj index e556ef07c62..7cbc88a062c 100644 --- a/build/InstrumentationLibraries.proj +++ b/build/InstrumentationLibraries.proj @@ -4,6 +4,10 @@ - + + + + + diff --git a/docs/logs/correlation/correlation.csproj b/docs/logs/correlation/correlation.csproj index 24f3305944a..19aa9791432 100644 --- a/docs/logs/correlation/correlation.csproj +++ b/docs/logs/correlation/correlation.csproj @@ -1,6 +1,5 @@ - diff --git a/docs/logs/customizing-the-sdk/customizing-the-sdk.csproj b/docs/logs/customizing-the-sdk/customizing-the-sdk.csproj index 24f3305944a..19aa9791432 100644 --- a/docs/logs/customizing-the-sdk/customizing-the-sdk.csproj +++ b/docs/logs/customizing-the-sdk/customizing-the-sdk.csproj @@ -1,6 +1,5 @@ - diff --git a/docs/logs/extending-the-sdk/extending-the-sdk.csproj b/docs/logs/extending-the-sdk/extending-the-sdk.csproj index 92d3323112a..4d96c349671 100644 --- a/docs/logs/extending-the-sdk/extending-the-sdk.csproj +++ b/docs/logs/extending-the-sdk/extending-the-sdk.csproj @@ -1,6 +1,5 @@  - diff --git a/docs/logs/getting-started-aspnetcore/getting-started-aspnetcore.csproj b/docs/logs/getting-started-aspnetcore/getting-started-aspnetcore.csproj index 78fae771881..cebc8460c42 100644 --- a/docs/logs/getting-started-aspnetcore/getting-started-aspnetcore.csproj +++ b/docs/logs/getting-started-aspnetcore/getting-started-aspnetcore.csproj @@ -1,6 +1,5 @@ - diff --git a/docs/logs/getting-started-console/getting-started-console.csproj b/docs/logs/getting-started-console/getting-started-console.csproj index 6e8adc423c3..f68cdb2a7fe 100644 --- a/docs/logs/getting-started-console/getting-started-console.csproj +++ b/docs/logs/getting-started-console/getting-started-console.csproj @@ -1,6 +1,5 @@  - diff --git a/docs/logs/redaction/redaction.csproj b/docs/logs/redaction/redaction.csproj index db220b16f4c..2dc5d8deb63 100644 --- a/docs/logs/redaction/redaction.csproj +++ b/docs/logs/redaction/redaction.csproj @@ -4,7 +4,6 @@ disable - diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 48cad82a63c..203352a3f75 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,6 +1,8 @@ + + $(OTelLatestStableVer) $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj index a685cb78bc7..840652e39c4 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj b/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj index 268f230f60e..2881d4e4ef0 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj b/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj index 929203cbd7c..c252a0b5e26 100644 --- a/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj +++ b/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj b/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj index 9f3d57184d3..5d106120453 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj +++ b/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index d6707e69537..6b4bf62cef6 100644 --- a/src/OpenTelemetry/CHANGELOG.md +++ b/src/OpenTelemetry/CHANGELOG.md @@ -19,6 +19,11 @@ Previously it would return `null`. ([#4885](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4885)) +* Updated `Microsoft.Extensions.Logging` package version to + `8.0.0-rc.1.23419.4`. + ([#4920](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4920), + [#4933](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4933)) + ## 1.6.0 Released 2023-Sep-05 diff --git a/src/OpenTelemetry/Internal/Builder/ProviderBuilderServiceCollectionExtensions.cs b/src/OpenTelemetry/Internal/Builder/ProviderBuilderServiceCollectionExtensions.cs index 195f543d9a7..d6d7274c267 100644 --- a/src/OpenTelemetry/Internal/Builder/ProviderBuilderServiceCollectionExtensions.cs +++ b/src/OpenTelemetry/Internal/Builder/ProviderBuilderServiceCollectionExtensions.cs @@ -76,7 +76,7 @@ public static IServiceCollection AddOpenTelemetrySharedProviderBuilderServices(t // which sets default Propagators and default Activity Id format _ = Sdk.SuppressInstrumentation; - services.AddOptions(); + services!.AddOptions(); // Note: When using a host builder IConfiguration is automatically // registered and this registration will no-op. This only runs for diff --git a/src/OpenTelemetry/Internal/OpenTelemetrySdkEventSource.cs b/src/OpenTelemetry/Internal/OpenTelemetrySdkEventSource.cs index ab536f670cf..1cbba26f9f8 100644 --- a/src/OpenTelemetry/Internal/OpenTelemetrySdkEventSource.cs +++ b/src/OpenTelemetry/Internal/OpenTelemetrySdkEventSource.cs @@ -350,13 +350,13 @@ public void LoggerProcessStateSkipped(string type, string reason) #if DEBUG public class OpenTelemetryEventListener : EventListener { - private readonly List eventSources = new(); + private readonly Dictionary eventSources = new(); public override void Dispose() { - foreach (EventSource eventSource in this.eventSources) + foreach (var kvp in this.eventSources) { - this.DisableEvents(eventSource); + this.DisableEvents(kvp.Value); } base.Dispose(); @@ -367,7 +367,7 @@ protected override void OnEventSourceCreated(EventSource eventSource) { if (eventSource.Name.StartsWith("OpenTelemetry", StringComparison.OrdinalIgnoreCase)) { - this.eventSources.Add(eventSource); + this.eventSources.Add(eventSource.Name, eventSource); this.EnableEvents(eventSource, EventLevel.Verbose, EventKeywords.All); } @@ -376,6 +376,11 @@ protected override void OnEventSourceCreated(EventSource eventSource) protected override void OnEventWritten(EventWrittenEventArgs e) { + if (!this.eventSources.ContainsKey(e.EventSource.Name)) + { + return; + } + string? message; if (e.Message != null && e.Payload != null && e.Payload.Count > 0) { diff --git a/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLogger.cs b/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLogger.cs index cac01362cc1..38c189b7a87 100644 --- a/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLogger.cs +++ b/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLogger.cs @@ -128,7 +128,8 @@ public bool IsEnabled(LogLevel logLevel) return logLevel != LogLevel.None; } - public IDisposable BeginScope(TState state) => this.ScopeProvider?.Push(state) ?? NullScope.Instance; + public IDisposable BeginScope(TState state) + where TState : notnull => this.ScopeProvider?.Push(state) ?? NullScope.Instance; internal static void SetLogRecordSeverityFields(ref LogRecordData logRecordData, LogLevel logLevel) { diff --git a/src/OpenTelemetry/OpenTelemetry.csproj b/src/OpenTelemetry/OpenTelemetry.csproj index 45faafaec91..4e5488c4622 100644 --- a/src/OpenTelemetry/OpenTelemetry.csproj +++ b/src/OpenTelemetry/OpenTelemetry.csproj @@ -6,6 +6,7 @@ + diff --git a/src/Shared/Options/ConfigurationExtensions.cs b/src/Shared/Options/ConfigurationExtensions.cs index c99e5d8d7d6..0dd6cc7bff0 100644 --- a/src/Shared/Options/ConfigurationExtensions.cs +++ b/src/Shared/Options/ConfigurationExtensions.cs @@ -147,7 +147,7 @@ public static IServiceCollection RegisterOptionsFactory( Debug.Assert(services != null, "services was null"); Debug.Assert(optionsFactoryFunc != null, "optionsFactoryFunc was null"); - services.TryAddSingleton>(sp => + services!.TryAddSingleton>(sp => { return new DelegatingOptionsFactory( (c, n) => optionsFactoryFunc!(c), @@ -168,7 +168,7 @@ public static IServiceCollection RegisterOptionsFactory( Debug.Assert(services != null, "services was null"); Debug.Assert(optionsFactoryFunc != null, "optionsFactoryFunc was null"); - services.TryAddSingleton>(sp => + services!.TryAddSingleton>(sp => { return new DelegatingOptionsFactory( (c, n) => optionsFactoryFunc!(sp, c, n), diff --git a/test/Benchmarks/Benchmarks.csproj b/test/Benchmarks/Benchmarks.csproj index 92db158474b..bb1c7a8c299 100644 --- a/test/Benchmarks/Benchmarks.csproj +++ b/test/Benchmarks/Benchmarks.csproj @@ -15,7 +15,6 @@ - diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs index 184422e953e..87a70d3bfbd 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs @@ -912,7 +912,7 @@ void ConfigureTestServices(IServiceCollection services) Assert.Equal(4, numberofSubscribedEvents); } - [Fact] + [Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/4884")] public async Task DiagnosticSourceExceptionCallBackIsNotReceivedForExceptionsHandledInMiddleware() { int numberOfUnSubscribedEvents = 0; diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj index fac096659c7..f7400d295f8 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj @@ -17,11 +17,20 @@ - + + + + + + + + + + diff --git a/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj b/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj index 1944c0caf6c..5cd6fe1b30c 100644 --- a/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj @@ -14,7 +14,7 @@ - + @@ -33,12 +33,20 @@ - + + + + + + + + + diff --git a/test/OpenTelemetry.Instrumentation.Http.Tests/OpenTelemetry.Instrumentation.Http.Tests.csproj b/test/OpenTelemetry.Instrumentation.Http.Tests/OpenTelemetry.Instrumentation.Http.Tests.csproj index 069a2a64547..83396dfecb6 100644 --- a/test/OpenTelemetry.Instrumentation.Http.Tests/OpenTelemetry.Instrumentation.Http.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.Http.Tests/OpenTelemetry.Instrumentation.Http.Tests.csproj @@ -36,7 +36,14 @@ + + + + + + + diff --git a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/OpenTelemetry.Instrumentation.W3cTraceContext.Tests.csproj b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/OpenTelemetry.Instrumentation.W3cTraceContext.Tests.csproj index 7e75bd0dce8..81fa3eb1932 100644 --- a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/OpenTelemetry.Instrumentation.W3cTraceContext.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/OpenTelemetry.Instrumentation.W3cTraceContext.Tests.csproj @@ -16,10 +16,8 @@ - - diff --git a/test/OpenTelemetry.Tests.Stress.Logs/OpenTelemetry.Tests.Stress.Logs.csproj b/test/OpenTelemetry.Tests.Stress.Logs/OpenTelemetry.Tests.Stress.Logs.csproj index 7e36e10136f..04b2abe0a60 100644 --- a/test/OpenTelemetry.Tests.Stress.Logs/OpenTelemetry.Tests.Stress.Logs.csproj +++ b/test/OpenTelemetry.Tests.Stress.Logs/OpenTelemetry.Tests.Stress.Logs.csproj @@ -12,7 +12,6 @@ - diff --git a/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj b/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj index 853fe9b9b96..9b1fdad3eb2 100644 --- a/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj +++ b/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj @@ -14,7 +14,6 @@ - diff --git a/test/TestApp.AspNetCore/TestApp.AspNetCore.csproj b/test/TestApp.AspNetCore/TestApp.AspNetCore.csproj index 93c75049eda..93a3a0a972d 100644 --- a/test/TestApp.AspNetCore/TestApp.AspNetCore.csproj +++ b/test/TestApp.AspNetCore/TestApp.AspNetCore.csproj @@ -8,11 +8,12 @@ - - - - + + + + +