Enable .NET 452 - part 01 (#722)

* Enable .NET 452 - part 01

* removing warning and adding net452 to shims.OpenTracing

* adding net452 condition to dependencies code

* undoing non-related changes to pull request

* adding sytem.tuple to dependencies.test for net 452. changing condition to netframework

Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
This commit is contained in:
Eddy Nakamura 2020-06-16 01:58:15 -03:00 committed by GitHub
parent 575ddd5fce
commit 9f3bb81b4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 31 additions and 16 deletions

View File

@ -29,7 +29,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
[NonEvent]
public void FailedToConvertToProtoDefinitionError(Exception ex)
{
if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))
if (Log.IsEnabled(EventLevel.Error, (EventKeywords)(-1)))
{
this.FailedToConvertToProtoDefinitionError(ToInvariantString(ex));
}
@ -38,7 +38,7 @@ namespace OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation
[NonEvent]
public void FailedToReachCollector(Exception ex)
{
if (Log.IsEnabled(EventLevel.Error, EventKeywords.All))
if (Log.IsEnabled(EventLevel.Error, (EventKeywords)(-1)))
{
this.FailedToReachCollector(ToInvariantString(ex));
}

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net46;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net452;net46;netstandard2.0</TargetFrameworks>
<Description>OpenTelemetry exporter to the OpenTelemetry collector (otelcol).</Description>
<PackageTags>$(PackageTags);otelcol;distributed-tracing</PackageTags>
</PropertyGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net46</TargetFrameworks>
<TargetFrameworks>net452;net46</TargetFrameworks>
<Description>OpenTelemetry instrumentation for ASP.NET requests.</Description>
<AssemblyName>OpenTelemetry.Instrumentation.AspNet</AssemblyName>
<PackageTags>$(PackageTags);distributed-tracing;AspNet;MVC;WebAPI</PackageTags>

View File

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
#if NET461
#if NETFRAMEWORK
using System;
using System.Collections;
using System.Collections.Generic;

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net452;net461</TargetFrameworks>
<Description>OpenTelemetry instrumentation for Http, Sql, &amp; Azure dependencies.</Description>
<PackageTags>$(PackageTags);distributed-tracing;HttpClient</PackageTags>
</PropertyGroup>
@ -9,4 +9,8 @@
<ProjectReference Include="..\OpenTelemetry\OpenTelemetry.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>

View File

@ -40,7 +40,7 @@ namespace OpenTelemetry.Trace.Configuration
builder.AddHttpClientDependencyInstrumentation();
builder.AddSqlClientDependencyInstrumentation();
builder.AddAzureClientsDependencyInstrumentation();
#if NET461
#if NETFRAMEWORK
builder.AddHttpWebRequestDependencyInstrumentation();
#endif
return builder;
@ -66,7 +66,7 @@ namespace OpenTelemetry.Trace.Configuration
builder.AddHttpClientDependencyInstrumentation(configureHttpClientInstrumentationOptions);
builder.AddSqlClientDependencyInstrumentation(configureSqlClientInstrumentationOptions);
builder.AddAzureClientsDependencyInstrumentation();
#if NET461
#if NETFRAMEWORK
builder.AddHttpWebRequestDependencyInstrumentation();
#endif
return builder;
@ -163,7 +163,7 @@ namespace OpenTelemetry.Trace.Configuration
return builder;
}
#if NET461
#if NETFRAMEWORK
/// <summary>
/// Enables the outgoing requests automatic data collection for .NET Framework HttpWebRequest activity source.
/// </summary>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net46;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net452;net46;netstandard2.0</TargetFrameworks>
<Description>OpenTelemetry shim for OpenTracing</Description>
<PackageTags>$(PackageTags);distributed-tracing;OpenTracing</PackageTags>
<IsPackable>true</IsPackable>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for OpenTelemetry ASP.NET instrumentation</Description>
<TargetFrameworks>net46</TargetFrameworks>
<TargetFrameworks>net452;net46</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
#if NET461
#if NETFRAMEWORK
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

View File

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
#if NET461
#if NETFRAMEWORK
using System;
using System.Diagnostics;
using System.Linq;

View File

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
#if NET461
#if NETFRAMEWORK
using System;
using System.Collections.Generic;
using System.Diagnostics;

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Unit test project for OpenTelemetry dependency instrumentations</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net461</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
@ -20,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="1.1.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="1.1.1" Condition="'$(TargetFramework)' != 'net452'" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Moq" Version="4.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
@ -28,6 +28,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="System.ValueTuple" Version="4.5.0" Condition="'$(TargetFramework)' == 'net452'" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" Condition="'$(TargetFramework)' == 'net452'" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
@ -37,6 +39,11 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
<Reference Include="System.Net.Http" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\OpenTelemetry.Instrumentation.Dependencies\OpenTelemetry.Instrumentation.Dependencies.csproj" />
<ProjectReference Include="..\..\src\OpenTelemetry\OpenTelemetry.csproj" />

View File

@ -18,7 +18,11 @@ using System;
using System.Data;
using System.Diagnostics;
using System.Linq;
#if NET452
using System.Data.SqlClient;
#else
using Microsoft.Data.SqlClient;
#endif
using Moq;
using OpenTelemetry.Instrumentation.Dependencies.Implementation;
using OpenTelemetry.Trace;