[HttpClient] Remove SDK dependency (#5077)
This commit is contained in:
parent
4e390e3284
commit
6a829dd363
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
* **Breaking Change** :
|
||||
[SuppressDownstreamInstrumentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry.Instrumentation.GrpcNetClient#suppressdownstreaminstrumentation)
|
||||
option will no longer be supported when used with certain versions of
|
||||
`OpenTelemetry.Instrumentation.Http` package. Check out this
|
||||
[issue](https://github.com/open-telemetry/opentelemetry-dotnet/issues/5092)
|
||||
for details and workaround.
|
||||
([#5077](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5077))
|
||||
|
||||
## 1.6.0-beta.3
|
||||
|
||||
Released 2023-Nov-17
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@
|
|||
* Update activity DisplayName as per the specification.
|
||||
([#5078](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5078))
|
||||
|
||||
* Removed reference to `OpenTelemetry` package. This is a **breaking change**
|
||||
for users relying on
|
||||
[SuppressDownstreamInstrumentation](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry.Instrumentation.GrpcNetClient#suppressdownstreaminstrumentation)
|
||||
option in `OpenTelemetry.Instrumentation.GrpcNetClient`. For details, check
|
||||
out this
|
||||
[issue](https://github.com/open-telemetry/opentelemetry-dotnet/issues/5092).
|
||||
([#5077](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5077))
|
||||
|
||||
## 1.6.0-beta.3
|
||||
|
||||
Released 2023-Nov-17
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ using System.Net;
|
|||
using System.Net.Http;
|
||||
#endif
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using OpenTelemetry.Instrumentation.Http.Implementation;
|
||||
using static OpenTelemetry.Internal.HttpSemanticConventionHelper;
|
||||
|
||||
namespace OpenTelemetry.Instrumentation.Http;
|
||||
|
||||
|
|
@ -31,23 +29,6 @@ namespace OpenTelemetry.Instrumentation.Http;
|
|||
/// </summary>
|
||||
public class HttpClientInstrumentationOptions
|
||||
{
|
||||
internal readonly HttpSemanticConvention HttpSemanticConvention;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HttpClientInstrumentationOptions"/> class.
|
||||
/// </summary>
|
||||
public HttpClientInstrumentationOptions()
|
||||
: this(new ConfigurationBuilder().AddEnvironmentVariables().Build())
|
||||
{
|
||||
}
|
||||
|
||||
internal HttpClientInstrumentationOptions(IConfiguration configuration)
|
||||
{
|
||||
Debug.Assert(configuration != null, "configuration was null");
|
||||
|
||||
this.HttpSemanticConvention = GetSemanticConventionOptIn(configuration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a filter function that determines whether or not to
|
||||
/// collect telemetry on a per request basis.
|
||||
|
|
|
|||
|
|
@ -104,11 +104,6 @@ internal sealed class HttpHandlerDiagnosticListener : ListenerHandler
|
|||
// By this time, samplers have already run and
|
||||
// activity.IsAllDataRequested populated accordingly.
|
||||
|
||||
if (Sdk.SuppressInstrumentation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryFetchRequest(payload, out HttpRequestMessage request))
|
||||
{
|
||||
HttpInstrumentationEventSource.Log.NullPayload(nameof(HttpHandlerDiagnosticListener), nameof(this.OnStartActivity));
|
||||
|
|
|
|||
|
|
@ -66,11 +66,6 @@ internal sealed class HttpHandlerMetricsDiagnosticListener : ListenerHandler
|
|||
|
||||
public void OnStopEventWritten(Activity activity, object payload)
|
||||
{
|
||||
if (Sdk.SuppressInstrumentation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryFetchRequest(payload, out HttpRequestMessage request))
|
||||
{
|
||||
// see the spec https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-metrics.md
|
||||
|
|
|
|||
|
|
@ -12,24 +12,22 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
|
||||
<Compile Include="$(RepoRoot)\src\Shared\EnvironmentVariables\*.cs" Link="Includes\EnvironmentVariables\%(Filename).cs" />
|
||||
<Compile Include="$(RepoRoot)\src\Shared\HttpSemanticConventionHelper.cs" Link="Includes\HttpSemanticConventionHelper.cs" />
|
||||
<Compile Include="$(RepoRoot)\src\Shared\Options\*.cs" Link="Includes\Options\%(Filename).cs" />
|
||||
<Compile Include="$(RepoRoot)\src\Shared\Shims\NullableAttributes.cs" Link="Includes\Shims\NullableAttributes.cs" />
|
||||
<Compile Include="$(RepoRoot)\src\Shared\RequestMethodHelper.cs" Link="Includes\RequestMethodHelper.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(RunningDotNetPack)' != 'true'">
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Api.ProviderBuilderExtensions\OpenTelemetry.Api.ProviderBuilderExtensions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Instrumentation packages when published should take a dependency only on the latest stable version of the API/SDK. -->
|
||||
<ItemGroup Condition="'$(RunningDotNetPack)' == 'true'">
|
||||
<PackageReference Include="OpenTelemetry" />
|
||||
<PackageReference Include="OpenTelemetry.Api.ProviderBuilderExtensions" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Net.Http" Condition="'$(TargetFramework)' == '$(NetFrameworkMinimumSupportedVersion)'" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ public static class TracerProviderBuilderExtensions
|
|||
{
|
||||
services.Configure(name, configureHttpClientInstrumentationOptions);
|
||||
}
|
||||
|
||||
services.RegisterOptionsFactory(configuration => new HttpClientInstrumentationOptions(configuration));
|
||||
});
|
||||
|
||||
#if NETFRAMEWORK
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ public partial class GrpcTests
|
|||
Assert.Equal(shouldEnrich ? "yes" : "no", grpcSpan.Tags.Where(tag => tag.Key == "enrichedWithHttpResponseMessage").FirstOrDefault().Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/5092")]
|
||||
public void GrpcAndHttpClientInstrumentationWithSuppressInstrumentation()
|
||||
{
|
||||
var uri = new Uri($"http://localhost:{this.server.Port}");
|
||||
|
|
@ -443,7 +443,7 @@ public partial class GrpcTests
|
|||
Assert.Equal(0, grpcSpan4.GetTagValue(SemanticConventions.AttributeRpcGrpcStatusCode));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/5092")]
|
||||
public void GrpcPropagatesContextWithSuppressInstrumentationOptionSetToTrue()
|
||||
{
|
||||
try
|
||||
|
|
@ -586,7 +586,7 @@ public partial class GrpcTests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/5092")]
|
||||
public void GrpcClientInstrumentationRespectsSdkSuppressInstrumentation()
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ public partial class HttpClientTests : IDisposable
|
|||
}));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/5092")]
|
||||
public async Task RespectsSuppress()
|
||||
{
|
||||
try
|
||||
|
|
|
|||
Loading…
Reference in New Issue