Use DiagnosticSource 7.0 and drop netcoreapp3.1 target (#3351)

* Remove AspNetCore 3.1 test app

* Remove netcoreapp3.1 target from projects

* Bump to DiagnosticSource 7.0.0-preview.4.22229.4

* Enable CI on net7.0 branch

* Remove trailing space
This commit is contained in:
Alan West 2022-06-07 20:46:15 -07:00 committed by GitHub
parent efc55d54fa
commit d84f0edf77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 53 additions and 475 deletions

View File

@ -2,7 +2,7 @@ name: API Compatibility
on:
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'

View File

@ -2,11 +2,11 @@ name: Code Coverage
on:
push:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'

View File

@ -2,9 +2,9 @@ name: docfx
on:
push:
branches: [ main ]
branches: [ main, net7.0 ]
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
jobs:
build:

View File

@ -9,7 +9,7 @@ name: dotnet format
on:
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths:
- '**.md'

View File

@ -2,12 +2,12 @@ name: dotnet format
on:
push:
branches: [ main ]
branches: [ main, net7.0 ]
paths:
- '**.cs'
- '.editorconfig'
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths:
- '**.cs'
- '.editorconfig'

View File

@ -9,7 +9,7 @@ name: Integration Tests
on:
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths:
- '**.md'
@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [netcoreapp3.1,net6.0]
version: [net6.0]
steps:
- run: 'echo "No build required"'
@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [netcoreapp3.1,net6.0]
version: [net6.0]
steps:
- run: 'echo "No build required"'
@ -34,6 +34,6 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [netcoreapp3.1,net6.0]
version: [net6.0]
steps:
- run: 'echo "No build required"'

View File

@ -2,11 +2,11 @@ name: Integration Tests
on:
push:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'
@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [netcoreapp3.1,net6.0]
version: [net6.0]
steps:
- uses: actions/checkout@v3
@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [netcoreapp3.1,net6.0]
version: [net6.0]
steps:
- uses: actions/checkout@v3
@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [netcoreapp3.1,net6.0]
version: [net6.0]
steps:
- uses: actions/checkout@v3

View File

@ -9,7 +9,7 @@ name: Linux
on:
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths:
- '**.md'
@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
version: [netcoreapp3.1,net6.0]
version: [net6.0]
steps:
- run: 'echo "No build required"'

View File

@ -2,11 +2,11 @@ name: Linux
on:
push:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'
@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
version: [netcoreapp3.1,net6.0]
version: [net6.0]
steps:
- uses: actions/checkout@v3

View File

@ -2,11 +2,11 @@ name: markdownlint
on:
push:
branches: [ main ]
branches: [ main, net7.0 ]
paths:
- '**.md'
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths:
- '**.md'

View File

@ -2,9 +2,9 @@ name: sanitycheck
on:
push:
branches: [ main ]
branches: [ main, net7.0 ]
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
jobs:
misspell:

View File

@ -9,7 +9,7 @@ name: Windows
on:
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths:
- '**.md'
@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
version: [net462,netcoreapp3.1,net6.0]
version: [net462,net6.0]
steps:
- run: 'echo "No build required"'

View File

@ -2,11 +2,11 @@ name: Windows
on:
push:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main ]
branches: [ main, net7.0 ]
paths-ignore:
- '**.md'
@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
version: [net462,netcoreapp3.1,net6.0]
version: [net462,net6.0]
steps:
- uses: actions/checkout@v3

View File

@ -50,8 +50,6 @@ 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}"
@ -266,10 +264,6 @@ 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
@ -491,7 +485,6 @@ 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}

View File

@ -42,7 +42,7 @@
<OTelPreviousStableVer>1.3.0</OTelPreviousStableVer>
<StyleCopAnalyzersPkgVer>[1.2.0-beta.354,2.0)</StyleCopAnalyzersPkgVer>
<SystemCollectionsImmutablePkgVer>1.4.0</SystemCollectionsImmutablePkgVer>
<SystemDiagnosticSourcePkgVer>6.0.0</SystemDiagnosticSourcePkgVer>
<SystemDiagnosticSourcePkgVer>7.0.0-preview.4.22229.4</SystemDiagnosticSourcePkgVer>
<SystemReflectionEmitLightweightPkgVer>4.7.0</SystemReflectionEmitLightweightPkgVer>
<SystemTextJsonPkgVer>4.7.0</SystemTextJsonPkgVer>
<SystemThreadingTasksExtensionsPkgVer>4.5.3</SystemThreadingTasksExtensionsPkgVer>

View File

@ -5,7 +5,7 @@
<OutputType>Exe</OutputType>
<!-- https://dotnet.microsoft.com/download/dotnet-core -->
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<!-- https://dotnet.microsoft.com/download/dotnet-framework -->
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462;net47;net471;net472;net48</TargetFrameworks>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<Description>Prometheus exporter for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);prometheus;metrics</PackageTags>
<MinVerTagPrefix>core-</MinVerTagPrefix>
@ -27,7 +27,7 @@
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Api\Internal\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1;netstandard2.1;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0</TargetFrameworks>
<Description>ASP.NET Core instrumentation for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);distributed-tracing;AspNetCore</PackageTags>
<IncludeDiagnosticSourceInstrumentationHelpers>true</IncludeDiagnosticSourceInstrumentationHelpers>
@ -28,11 +28,6 @@
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="$(MicrosoftAspNetCoreHttpFeaturesPkgVer)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="$(MicrosoftAspNetCoreHttpFeaturesNet3PkgVer)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1;net462</TargetFrameworks>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for Jaeger Exporter for OpenTelemetry</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<IsPackable>false</IsPackable>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == '' AND $(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) != ''">$(TARGET_FRAMEWORK)</TargetFrameworks>
<IsPackable>false</IsPackable>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for Prometheus Exporter for OpenTelemetry</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<IsPackable>false</IsPackable>
@ -29,10 +29,6 @@
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\Shared\Utils.cs" Link="Includes\Utils.cs" />
</ItemGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for Zipkin Exporter for OpenTelemetry</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry .NET Core hosting library</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0;netcoreapp3.1;net462</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0;net462</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) != ''">$(TARGET_FRAMEWORK)</TargetFrameworks>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry ASP.NET Core instrumentation</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry Grpc for .NET instrumentation</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry HTTP instrumentations</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry SqlClient instrumentations</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == '' and $(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) != ''">$(TARGET_FRAMEWORK)</TargetFrameworks>
</PropertyGroup>

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry ASP.NET Core instrumentation for W3C Trace Context Trace</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) != ''">$(TARGET_FRAMEWORK)</TargetFrameworks>
</PropertyGroup>
@ -33,10 +33,6 @@
<ProjectReference Include="$(RepoRoot)\test\TestApp.AspNetCore.6.0\TestApp.AspNetCore.6.0.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<ProjectReference Include="$(RepoRoot)\test\TestApp.AspNetCore.3.1\TestApp.AspNetCore.3.1.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\Shared\SkipUnlessEnvVarFoundTheoryAttribute.cs" Link="Implementation\SkipUnlessEnvVarFoundTheoryAttribute.cs" />
</ItemGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry.Shims.OpenTracing</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1;net462</TargetFrameworks>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1;net462</TargetFrameworks>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<NoWarn>$(NoWarn),CS0618</NoWarn>
</PropertyGroup>

View File

@ -1,24 +0,0 @@
// <copyright file="AssemblyInfo.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage(
"StyleCop.CSharp.NamingRules",
"SA1300",
Justification = "Reviewed.",
Scope = "namespaceanddescendants",
Target = "TestApp.AspNetCore._3._1")]

View File

@ -1,48 +0,0 @@
// <copyright file="CallbackMiddleware.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace TestApp.AspNetCore._3._1
{
public class CallbackMiddleware
{
private readonly CallbackMiddlewareImpl impl;
private readonly RequestDelegate next;
public CallbackMiddleware(RequestDelegate next, CallbackMiddlewareImpl impl)
{
this.next = next;
this.impl = impl;
}
public async Task InvokeAsync(HttpContext context)
{
if (this.impl == null || await this.impl.ProcessAsync(context))
{
await this.next(context);
}
}
public class CallbackMiddlewareImpl
{
public virtual async Task<bool> ProcessAsync(HttpContext context)
{
return await Task.FromResult(true);
}
}
}
}

View File

@ -1,46 +0,0 @@
// <copyright file="ChildActivityController.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using OpenTelemetry;
namespace TestApp.AspNetCore._3._1.Controllers
{
public class ChildActivityController : Controller
{
[Route("api/GetChildActivityTraceContext")]
public Dictionary<string, string> GetChildActivityTraceContext()
{
var result = new Dictionary<string, string>();
var activity = new Activity("ActivityInsideHttpRequest");
activity.Start();
result["TraceId"] = activity.Context.TraceId.ToString();
result["ParentSpanId"] = activity.ParentSpanId.ToString();
result["TraceState"] = activity.Context.TraceState;
activity.Stop();
return result;
}
[Route("api/GetChildActivityBaggageContext")]
public IReadOnlyDictionary<string, string> GetChildActivityBaggageContext()
{
var result = Baggage.Current.GetBaggage();
return result;
}
}
}

View File

@ -1,71 +0,0 @@
// <copyright file="ForwardController.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace TestApp.AspNetCore._3._1.Controllers
{
[Route("api/[controller]")]
public class ForwardController : Controller
{
private readonly HttpClient httpClient;
public ForwardController(HttpClient httpClient)
{
this.httpClient = httpClient;
}
// POST api/test
[HttpPost]
public async Task<string> Post([FromBody] Data[] data)
{
var result = string.Empty;
if (data != null)
{
foreach (var argument in data)
{
var request = new HttpRequestMessage(HttpMethod.Post, argument.Url)
{
Content = new StringContent(
JsonConvert.SerializeObject(argument.Arguments),
Encoding.UTF8,
"application/json"),
};
await this.httpClient.SendAsync(request);
}
}
else
{
result = "done";
}
return result;
}
public class Data
{
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("arguments")]
public Data[] Arguments { get; set; }
}
}
}

View File

@ -1,56 +0,0 @@
// <copyright file="ValuesController.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace TestApp.AspNetCore._3._1.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody] string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

View File

@ -1,33 +0,0 @@
// <copyright file="Program.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
namespace TestApp.AspNetCore._3._1
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}

View File

@ -1,13 +0,0 @@
# 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

View File

@ -1,63 +0,0 @@
// <copyright file="Startup.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Net.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace TestApp.AspNetCore._3._1
{
public class Startup
{
public Startup(IConfiguration configuration)
{
this.Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddSingleton<HttpClient>();
services.AddSingleton(
new CallbackMiddleware.CallbackMiddlewareImpl());
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMiddleware<CallbackMiddleware>();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}

View File

@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="wwwroot\**" />
<Content Remove="wwwroot\**" />
<EmbeddedResource Remove="wwwroot\**" />
<None Remove="wwwroot\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Api\OpenTelemetry.Api.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNetCore\OpenTelemetry.Instrumentation.AspNetCore.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Hosting\OpenTelemetry.Extensions.Hosting.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
</ItemGroup>
</Project>

View File

@ -1,10 +0,0 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}

View File

@ -1,15 +0,0 @@
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}