diff --git a/.github/workflows/apicompatibility.yml b/.github/workflows/apicompatibility.yml
index 1077523a668..14b382c2135 100644
--- a/.github/workflows/apicompatibility.yml
+++ b/.github/workflows/apicompatibility.yml
@@ -2,7 +2,7 @@ name: API Compatibility
on:
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
@@ -11,15 +11,10 @@ jobs:
runs-on: windows-latest
env:
CheckAPICompatibility: true
- # https://github.com/actions/setup-dotnet/issues/122
- DOTNET_MULTILEVEL_LOOKUP: 1
steps:
- uses: actions/checkout@v3
- - uses: actions/setup-dotnet@v1
with:
fetch-depth: 0 # fetching all
- dotnet-version: '7.0.x'
- include-prerelease: true
- name: Install dependencies
run: dotnet restore
diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml
index deedcf1f843..772d8e45a0b 100644
--- a/.github/workflows/code-coverage.yml
+++ b/.github/workflows/code-coverage.yml
@@ -2,11 +2,11 @@ name: Code Coverage
on:
push:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
@@ -20,17 +20,11 @@ jobs:
os: [windows-latest]
env:
OS: ${{ matrix.os }}
- # https://github.com/actions/setup-dotnet/issues/122
- DOTNET_MULTILEVEL_LOOKUP: 1
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetching all
- - uses: actions/setup-dotnet@v1
- with:
- dotnet-version: '7.0.x'
- include-prerelease: true
- name: Install dependencies
run: dotnet restore
diff --git a/.github/workflows/docfx.yml b/.github/workflows/docfx.yml
index 9de27064fe2..b183f85311c 100644
--- a/.github/workflows/docfx.yml
+++ b/.github/workflows/docfx.yml
@@ -2,9 +2,9 @@ name: docfx
on:
push:
- branches: [ main, net7.0 ]
+ branches: [ main ]
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
jobs:
build:
diff --git a/.github/workflows/dotnet-format-md.yml b/.github/workflows/dotnet-format-md.yml
index 6a093eb64a9..5453ddca941 100644
--- a/.github/workflows/dotnet-format-md.yml
+++ b/.github/workflows/dotnet-format-md.yml
@@ -9,7 +9,7 @@ name: dotnet format
on:
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths:
- '**.md'
diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml
index f88e0613d80..472fc5f6865 100644
--- a/.github/workflows/dotnet-format.yml
+++ b/.github/workflows/dotnet-format.yml
@@ -2,12 +2,12 @@ name: dotnet format
on:
push:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths:
- '**.cs'
- '.editorconfig'
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths:
- '**.cs'
- '.editorconfig'
@@ -25,12 +25,6 @@ jobs:
with:
dotnet-version: 6.0.x
- - name: Setup .NET Core 7.0
- - uses: actions/setup-dotnet@v1
- with:
- dotnet-version: '7.0.x'
- include-prerelease: true
-
- name: Install format tool
run: dotnet tool install -g dotnet-format
diff --git a/.github/workflows/integration-md.yml b/.github/workflows/integration-md.yml
index f346041b00d..aec19d81972 100644
--- a/.github/workflows/integration-md.yml
+++ b/.github/workflows/integration-md.yml
@@ -9,7 +9,7 @@ name: Integration Tests
on:
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths:
- '**.md'
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- version: [net6.0]
+ version: [netcoreapp3.1,net6.0]
steps:
- run: 'echo "No build required"'
@@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- version: [net6.0]
+ version: [netcoreapp3.1,net6.0]
steps:
- run: 'echo "No build required"'
@@ -34,6 +34,6 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- version: [net6.0]
+ version: [netcoreapp3.1,net6.0]
steps:
- run: 'echo "No build required"'
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index 052e12fffa7..b3d53770e77 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -2,11 +2,11 @@ name: Integration Tests
on:
push:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
@@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- version: [net6.0]
+ version: [netcoreapp3.1,net6.0]
steps:
- uses: actions/checkout@v3
@@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- version: [net6.0]
+ version: [netcoreapp3.1,net6.0]
steps:
- uses: actions/checkout@v3
@@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- version: [net6.0]
+ version: [netcoreapp3.1,net6.0]
steps:
- uses: actions/checkout@v3
diff --git a/.github/workflows/linux-ci-md.yml b/.github/workflows/linux-ci-md.yml
index 43975cfaf5d..cec69098ece 100644
--- a/.github/workflows/linux-ci-md.yml
+++ b/.github/workflows/linux-ci-md.yml
@@ -9,7 +9,7 @@ name: Linux
on:
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths:
- '**.md'
@@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
- version: [net6.0]
+ version: [netcoreapp3.1,net6.0]
steps:
- run: 'echo "No build required"'
diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml
index a8a9213fb36..c79296a9576 100644
--- a/.github/workflows/linux-ci.yml
+++ b/.github/workflows/linux-ci.yml
@@ -2,11 +2,11 @@ name: Linux
on:
push:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
@@ -16,23 +16,13 @@ jobs:
strategy:
matrix:
- version: [net6.0, net7.0]
+ version: [netcoreapp3.1,net6.0]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetching all
- - uses: actions/setup-dotnet@v1
- with:
- dotnet-version: '6.0.x'
-
- - uses: actions/setup-dotnet@v1
- with:
- dotnet-version: '7.0.x'
- include-prerelease: true
-
-
- name: Install dependencies
run: dotnet restore
diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml
index 1fbb52e9f99..97f85f9e2b4 100644
--- a/.github/workflows/markdownlint.yml
+++ b/.github/workflows/markdownlint.yml
@@ -2,11 +2,11 @@ name: markdownlint
on:
push:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths:
- '**.md'
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths:
- '**.md'
diff --git a/.github/workflows/sanitycheck.yml b/.github/workflows/sanitycheck.yml
index ef2e5cd140b..a52563198e4 100644
--- a/.github/workflows/sanitycheck.yml
+++ b/.github/workflows/sanitycheck.yml
@@ -2,9 +2,9 @@ name: sanitycheck
on:
push:
- branches: [ main, net7.0 ]
+ branches: [ main ]
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
jobs:
misspell:
diff --git a/.github/workflows/windows-ci-md.yml b/.github/workflows/windows-ci-md.yml
index 1b409793afc..2e2bfd561a4 100644
--- a/.github/workflows/windows-ci-md.yml
+++ b/.github/workflows/windows-ci-md.yml
@@ -9,7 +9,7 @@ name: Windows
on:
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths:
- '**.md'
@@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
- version: [net462,net6.0]
+ version: [net462,netcoreapp3.1,net6.0]
steps:
- run: 'echo "No build required"'
diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml
index 72729d83af4..4a48a7e5b19 100644
--- a/.github/workflows/windows-ci.yml
+++ b/.github/workflows/windows-ci.yml
@@ -2,35 +2,27 @@ name: Windows
on:
push:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
pull_request:
- branches: [ main, net7.0 ]
+ branches: [ main ]
paths-ignore:
- '**.md'
jobs:
build-test:
runs-on: windows-latest
- env:
- # https://github.com/actions/setup-dotnet/issues/122
- DOTNET_MULTILEVEL_LOOKUP: 1
strategy:
matrix:
- version: [net462,net6.0,net7.0]
+ version: [net462,netcoreapp3.1,net6.0]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetching all
- - uses: actions/setup-dotnet@v1
- with:
- dotnet-version: '7.0.x'
- include-prerelease: true
-
- name: Install dependencies
run: dotnet restore
diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln
index 4430f261cf2..a16555d39ce 100644
--- a/OpenTelemetry.sln
+++ b/OpenTelemetry.sln
@@ -51,6 +51,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentati
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testdata", "testdata", "{77C7929A-2EED-4AA6-8705-B5C443C8AA0F}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.AspNetCore.3.1", "test\TestApp.AspNetCore.3.1\TestApp.AspNetCore.3.1.csproj", "{F2F81E76-6A0E-466B-B673-EBBF1A9ED075}"
+EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{E359BB2B-9AEC-497D-B321-7DF2450C3B8E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Jaeger", "src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj", "{8D47E3CF-9AE3-42FE-9084-FEB72D9AD769}"
@@ -271,6 +273,10 @@ Global
{2A47F6A8-63E5-4237-8046-94CAF321E797}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A47F6A8-63E5-4237-8046-94CAF321E797}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A47F6A8-63E5-4237-8046-94CAF321E797}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075}.Release|Any CPU.Build.0 = Release|Any CPU
{8D47E3CF-9AE3-42FE-9084-FEB72D9AD769}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D47E3CF-9AE3-42FE-9084-FEB72D9AD769}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D47E3CF-9AE3-42FE-9084-FEB72D9AD769}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -504,6 +510,7 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
+ {F2F81E76-6A0E-466B-B673-EBBF1A9ED075} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F}
{A533C800-3DC3-4D04-90A7-0CE7A1E6BDB3} = {F1D0972B-38CF-49C2-9F4B-4C5DE02FB71D}
{E69578EB-B456-4062-A645-877CD964528B} = {F1D0972B-38CF-49C2-9F4B-4C5DE02FB71D}
{C1542297-8763-4DF4-957C-489ED771C21D} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD}
diff --git a/build/Common.props b/build/Common.props
index 46569eea8fe..510b4ab356f 100644
--- a/build/Common.props
+++ b/build/Common.props
@@ -43,7 +43,7 @@
[2.8.0,3.0)
[1.2.0-beta.354,2.0)
1.4.0
- 7.0.0-preview.4.22229.4
+ 6.0.0
4.7.0
4.7.0
4.5.3
diff --git a/docs/Directory.Build.props b/docs/Directory.Build.props
index 9d8626a31cc..66de939828d 100644
--- a/docs/Directory.Build.props
+++ b/docs/Directory.Build.props
@@ -5,7 +5,7 @@
Exe
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462;net47;net471;net472;net48
diff --git a/global.json b/global.json
index 31ef0653858..69fd3584271 100644
--- a/global.json
+++ b/global.json
@@ -1,7 +1,6 @@
{
"sdk": {
"rollForward": "latestFeature",
- "version": "6.0.100",
- "allowPrerelease": "true"
+ "version": "6.0.100"
}
}
diff --git a/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/net6.0/PublicAPI.Shipped.txt b/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/netcoreapp3.1/PublicAPI.Shipped.txt
similarity index 100%
rename from src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/net6.0/PublicAPI.Shipped.txt
rename to src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/netcoreapp3.1/PublicAPI.Shipped.txt
diff --git a/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/net6.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/netcoreapp3.1/PublicAPI.Unshipped.txt
similarity index 100%
rename from src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/net6.0/PublicAPI.Unshipped.txt
rename to src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/netcoreapp3.1/PublicAPI.Unshipped.txt
diff --git a/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/OpenTelemetry.Exporter.Prometheus.AspNetCore.csproj b/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/OpenTelemetry.Exporter.Prometheus.AspNetCore.csproj
index 6fcd3effcf7..27c0377af01 100644
--- a/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/OpenTelemetry.Exporter.Prometheus.AspNetCore.csproj
+++ b/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/OpenTelemetry.Exporter.Prometheus.AspNetCore.csproj
@@ -2,7 +2,7 @@
- net6.0
+ netcoreapp3.1
ASP.NET Core middleware for hosting OpenTelemetry .NET Prometheus Exporter
$(PackageTags);prometheus;metrics
core-
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/net7.0/PublicAPI.Shipped.txt b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/net7.0/PublicAPI.Shipped.txt
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/net7.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/net7.0/PublicAPI.Unshipped.txt
deleted file mode 100644
index 87d29939cca..00000000000
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/.publicApi/net7.0/PublicAPI.Unshipped.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.AspNetCoreInstrumentationOptions() -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnableGrpcAspNetCoreSupport.get -> bool
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.EnableGrpcAspNetCoreSupport.set -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.Enrich.get -> System.Action
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.Enrich.set -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.Filter.get -> System.Func
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.Filter.set -> void
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.RecordException.get -> bool
-OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreInstrumentationOptions.RecordException.set -> void
-OpenTelemetry.Metrics.MeterProviderBuilderExtensions
-OpenTelemetry.Trace.TracerProviderBuilderExtensions
-static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
-static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddAspNetCoreInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configureAspNetCoreInstrumentationOptions = null) -> OpenTelemetry.Trace.TracerProviderBuilder
\ No newline at end of file
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
index 75ada899103..a37863ad8b9 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInListener.cs
@@ -35,10 +35,6 @@ namespace OpenTelemetry.Instrumentation.AspNetCore.Implementation
internal class HttpInListener : ListenerHandler
{
internal const string ActivityOperationName = "Microsoft.AspNetCore.Hosting.HttpRequestIn";
-#if NET7_0_OR_GREATER
- // https://github.com/dotnet/aspnetcore/blob/8d6554e655b64da75b71e0e20d6db54a3ba8d2fb/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs#L85
- internal static readonly string AspNetCoreActivitySourceName = "Microsoft.AspNetCore";
-#endif
internal static readonly AssemblyName AssemblyName = typeof(HttpInListener).Assembly.GetName();
internal static readonly string ActivitySourceName = AssemblyName.Name;
internal static readonly Version Version = AssemblyName.Version;
@@ -100,14 +96,8 @@ public override void OnStartActivity(Activity activity, object payload)
// Create a new activity with its parent set from the extracted context.
// This makes the new activity as a "sibling" of the activity created by
// Asp.Net Core.
-#if NET7_0_OR_GREATER
- // For NET7.0 onwards activity is created using ActivitySource so,
- // we will use the source of the activity to create the new one.
- Activity newOne = activity.Source.CreateActivity(ActivityOperationName, ActivityKind.Server, ctx.ActivityContext);
-#else
Activity newOne = new Activity(ActivityOperationName);
newOne.SetParentId(ctx.ActivityContext.TraceId, ctx.ActivityContext.SpanId, ctx.ActivityContext.TraceFlags);
-#endif
newOne.TraceStateString = ctx.ActivityContext.TraceState;
newOne.SetTag("IsCreatedByInstrumentation", bool.TrueString);
@@ -145,10 +135,8 @@ public override void OnStartActivity(Activity activity, object payload)
return;
}
-#if !NET7_0_OR_GREATER
ActivityInstrumentationHelper.SetActivitySourceProperty(activity, ActivitySource);
ActivityInstrumentationHelper.SetKindProperty(activity, ActivityKind.Server);
-#endif
var path = (request.PathBase.HasValue || request.Path.HasValue) ? (request.PathBase + request.Path).ToString() : "/";
activity.DisplayName = path;
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
index 39a74753890..82732cdb581 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
@@ -1,7 +1,7 @@
- net7.0;net6.0;netstandard2.1;netstandard2.0
+ net6.0;netcoreapp3.1;netstandard2.1;netstandard2.0
ASP.NET Core instrumentation for OpenTelemetry .NET
$(PackageTags);distributed-tracing;AspNetCore
true
@@ -28,11 +28,12 @@
-
+
+
-
+
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs
index 2e2e4dfc253..8ff58d22c73 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/TracerProviderBuilderExtensions.cs
@@ -15,10 +15,6 @@
//
using System;
-#if NET7_0_OR_GREATER
-using System.Diagnostics;
-using Microsoft.Extensions.DependencyInjection;
-#endif
using OpenTelemetry.Instrumentation.AspNetCore;
using OpenTelemetry.Instrumentation.AspNetCore.Implementation;
using OpenTelemetry.Internal;
@@ -46,7 +42,7 @@ public static TracerProviderBuilder AddAspNetCoreInstrumentation(
{
return deferredTracerProviderBuilder.Configure((sp, builder) =>
{
- AddAspNetCoreInstrumentation(builder, sp.GetOptions(), configureAspNetCoreInstrumentationOptions, sp);
+ AddAspNetCoreInstrumentation(builder, sp.GetOptions(), configureAspNetCoreInstrumentationOptions);
});
}
@@ -55,44 +51,22 @@ public static TracerProviderBuilder AddAspNetCoreInstrumentation(
internal static TracerProviderBuilder AddAspNetCoreInstrumentation(
this TracerProviderBuilder builder,
- AspNetCoreInstrumentation instrumentation,
- IServiceProvider serviceProvider = null)
+ AspNetCoreInstrumentation instrumentation)
{
- // For .NET7.0 onwards activity will be created using activitySource.
- // https://github.com/dotnet/aspnetcore/blob/bf3352f2422bf16fa3ca49021f0e31961ce525eb/src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs#L327
- // For .NET6.0 and below, we will continue to use legacy way.
-#if NET7_0_OR_GREATER
- // TODO: Check with .NET team to see if this can be prevented
- // as this allows user to override the ActivitySource.
- var activitySourceService = serviceProvider?.GetService();
- if (activitySourceService != null)
- {
- builder.AddSource(activitySourceService.Name);
- }
- else
- {
- // For users not using hosting package?
- builder.AddSource(HttpInListener.AspNetCoreActivitySourceName);
- }
-#else
builder.AddSource(HttpInListener.ActivitySourceName);
builder.AddLegacySource(HttpInListener.ActivityOperationName); // for the activities created by AspNetCore
-#endif
-
return builder.AddInstrumentation(() => instrumentation);
}
private static TracerProviderBuilder AddAspNetCoreInstrumentation(
TracerProviderBuilder builder,
AspNetCoreInstrumentationOptions options,
- Action configure = null,
- IServiceProvider serviceProvider = null)
+ Action configure = null)
{
configure?.Invoke(options);
return AddAspNetCoreInstrumentation(
builder,
- new AspNetCoreInstrumentation(new HttpInListener(options)),
- serviceProvider);
+ new AspNetCoreInstrumentation(new HttpInListener(options)));
}
}
}
diff --git a/src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentation.cs b/src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentation.cs
index 09fc1f3c0ae..3eff73b71e5 100644
--- a/src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentation.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentation.cs
@@ -25,30 +25,13 @@ internal class HttpClientInstrumentation : IDisposable
{
private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber;
- private readonly Func isEnabled = (activityName, obj1, obj2)
- => !activityName.Equals("System.Net.Http.HttpRequestOut");
-
///
/// Initializes a new instance of the class.
///
/// Configuration options for HTTP client instrumentation.
public HttpClientInstrumentation(HttpClientInstrumentationOptions options)
{
- // For .NET7.0 activity will be created using activitySource.
- // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Net.Http/src/System/Net/Http/DiagnosticsHandler.cs
- // However, in case when activity creation returns null (due to sampling)
- // the framework will fall back to creating activity anyways due to active diagnostic source listener
- // To prevent this, isEnabled is implemented which will return false always
- // so that the sampler's decision is respected.
- if (HttpHandlerDiagnosticListener.IsNet7OrGreater)
- {
- this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new HttpHandlerDiagnosticListener(options), this.isEnabled);
- }
- else
- {
- this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new HttpHandlerDiagnosticListener(options), null);
- }
-
+ this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new HttpHandlerDiagnosticListener(options), null);
this.diagnosticSourceSubscriber.Subscribe();
}
diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs
index 9f42f7a5440..549537080f9 100644
--- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs
@@ -28,10 +28,6 @@ namespace OpenTelemetry.Instrumentation.Http.Implementation
internal sealed class HttpHandlerDiagnosticListener : ListenerHandler
{
internal static readonly AssemblyName AssemblyName = typeof(HttpHandlerDiagnosticListener).Assembly.GetName();
- internal static readonly bool IsNet7OrGreater;
-
- // https://github.com/dotnet/runtime/blob/7d034ddbbbe1f2f40c264b323b3ed3d6b3d45e9a/src/libraries/System.Net.Http/src/System/Net/Http/DiagnosticsHandler.cs#L19
- internal static readonly string HttpClientActivitySourceName = "System.Net.Http";
internal static readonly string ActivitySourceName = AssemblyName.Name;
internal static readonly Version Version = AssemblyName.Version;
internal static readonly ActivitySource ActivitySource = new(ActivitySourceName, Version.ToString());
@@ -44,18 +40,6 @@ internal sealed class HttpHandlerDiagnosticListener : ListenerHandler
private readonly PropertyFetcher stopRequestStatusFetcher = new("RequestTaskStatus");
private readonly HttpClientInstrumentationOptions options;
- static HttpHandlerDiagnosticListener()
- {
- try
- {
- IsNet7OrGreater = typeof(HttpClient).Assembly.GetName().Version.Major >= 7;
- }
- catch (Exception)
- {
- IsNet7OrGreater = false;
- }
- }
-
public HttpHandlerDiagnosticListener(HttpClientInstrumentationOptions options)
: base("HttpHandlerDiagnosticListener")
{
@@ -74,11 +58,7 @@ public override void OnStartActivity(Activity activity, object payload)
// By this time, samplers have already run and
// activity.IsAllDataRequested populated accordingly.
- // For .NET7.0 or higher versions, activity is created using activity source
- // However, the framework will fallback to creating activity if the sampler's decision is to drop and there is a active diagnostic listener.
- // To prevent processing such activities we first check the source name to confirm if it was created using
- // activity source or not.
- if (Sdk.SuppressInstrumentation || (IsNet7OrGreater && string.IsNullOrEmpty(activity.Source.Name)))
+ if (Sdk.SuppressInstrumentation)
{
return;
}
@@ -128,11 +108,8 @@ public override void OnStartActivity(Activity activity, object payload)
activity.DisplayName = HttpTagHelper.GetOperationNameForHttpMethod(request.Method);
- if (!IsNet7OrGreater)
- {
- ActivityInstrumentationHelper.SetActivitySourceProperty(activity, ActivitySource);
- ActivityInstrumentationHelper.SetKindProperty(activity, ActivityKind.Client);
- }
+ ActivityInstrumentationHelper.SetActivitySourceProperty(activity, ActivitySource);
+ ActivityInstrumentationHelper.SetKindProperty(activity, ActivityKind.Client);
activity.SetTag(SemanticConventions.AttributeHttpScheme, request.RequestUri.Scheme);
activity.SetTag(SemanticConventions.AttributeHttpMethod, HttpTagHelper.GetNameForHttpMethod(request.Method));
@@ -153,15 +130,6 @@ public override void OnStartActivity(Activity activity, object payload)
public override void OnStopActivity(Activity activity, object payload)
{
- // For .NET7.0 or higher versions, activity is created using activity source
- // However, the framework will fallback to creating activity if the sampler's decision is to drop and there is a active diagnostic listener.
- // To prevent processing such activities we first check the source name to confirm if it was created using
- // activity source or not.
- if (IsNet7OrGreater && string.IsNullOrEmpty(activity.Source.Name))
- {
- return;
- }
-
if (activity.IsAllDataRequested)
{
// https://github.com/dotnet/runtime/blob/master/src/libraries/System.Net.Http/src/System/Net/Http/DiagnosticsHandler.cs
@@ -211,15 +179,6 @@ public override void OnStopActivity(Activity activity, object payload)
public override void OnException(Activity activity, object payload)
{
- // For .NET7.0 or higher versions, activity is created using activity source
- // However, the framework will fallback to creating activity if the sampler's decision is to drop and there is a active diagnostic listener.
- // To prevent processing such activities we first check the source name to confirm if it was created using
- // activity source or not.
- if (IsNet7OrGreater && string.IsNullOrEmpty(activity.Source.Name))
- {
- return;
- }
-
if (activity.IsAllDataRequested)
{
if (!this.stopExceptionFetcher.TryFetch(payload, out Exception exc) || exc == null)
diff --git a/src/OpenTelemetry.Instrumentation.Http/TracerProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.Http/TracerProviderBuilderExtensions.cs
index a71912a99ae..78461551aeb 100644
--- a/src/OpenTelemetry.Instrumentation.Http/TracerProviderBuilderExtensions.cs
+++ b/src/OpenTelemetry.Instrumentation.Http/TracerProviderBuilderExtensions.cs
@@ -78,16 +78,8 @@ internal static TracerProviderBuilder AddHttpClientInstrumentation(
this TracerProviderBuilder builder,
HttpClientInstrumentation instrumentation)
{
- if (HttpHandlerDiagnosticListener.IsNet7OrGreater)
- {
- builder.AddSource(HttpHandlerDiagnosticListener.HttpClientActivitySourceName);
- }
- else
- {
- builder.AddSource(HttpHandlerDiagnosticListener.ActivitySourceName);
- builder.AddLegacySource("System.Net.Http.HttpRequestOut");
- }
-
+ builder.AddSource(HttpHandlerDiagnosticListener.ActivitySourceName);
+ builder.AddLegacySource("System.Net.Http.HttpRequestOut");
return builder.AddInstrumentation(() => instrumentation);
}
diff --git a/test/Benchmarks/Benchmarks.csproj b/test/Benchmarks/Benchmarks.csproj
index 6cb7f6277f2..20ee4fb7456 100644
--- a/test/Benchmarks/Benchmarks.csproj
+++ b/test/Benchmarks/Benchmarks.csproj
@@ -3,7 +3,7 @@
Exe
- net6.0;net462
+ net6.0;netcoreapp3.1;net462
diff --git a/test/OpenTelemetry.Exporter.Jaeger.Tests/OpenTelemetry.Exporter.Jaeger.Tests.csproj b/test/OpenTelemetry.Exporter.Jaeger.Tests/OpenTelemetry.Exporter.Jaeger.Tests.csproj
index 5531e9421a6..ae59a07b7cc 100644
--- a/test/OpenTelemetry.Exporter.Jaeger.Tests/OpenTelemetry.Exporter.Jaeger.Tests.csproj
+++ b/test/OpenTelemetry.Exporter.Jaeger.Tests/OpenTelemetry.Exporter.Jaeger.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for Jaeger Exporter for OpenTelemetry
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj
index 3bc3fee04b1..271f7649e84 100644
--- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj
+++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj
@@ -2,7 +2,7 @@
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
$(TARGET_FRAMEWORK)
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 bf33cabbc40..d0940145313 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
@@ -2,7 +2,7 @@
Unit test project for Prometheus Exporter AspNetCore for OpenTelemetry
- net6.0
+ netcoreapp3.1
false
@@ -24,8 +24,8 @@
-
-
+
+
diff --git a/test/OpenTelemetry.Exporter.ZPages.Tests/OpenTelemetry.Exporter.ZPages.Tests.csproj b/test/OpenTelemetry.Exporter.ZPages.Tests/OpenTelemetry.Exporter.ZPages.Tests.csproj
index dca1ff0d21e..a99f6d789dd 100644
--- a/test/OpenTelemetry.Exporter.ZPages.Tests/OpenTelemetry.Exporter.ZPages.Tests.csproj
+++ b/test/OpenTelemetry.Exporter.ZPages.Tests/OpenTelemetry.Exporter.ZPages.Tests.csproj
@@ -2,7 +2,7 @@
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
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 7649dc09d3c..eb61dda0a1c 100644
--- a/test/OpenTelemetry.Exporter.Zipkin.Tests/OpenTelemetry.Exporter.Zipkin.Tests.csproj
+++ b/test/OpenTelemetry.Exporter.Zipkin.Tests/OpenTelemetry.Exporter.Zipkin.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for Zipkin Exporter for OpenTelemetry
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
diff --git a/test/OpenTelemetry.Extensions.EventSource.Tests/OpenTelemetry.Extensions.EventSource.Tests.csproj b/test/OpenTelemetry.Extensions.EventSource.Tests/OpenTelemetry.Extensions.EventSource.Tests.csproj
index 855502dd5b3..72af555428c 100644
--- a/test/OpenTelemetry.Extensions.EventSource.Tests/OpenTelemetry.Extensions.EventSource.Tests.csproj
+++ b/test/OpenTelemetry.Extensions.EventSource.Tests/OpenTelemetry.Extensions.EventSource.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry EventSource extensions
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
enable
AllEnabledByDefault
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 c56dfc18e8f..44bfda2ee95 100644
--- a/test/OpenTelemetry.Extensions.Hosting.Tests/OpenTelemetry.Extensions.Hosting.Tests.csproj
+++ b/test/OpenTelemetry.Extensions.Hosting.Tests/OpenTelemetry.Extensions.Hosting.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry .NET Core hosting library
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
diff --git a/test/OpenTelemetry.Extensions.Propagators.Tests/OpenTelemetry.Extensions.Propagators.Tests.csproj b/test/OpenTelemetry.Extensions.Propagators.Tests/OpenTelemetry.Extensions.Propagators.Tests.csproj
index 485184b256a..9186da7a943 100644
--- a/test/OpenTelemetry.Extensions.Propagators.Tests/OpenTelemetry.Extensions.Propagators.Tests.csproj
+++ b/test/OpenTelemetry.Extensions.Propagators.Tests/OpenTelemetry.Extensions.Propagators.Tests.csproj
@@ -2,7 +2,7 @@
- net6.0;net462
+ net6.0;netcoreapp3.1;net462
$(TARGET_FRAMEWORK)
diff --git a/test/OpenTelemetry.Extensions.Serilog.Tests/OpenTelemetry.Extensions.Serilog.Tests.csproj b/test/OpenTelemetry.Extensions.Serilog.Tests/OpenTelemetry.Extensions.Serilog.Tests.csproj
index daa1bc3dfeb..2a5954ade3e 100644
--- a/test/OpenTelemetry.Extensions.Serilog.Tests/OpenTelemetry.Extensions.Serilog.Tests.csproj
+++ b/test/OpenTelemetry.Extensions.Serilog.Tests/OpenTelemetry.Extensions.Serilog.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry Serilog extensions
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
enable
AllEnabledByDefault
diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs
index 3ec92d2ce08..f7eaf9bd213 100644
--- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs
+++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/BasicTests.cs
@@ -38,9 +38,6 @@
#if NET6_0
using TestApp.AspNetCore._6._0;
#endif
-#if NET7_0
-using TestApp.AspNetCore._7._0;
-#endif
using Xunit;
namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
@@ -348,7 +345,7 @@ public async Task ExtractContextIrrespectiveOfSamplingDecision(SamplingDecision
var expectedTraceId = ActivityTraceId.CreateRandom();
var expectedParentSpanId = ActivitySpanId.CreateRandom();
var expectedTraceState = "rojo=1,congo=2";
- var activityContext = new ActivityContext(expectedTraceId, expectedParentSpanId, ActivityTraceFlags.Recorded, expectedTraceState, true);
+ var activityContext = new ActivityContext(expectedTraceId, expectedParentSpanId, ActivityTraceFlags.Recorded, expectedTraceState);
var expectedBaggage = Baggage.SetBaggage("key1", "value1").SetBaggage("key2", "value2");
Sdk.SetDefaultTextMapPropagator(new ExtractOnlyPropagator(activityContext, expectedBaggage));
@@ -586,47 +583,6 @@ public async Task ActivitiesStartedInMiddlewareShouldNotBeUpdatedByInstrumentati
Assert.Equal(activityName, middlewareActivity.DisplayName);
}
-#if NET7_0_OR_GREATER
- [Fact]
- public async Task UserRegisteredActivitySourceIsUsedForActivityCreationByAspNetCore()
- {
- var exportedItems = new List();
- void ConfigureTestServices(IServiceCollection services)
- {
- services.AddOpenTelemetryTracing(options =>
- {
- options.AddAspNetCoreInstrumentation()
- .AddInMemoryExporter(exportedItems);
- });
-
- // Register ActivitySource here so that it will be used
- // by ASP.NET Core to create activities
- // https://github.com/dotnet/aspnetcore/blob/0e5cbf447d329a1e7d69932c3decd1c70a00fbba/src/Hosting/Hosting/src/Internal/WebHost.cs#L152
- services.AddSingleton(sp => new ActivitySource("UserRegisteredActivitySource"));
- }
-
- // Arrange
- using (var client = this.factory
- .WithWebHostBuilder(builder =>
- builder.ConfigureTestServices(ConfigureTestServices))
- .CreateClient())
- {
- // Act
- var response = await client.GetAsync("/api/values");
-
- // Assert
- response.EnsureSuccessStatusCode(); // Status Code 200-299
-
- WaitForActivityExport(exportedItems, 1);
- }
-
- Assert.Single(exportedItems);
- var activity = exportedItems[0];
-
- Assert.Equal("UserRegisteredActivitySource", activity.Source.Name);
- }
-#endif
-
public void Dispose()
{
this.tracerProvider?.Dispose();
@@ -649,13 +605,8 @@ private static void WaitForActivityExport(List exportedItems, int coun
private static void ValidateAspNetCoreActivity(Activity activityToValidate, string expectedHttpPath)
{
Assert.Equal(ActivityKind.Server, activityToValidate.Kind);
-#if NET7_0_OR_GREATER
- Assert.Equal(HttpInListener.AspNetCoreActivitySourceName, activityToValidate.Source.Name);
- Assert.Empty(activityToValidate.Source.Version);
-#else
Assert.Equal(HttpInListener.ActivitySourceName, activityToValidate.Source.Name);
Assert.Equal(HttpInListener.Version.ToString(), activityToValidate.Source.Version);
-#endif
Assert.Equal(expectedHttpPath, activityToValidate.GetTagValue(SemanticConventions.AttributeHttpTarget) as string);
}
diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/DependencyInjectionConfigTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/DependencyInjectionConfigTests.cs
index eabe0e600f8..7706854e730 100644
--- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/DependencyInjectionConfigTests.cs
+++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/DependencyInjectionConfigTests.cs
@@ -24,9 +24,6 @@
#if NET6_0
using TestApp.AspNetCore._6._0;
#endif
-#if NET7_0
-using TestApp.AspNetCore._7._0;
-#endif
using Xunit;
namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs
index 80f09a9a972..156a2be27d1 100644
--- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs
+++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/IncomingRequestsCollectionsIsAccordingToTheSpecTests.cs
@@ -31,9 +31,6 @@
#if NET6_0
using TestApp.AspNetCore._6._0;
#endif
-#if NET7_0
-using TestApp.AspNetCore._7._0;
-#endif
using Xunit;
namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs
index 4d93ba9a7b5..53bac48facc 100644
--- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs
+++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs
@@ -27,9 +27,6 @@
#if NET6_0
using TestApp.AspNetCore._6._0;
#endif
-#if NET7_0
-using TestApp.AspNetCore._7._0;
-#endif
using Xunit;
namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
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 9d76e241ab3..003cf214a9e 100644
--- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj
+++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/OpenTelemetry.Instrumentation.AspNetCore.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry ASP.NET Core instrumentation
- net7.0;net6.0
+ net6.0;netcoreapp3.1
@@ -27,11 +27,6 @@
-
-
-
-
-
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 f780997f340..119c38e2887 100644
--- a/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj
+++ b/test/OpenTelemetry.Instrumentation.Grpc.Tests/OpenTelemetry.Instrumentation.Grpc.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry Grpc for .NET instrumentation
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
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 c6636eae611..35f23f1ba4b 100644
--- a/test/OpenTelemetry.Instrumentation.Http.Tests/OpenTelemetry.Instrumentation.Http.Tests.csproj
+++ b/test/OpenTelemetry.Instrumentation.Http.Tests/OpenTelemetry.Instrumentation.Http.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry HTTP instrumentations
- net7.0;net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
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 7f3f224f3ef..8a9353c97c4 100644
--- a/test/OpenTelemetry.Instrumentation.SqlClient.Tests/OpenTelemetry.Instrumentation.SqlClient.Tests.csproj
+++ b/test/OpenTelemetry.Instrumentation.SqlClient.Tests/OpenTelemetry.Instrumentation.SqlClient.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry SqlClient instrumentations
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
$(TARGET_FRAMEWORK)
diff --git a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile
index 5698ff7556a..cacdd48cc03 100644
--- a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile
+++ b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile
@@ -2,16 +2,16 @@
# This should be run from the root of the repo:
# docker build --file test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile .
-ARG SDK_VERSION=7.0
+ARG SDK_VERSION=6.0
FROM ubuntu AS w3c
#Install git
WORKDIR /w3c
RUN apt-get update && apt-get install -y git
RUN git clone https://github.com/w3c/trace-context.git
-FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
ARG PUBLISH_CONFIGURATION=Release
-ARG PUBLISH_FRAMEWORK=net7.0
+ARG PUBLISH_FRAMEWORK=net6.0
WORKDIR /repo
COPY . ./
WORKDIR "/repo/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests"
diff --git a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/InProcessServer.cs b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/InProcessServer.cs
index 31010ff2f9c..708bab2cdd0 100644
--- a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/InProcessServer.cs
+++ b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/InProcessServer.cs
@@ -26,9 +26,6 @@
#if NET6_0
using TestApp.AspNetCore._6._0;
#endif
-#if NET7_0
-using TestApp.AspNetCore._7._0;
-#endif
using Xunit.Abstractions;
namespace OpenTelemetry.Instrumentation.W3cTraceContext.Tests
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 7fdd6109d44..de4eeeff83e 100644
--- a/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/OpenTelemetry.Instrumentation.W3cTraceContext.Tests.csproj
+++ b/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/OpenTelemetry.Instrumentation.W3cTraceContext.Tests.csproj
@@ -3,7 +3,7 @@
Unit test project for OpenTelemetry ASP.NET Core instrumentation for W3C Trace Context Trace
- net7.0;net6.0
+ net6.0;netcoreapp3.1
$(TARGET_FRAMEWORK)
@@ -33,8 +33,8 @@
-
-
+
+
diff --git a/test/OpenTelemetry.Shims.OpenTracing.Tests/OpenTelemetry.Shims.OpenTracing.Tests.csproj b/test/OpenTelemetry.Shims.OpenTracing.Tests/OpenTelemetry.Shims.OpenTracing.Tests.csproj
index 3367474dbf4..478fc22c730 100644
--- a/test/OpenTelemetry.Shims.OpenTracing.Tests/OpenTelemetry.Shims.OpenTracing.Tests.csproj
+++ b/test/OpenTelemetry.Shims.OpenTracing.Tests/OpenTelemetry.Shims.OpenTracing.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry.Shims.OpenTracing
- net6.0
+ net6.0;netcoreapp3.1
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 b586488162c..45c21139ba3 100644
--- a/test/OpenTelemetry.Tests.Stress.Logs/OpenTelemetry.Tests.Stress.Logs.csproj
+++ b/test/OpenTelemetry.Tests.Stress.Logs/OpenTelemetry.Tests.Stress.Logs.csproj
@@ -3,7 +3,7 @@
Exe
- net6.0;net462
+ net6.0;netcoreapp3.1;net462
diff --git a/test/OpenTelemetry.Tests.Stress.Metrics/OpenTelemetry.Tests.Stress.Metrics.csproj b/test/OpenTelemetry.Tests.Stress.Metrics/OpenTelemetry.Tests.Stress.Metrics.csproj
index 71e5735570e..49134943927 100644
--- a/test/OpenTelemetry.Tests.Stress.Metrics/OpenTelemetry.Tests.Stress.Metrics.csproj
+++ b/test/OpenTelemetry.Tests.Stress.Metrics/OpenTelemetry.Tests.Stress.Metrics.csproj
@@ -3,7 +3,7 @@
Exe
- net6.0;net462
+ net6.0;netcoreapp3.1;net462
diff --git a/test/OpenTelemetry.Tests.Stress/OpenTelemetry.Tests.Stress.csproj b/test/OpenTelemetry.Tests.Stress/OpenTelemetry.Tests.Stress.csproj
index 1c06ae6076c..73b65c17227 100644
--- a/test/OpenTelemetry.Tests.Stress/OpenTelemetry.Tests.Stress.csproj
+++ b/test/OpenTelemetry.Tests.Stress/OpenTelemetry.Tests.Stress.csproj
@@ -2,7 +2,7 @@
Exe
- net6.0;net462
+ net6.0;netcoreapp3.1;net462
diff --git a/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj b/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj
index 199db4b6e4b..8d1c69f4f50 100644
--- a/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj
+++ b/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj
@@ -2,7 +2,7 @@
Unit test project for OpenTelemetry
- net6.0
+ net6.0;netcoreapp3.1
$(TargetFrameworks);net462
$(NoWarn),CS0618
diff --git a/test/TestApp.AspNetCore.7.0/ActivityMiddleware.cs b/test/TestApp.AspNetCore.3.1/ActivityMiddleware.cs
similarity index 98%
rename from test/TestApp.AspNetCore.7.0/ActivityMiddleware.cs
rename to test/TestApp.AspNetCore.3.1/ActivityMiddleware.cs
index 70a28e214bc..44c1eff7d14 100644
--- a/test/TestApp.AspNetCore.7.0/ActivityMiddleware.cs
+++ b/test/TestApp.AspNetCore.3.1/ActivityMiddleware.cs
@@ -17,7 +17,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-namespace TestApp.AspNetCore._7._0
+namespace TestApp.AspNetCore._3._1
{
public class ActivityMiddleware
{
diff --git a/test/TestApp.AspNetCore.7.0/AssemblyInfo.cs b/test/TestApp.AspNetCore.3.1/AssemblyInfo.cs
similarity index 95%
rename from test/TestApp.AspNetCore.7.0/AssemblyInfo.cs
rename to test/TestApp.AspNetCore.3.1/AssemblyInfo.cs
index e78e70ff5b9..a7d6eb86a61 100644
--- a/test/TestApp.AspNetCore.7.0/AssemblyInfo.cs
+++ b/test/TestApp.AspNetCore.3.1/AssemblyInfo.cs
@@ -21,4 +21,4 @@
"SA1300",
Justification = "Reviewed.",
Scope = "namespaceanddescendants",
- Target = "TestApp.AspNetCore._7._0")]
+ Target = "TestApp.AspNetCore._3._1")]
diff --git a/test/TestApp.AspNetCore.7.0/CallbackMiddleware.cs b/test/TestApp.AspNetCore.3.1/CallbackMiddleware.cs
similarity index 88%
rename from test/TestApp.AspNetCore.7.0/CallbackMiddleware.cs
rename to test/TestApp.AspNetCore.3.1/CallbackMiddleware.cs
index a6609b39346..97023ac6ce3 100644
--- a/test/TestApp.AspNetCore.7.0/CallbackMiddleware.cs
+++ b/test/TestApp.AspNetCore.3.1/CallbackMiddleware.cs
@@ -13,13 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-#pragma warning disable SA1300 // Element should begin with upper-case letter
-namespace TestApp.AspNetCore._7._0
-#pragma warning restore SA1300 // Element should begin with upper-case letter
+namespace TestApp.AspNetCore._3._1
{
public class CallbackMiddleware
{
diff --git a/test/TestApp.AspNetCore.7.0/Controllers/ChildActivityController.cs b/test/TestApp.AspNetCore.3.1/Controllers/ChildActivityController.cs
similarity index 89%
rename from test/TestApp.AspNetCore.7.0/Controllers/ChildActivityController.cs
rename to test/TestApp.AspNetCore.3.1/Controllers/ChildActivityController.cs
index a31e42a86e3..911f9bae6a3 100644
--- a/test/TestApp.AspNetCore.7.0/Controllers/ChildActivityController.cs
+++ b/test/TestApp.AspNetCore.3.1/Controllers/ChildActivityController.cs
@@ -19,9 +19,7 @@
using Microsoft.AspNetCore.Mvc;
using OpenTelemetry;
-#pragma warning disable SA1300 // Element should begin with upper-case letter
-namespace TestApp.AspNetCore._7._0.Controllers
-#pragma warning restore SA1300 // Element should begin with upper-case letter
+namespace TestApp.AspNetCore._3._1.Controllers
{
public class ChildActivityController : Controller
{
diff --git a/test/TestApp.AspNetCore.7.0/Controllers/ForwardController.cs b/test/TestApp.AspNetCore.3.1/Controllers/ForwardController.cs
similarity index 91%
rename from test/TestApp.AspNetCore.7.0/Controllers/ForwardController.cs
rename to test/TestApp.AspNetCore.3.1/Controllers/ForwardController.cs
index 37822411636..5b532d3af0e 100644
--- a/test/TestApp.AspNetCore.7.0/Controllers/ForwardController.cs
+++ b/test/TestApp.AspNetCore.3.1/Controllers/ForwardController.cs
@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-
using System.Net.Http;
using System.Text;
using System.Text.Json;
@@ -21,9 +20,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
-#pragma warning disable SA1300 // Element should begin with upper-case letter
-namespace TestApp.AspNetCore._7._0.Controllers
-#pragma warning restore SA1300 // Element should begin with upper-case letter
+namespace TestApp.AspNetCore._3._1.Controllers
{
[Route("api/[controller]")]
public class ForwardController : Controller
diff --git a/test/TestApp.AspNetCore.7.0/Controllers/ValuesController.cs b/test/TestApp.AspNetCore.3.1/Controllers/ValuesController.cs
similarity index 88%
rename from test/TestApp.AspNetCore.7.0/Controllers/ValuesController.cs
rename to test/TestApp.AspNetCore.3.1/Controllers/ValuesController.cs
index 0183988b6f3..c7143faecf8 100644
--- a/test/TestApp.AspNetCore.7.0/Controllers/ValuesController.cs
+++ b/test/TestApp.AspNetCore.3.1/Controllers/ValuesController.cs
@@ -16,9 +16,7 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
-#pragma warning disable SA1300 // Element should begin with upper-case letter
-namespace TestApp.AspNetCore._7._0.Controllers
-#pragma warning restore SA1300 // Element should begin with upper-case letter
+namespace TestApp.AspNetCore._3._1.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
diff --git a/test/TestApp.AspNetCore.7.0/Program.cs b/test/TestApp.AspNetCore.3.1/Program.cs
similarity index 84%
rename from test/TestApp.AspNetCore.7.0/Program.cs
rename to test/TestApp.AspNetCore.3.1/Program.cs
index bdf1d8b7204..44e9398c023 100644
--- a/test/TestApp.AspNetCore.7.0/Program.cs
+++ b/test/TestApp.AspNetCore.3.1/Program.cs
@@ -17,9 +17,7 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
-#pragma warning disable SA1300 // Element should begin with upper-case letter
-namespace TestApp.AspNetCore._7._0
-#pragma warning restore SA1300 // Element should begin with upper-case letter
+namespace TestApp.AspNetCore._3._1
{
public class Program
{
diff --git a/test/TestApp.AspNetCore.3.1/README.md b/test/TestApp.AspNetCore.3.1/README.md
new file mode 100644
index 00000000000..db05b30cc29
--- /dev/null
+++ b/test/TestApp.AspNetCore.3.1/README.md
@@ -0,0 +1,13 @@
+# ASP.NET Core Integration Test
+
+This test app is used for ASP.NET Core integration testing by unit tests. You
+could also manually run W3C test suite.
+
+## Run W3C test suite
+
+The detailed instruction for the test tool available
+[here](https://github.com/w3c/trace-context/tree/master/test).
+
+* Follow it to install prerequisites and get the test code
+* Start this test app with Visual Studio (or `dotnet run`)
+* Run test per instruction using `http://localhost:63741/api/forward` endpoint
diff --git a/test/TestApp.AspNetCore.7.0/Startup.cs b/test/TestApp.AspNetCore.3.1/Startup.cs
similarity index 92%
rename from test/TestApp.AspNetCore.7.0/Startup.cs
rename to test/TestApp.AspNetCore.3.1/Startup.cs
index d9bbe701b6f..b8d84242aa1 100644
--- a/test/TestApp.AspNetCore.7.0/Startup.cs
+++ b/test/TestApp.AspNetCore.3.1/Startup.cs
@@ -21,9 +21,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-#pragma warning disable SA1300 // Element should begin with upper-case letter
-namespace TestApp.AspNetCore._7._0
-#pragma warning restore SA1300 // Element should begin with upper-case letter
+namespace TestApp.AspNetCore._3._1
{
public class Startup
{
diff --git a/test/TestApp.AspNetCore.7.0/TestApp.AspNetCore.7.0.csproj b/test/TestApp.AspNetCore.3.1/TestApp.AspNetCore.3.1.csproj
similarity index 78%
rename from test/TestApp.AspNetCore.7.0/TestApp.AspNetCore.7.0.csproj
rename to test/TestApp.AspNetCore.3.1/TestApp.AspNetCore.3.1.csproj
index ef7445dd18e..6dae1f7c31a 100644
--- a/test/TestApp.AspNetCore.7.0/TestApp.AspNetCore.7.0.csproj
+++ b/test/TestApp.AspNetCore.3.1/TestApp.AspNetCore.3.1.csproj
@@ -1,7 +1,6 @@
-
-
+
- net7.0
+ netcoreapp3.1
@@ -12,7 +11,7 @@
-
+
@@ -21,5 +20,4 @@
-
diff --git a/test/TestApp.AspNetCore.7.0/appsettings.Development.json b/test/TestApp.AspNetCore.3.1/appsettings.Development.json
similarity index 100%
rename from test/TestApp.AspNetCore.7.0/appsettings.Development.json
rename to test/TestApp.AspNetCore.3.1/appsettings.Development.json
diff --git a/test/TestApp.AspNetCore.7.0/appsettings.json b/test/TestApp.AspNetCore.3.1/appsettings.json
similarity index 100%
rename from test/TestApp.AspNetCore.7.0/appsettings.json
rename to test/TestApp.AspNetCore.3.1/appsettings.json