diff --git a/.github/workflows/ci-aot.yml b/.github/workflows/ci-aot.yml index 1d2149b7751..54c991a9215 100644 --- a/.github/workflows/ci-aot.yml +++ b/.github/workflows/ci-aot.yml @@ -25,7 +25,7 @@ jobs: fetch-depth: 0 # fetching all - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: publish AOT testApp, assert static analysis warning count, and run the app shell: pwsh diff --git a/.github/workflows/ci-concurrency.yml b/.github/workflows/ci-concurrency.yml index 82060ae39f2..2734a1df94b 100644 --- a/.github/workflows/ci-concurrency.yml +++ b/.github/workflows/ci-concurrency.yml @@ -27,7 +27,7 @@ jobs: fetch-depth: 0 # fetching all - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: Run Coyote Tests shell: pwsh diff --git a/.github/workflows/ci-instrumentation-libraries.yml b/.github/workflows/ci-instrumentation-libraries.yml index a1f195fc68a..0dcb600cfe9 100644 --- a/.github/workflows/ci-instrumentation-libraries.yml +++ b/.github/workflows/ci-instrumentation-libraries.yml @@ -29,7 +29,7 @@ jobs: fetch-depth: 0 # fetching all - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: dotnet restore run: dotnet restore ./build/InstrumentationLibraries.proj -p:RunningDotNetPack=true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3387af214c0..8b583dde64f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: fetch-depth: 0 # fetching all - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: Install dependencies run: dotnet restore @@ -56,7 +56,7 @@ jobs: fetch-depth: 0 # fetching all - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: Install dependencies run: dotnet restore diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index b4a9744c3c1..3248b94fd13 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -25,7 +25,7 @@ jobs: fetch-depth: 0 # fetching all - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: Install dependencies run: dotnet restore diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index ddc4f42fabd..47e3d0eee4e 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v4 - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: dotnet restore run: dotnet restore @@ -39,7 +39,7 @@ jobs: uses: actions/checkout@v4 - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: dotnet restore run: dotnet restore diff --git a/.github/workflows/package-validation.yml b/.github/workflows/package-validation.yml index 4df06f48b46..8a7bfcead7d 100644 --- a/.github/workflows/package-validation.yml +++ b/.github/workflows/package-validation.yml @@ -16,7 +16,7 @@ jobs: fetch-depth: 0 # fetching all - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: Pack run: dotnet pack OpenTelemetry.proj --configuration Release /p:EnablePackageValidation=true /p:ExposeExperimentalFeatures=false @@ -30,7 +30,7 @@ jobs: fetch-depth: 0 # fetching all - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: Pack run: dotnet pack OpenTelemetry.proj --configuration Release /p:EnablePackageValidation=true /p:ExposeExperimentalFeatures=true diff --git a/.github/workflows/publish-packages-1.0.yml b/.github/workflows/publish-packages-1.0.yml index dbb29902387..41cad730f48 100644 --- a/.github/workflows/publish-packages-1.0.yml +++ b/.github/workflows/publish-packages-1.0.yml @@ -24,7 +24,7 @@ jobs: ref: ${{ github.ref || 'main' }} - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 - name: dotnet restore run: dotnet restore OpenTelemetry.proj -p:RunningDotNetPack=true diff --git a/src/OpenTelemetry.Api.ProviderBuilderExtensions/AssemblyInfo.cs b/src/OpenTelemetry.Api.ProviderBuilderExtensions/AssemblyInfo.cs index 678ad1e5c91..ac99c40c8e3 100644 --- a/src/OpenTelemetry.Api.ProviderBuilderExtensions/AssemblyInfo.cs +++ b/src/OpenTelemetry.Api.ProviderBuilderExtensions/AssemblyInfo.cs @@ -29,12 +29,10 @@ file static class AssemblyInfo { public const string PublicKey = ", PublicKey=002400000480000094000000060200000024000052534131000400000100010051C1562A090FB0C9F391012A32198B5E5D9A60E9B80FA2D7B434C9E5CCB7259BD606E66F9660676AFC6692B8CDC6793D190904551D2103B7B22FA636DCBB8208839785BA402EA08FC00C8F1500CCEF28BBF599AA64FFB1E1D5DC1BF3420A3777BADFE697856E9D52070A50C3EA5821C80BEF17CA3ACFFA28F89DD413F096F898"; - public const string MoqPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"; } #else file static class AssemblyInfo { public const string PublicKey = ""; - public const string MoqPublicKey = ""; } #endif diff --git a/src/OpenTelemetry.Api/AssemblyInfo.cs b/src/OpenTelemetry.Api/AssemblyInfo.cs index 3709e7402a8..353b015fab5 100644 --- a/src/OpenTelemetry.Api/AssemblyInfo.cs +++ b/src/OpenTelemetry.Api/AssemblyInfo.cs @@ -21,7 +21,6 @@ [assembly: InternalsVisibleTo("OpenTelemetry.Api.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("OpenTelemetry.Shims.OpenTracing.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("OpenTelemetry.Tests" + AssemblyInfo.PublicKey)] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyInfo.MoqPublicKey)] #if !EXPOSE_EXPERIMENTAL_FEATURES [assembly: InternalsVisibleTo("OpenTelemetry.Api.ProviderBuilderExtensions.Tests" + AssemblyInfo.PublicKey)] @@ -37,12 +36,10 @@ file static class AssemblyInfo { public const string PublicKey = ", PublicKey=002400000480000094000000060200000024000052534131000400000100010051C1562A090FB0C9F391012A32198B5E5D9A60E9B80FA2D7B434C9E5CCB7259BD606E66F9660676AFC6692B8CDC6793D190904551D2103B7B22FA636DCBB8208839785BA402EA08FC00C8F1500CCEF28BBF599AA64FFB1E1D5DC1BF3420A3777BADFE697856E9D52070A50C3EA5821C80BEF17CA3ACFFA28F89DD413F096F898"; - public const string MoqPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"; } #else file static class AssemblyInfo { public const string PublicKey = ""; - public const string MoqPublicKey = ""; } #endif diff --git a/src/OpenTelemetry.Extensions.Hosting/AssemblyInfo.cs b/src/OpenTelemetry.Extensions.Hosting/AssemblyInfo.cs index 9c25df52d83..22263c1bb29 100644 --- a/src/OpenTelemetry.Extensions.Hosting/AssemblyInfo.cs +++ b/src/OpenTelemetry.Extensions.Hosting/AssemblyInfo.cs @@ -17,18 +17,15 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("OpenTelemetry.Extensions.Hosting.Tests" + AssemblyInfo.PublicKey)] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyInfo.MoqPublicKey)] #if SIGNED file static class AssemblyInfo { public const string PublicKey = ", PublicKey=002400000480000094000000060200000024000052534131000400000100010051C1562A090FB0C9F391012A32198B5E5D9A60E9B80FA2D7B434C9E5CCB7259BD606E66F9660676AFC6692B8CDC6793D190904551D2103B7B22FA636DCBB8208839785BA402EA08FC00C8F1500CCEF28BBF599AA64FFB1E1D5DC1BF3420A3777BADFE697856E9D52070A50C3EA5821C80BEF17CA3ACFFA28F89DD413F096F898"; - public const string MoqPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"; } #else file static class AssemblyInfo { public const string PublicKey = ""; - public const string MoqPublicKey = ""; } #endif diff --git a/test/OpenTelemetry.Api.Tests/OpenTelemetry.Api.Tests.csproj b/test/OpenTelemetry.Api.Tests/OpenTelemetry.Api.Tests.csproj index 31c6c8eb3db..b2e0fa8b6db 100644 --- a/test/OpenTelemetry.Api.Tests/OpenTelemetry.Api.Tests.csproj +++ b/test/OpenTelemetry.Api.Tests/OpenTelemetry.Api.Tests.csproj @@ -21,7 +21,6 @@ - runtime; build; native; contentfiles; analyzers diff --git a/test/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests.csproj b/test/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests.csproj index 4d01b88f6bc..e3603d4bc50 100644 --- a/test/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests.csproj +++ b/test/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests.csproj @@ -11,7 +11,6 @@ - runtime; build; native; contentfiles; analyzers diff --git a/test/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests.csproj b/test/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests.csproj index 148f6c843c7..7ab05160d72 100644 --- a/test/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests.csproj +++ b/test/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests.csproj @@ -10,7 +10,6 @@ - runtime; build; native; contentfiles; analyzers diff --git a/test/OpenTelemetry.Exporter.Zipkin.Tests/OpenTelemetry.Exporter.Zipkin.Tests.csproj b/test/OpenTelemetry.Exporter.Zipkin.Tests/OpenTelemetry.Exporter.Zipkin.Tests.csproj index 8c429974359..d277eb4d15e 100644 --- a/test/OpenTelemetry.Exporter.Zipkin.Tests/OpenTelemetry.Exporter.Zipkin.Tests.csproj +++ b/test/OpenTelemetry.Exporter.Zipkin.Tests/OpenTelemetry.Exporter.Zipkin.Tests.csproj @@ -17,7 +17,6 @@ - runtime; build; native; contentfiles; analyzers diff --git a/test/OpenTelemetry.Extensions.Hosting.Tests/OpenTelemetry.Extensions.Hosting.Tests.csproj b/test/OpenTelemetry.Extensions.Hosting.Tests/OpenTelemetry.Extensions.Hosting.Tests.csproj index e1d6d4fb496..8ae85542eba 100644 --- a/test/OpenTelemetry.Extensions.Hosting.Tests/OpenTelemetry.Extensions.Hosting.Tests.csproj +++ b/test/OpenTelemetry.Extensions.Hosting.Tests/OpenTelemetry.Extensions.Hosting.Tests.csproj @@ -36,7 +36,6 @@ - runtime; build; native; contentfiles; analyzers diff --git a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/OpenTelemetry.Instrumentation.SqlClient.Tests.csproj b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/OpenTelemetry.Instrumentation.SqlClient.Tests.csproj index b6d4f7670eb..2075d0eba89 100644 --- a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/OpenTelemetry.Instrumentation.SqlClient.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/OpenTelemetry.Instrumentation.SqlClient.Tests.csproj @@ -17,7 +17,6 @@ - diff --git a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs index 2df68ac8d31..f64dc359b92 100644 --- a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs +++ b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs @@ -19,7 +19,6 @@ using System.Data.SqlClient; using System.Diagnostics; using System.Diagnostics.Tracing; -using Moq; using OpenTelemetry.Instrumentation.SqlClient.Implementation; using OpenTelemetry.Tests; using OpenTelemetry.Trace; @@ -48,9 +47,9 @@ To use Docker... [InlineData(CommandType.StoredProcedure, "sp_who", true)] public async Task SuccessfulCommandTest(CommandType commandType, string commandText, bool captureText, bool isFailure = false) { - var activityProcessor = new Mock>(); + var exportedItems = new List(); using var shutdownSignal = Sdk.CreateTracerProviderBuilder() - .AddProcessor(activityProcessor.Object) + .AddInMemoryExporter(exportedItems) .AddSqlClientInstrumentation(options => { options.SetDbStatementForText = captureText; @@ -78,9 +77,8 @@ public async Task SuccessfulCommandTest(CommandType commandType, string commandT { } - Assert.Equal(3, activityProcessor.Invocations.Count); - - var activity = (Activity)activityProcessor.Invocations[1].Arguments[0]; + Assert.Single(exportedItems); + var activity = exportedItems[0]; VerifyActivityData(commandText, captureText, isFailure, dataSource, activity); } @@ -105,9 +103,9 @@ public void EventSourceFakeTests( { using IFakeBehavingSqlEventSource fakeSqlEventSource = (IFakeBehavingSqlEventSource)Activator.CreateInstance(eventSourceType); - var activityProcessor = new Mock>(); + var exportedItems = new List(); using var shutdownSignal = Sdk.CreateTracerProviderBuilder() - .AddProcessor(activityProcessor.Object) + .AddInMemoryExporter(exportedItems) .AddSqlClientInstrumentation(options => { options.SetDbStatementForText = captureText; @@ -132,9 +130,9 @@ public void EventSourceFakeTests( fakeSqlEventSource.WriteEndExecuteEvent(objectId, compositeState, sqlExceptionNumber); shutdownSignal.Dispose(); - Assert.Equal(5, activityProcessor.Invocations.Count); // SetTracerProvider/OnStart/OnEnd/OnShutdown/Dispose called. + Assert.Single(exportedItems); - var activity = (Activity)activityProcessor.Invocations[2].Arguments[0]; + var activity = exportedItems[0]; VerifyActivityData(commandText, captureText, isFailure, "127.0.0.1", activity, enableConnectionLevelAttributes); } @@ -146,9 +144,9 @@ public void EventSourceFakeUnknownEventWithNullPayloadTest(Type eventSourceType) { using IFakeMisbehavingSqlEventSource fakeSqlEventSource = (IFakeMisbehavingSqlEventSource)Activator.CreateInstance(eventSourceType); - var activityProcessor = new Mock>(); + var exportedItems = new List(); using var shutdownSignal = Sdk.CreateTracerProviderBuilder() - .AddProcessor(activityProcessor.Object) + .AddInMemoryExporter(exportedItems) .AddSqlClientInstrumentation() .Build(); @@ -156,7 +154,7 @@ public void EventSourceFakeUnknownEventWithNullPayloadTest(Type eventSourceType) shutdownSignal.Dispose(); - Assert.Equal(3, activityProcessor.Invocations.Count); // SetTracerProvider/OnShutdown/Dispose called. + Assert.Empty(exportedItems); } [Theory] @@ -166,9 +164,9 @@ public void EventSourceFakeInvalidPayloadTest(Type eventSourceType) { using IFakeMisbehavingSqlEventSource fakeSqlEventSource = (IFakeMisbehavingSqlEventSource)Activator.CreateInstance(eventSourceType); - var activityProcessor = new Mock>(); + var exportedItems = new List(); using var shutdownSignal = Sdk.CreateTracerProviderBuilder() - .AddProcessor(activityProcessor.Object) + .AddInMemoryExporter(exportedItems) .AddSqlClientInstrumentation() .Build(); @@ -177,7 +175,7 @@ public void EventSourceFakeInvalidPayloadTest(Type eventSourceType) fakeSqlEventSource.WriteEndExecuteEvent("arg1", "arg2", "arg3", "arg4"); shutdownSignal.Dispose(); - Assert.Equal(3, activityProcessor.Invocations.Count); // SetTracerProvider/OnShutdown/Dispose called. + Assert.Empty(exportedItems); } [Theory] @@ -187,9 +185,9 @@ public void DefaultCaptureTextFalse(Type eventSourceType) { using IFakeBehavingSqlEventSource fakeSqlEventSource = (IFakeBehavingSqlEventSource)Activator.CreateInstance(eventSourceType); - var activityProcessor = new Mock>(); + var exportedItems = new List(); using var shutdownSignal = Sdk.CreateTracerProviderBuilder() - .AddProcessor(activityProcessor.Object) + .AddInMemoryExporter(exportedItems) .AddSqlClientInstrumentation() .Build(); @@ -211,9 +209,9 @@ public void DefaultCaptureTextFalse(Type eventSourceType) fakeSqlEventSource.WriteEndExecuteEvent(objectId, compositeState, 0); shutdownSignal.Dispose(); - Assert.Equal(5, activityProcessor.Invocations.Count); // SetTracerProvider/OnStart/OnEnd/OnShutdown/Dispose called. + Assert.Single(exportedItems); - var activity = (Activity)activityProcessor.Invocations[2].Arguments[0]; + var activity = exportedItems[0]; const bool captureText = false; VerifyActivityData(commandText, captureText, false, "127.0.0.1", activity, false);