Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
We use conservative versions of these packages where an upgrade might
introduce breaking changes.
-->
<PackageVersion Include="Google.Protobuf" Version="[3.22.5,4.0)" />
<PackageVersion Include="Grpc" Version="[2.44.0,3.0)" />
<PackageVersion Include="Grpc.Core" Version="[2.44.0,3.0)" />
<PackageVersion Include="Grpc.Net.Client" Version="[2.52.0,3.0)" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -97,6 +93,9 @@
<PackageVersion Include="Grpc.AspNetCore" Version="[2.59.0,3.0)" />
<PackageVersion Include="Grpc.AspNetCore.Server" Version="[2.59.0, 3.0)" />
<PackageVersion Include="Grpc.Tools" Version="[2.59.0,3.0)" />
<PackageVersion Include="Google.Protobuf" Version="[3.22.5,4.0)" />
<PackageVersion Include="Grpc" Version="[2.44.0,3.0)" />
<PackageVersion Include="Grpc.Net.Client" Version="[2.52.0,3.0)" />
<PackageVersion Include="Microsoft.CSharp" Version="[4.7.0]" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="[3.11.0-beta1.23525.2]" />
<PackageVersion Include="Microsoft.Coyote" Version="1.7.11" />
Expand Down
18 changes: 18 additions & 0 deletions src/OpenTelemetry.Exporter.OpenTelemetryProtocol/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ Notes](../../RELEASENOTES.md).

## Unreleased

* **Breaking Change (Behavioral)**: Removed the deprecated `Grpc.Core` transport
support for `.NET Framework (net462)` and `.NET Standard 2.0` in the OTLP
exporter. `OtlpExportProtocol.Grpc` is no longer supported when using the
default HTTP client factory on these platforms. Attempting to use this
combination will now result in a `NotSupportedException`.
([#6229](https://github.com/open-telemetry/opentelemetry-dotnet/pull/6229))

* Changed default export protocol for `.NET Framework` and `.NET Standard 2.0`
to `OtlpExportProtocol.HttpProtobuf`. This aligns with supported and actively
maintained transport mechanisms.For `.NET Framework` or `.NET Standard 2.0`
users previously relying on `OtlpExportProtocol.Grpc`, update your
configuration:
([#6229](https://github.com/open-telemetry/opentelemetry-dotnet/pull/6229))

```csharp
options.Protocol = OtlpExportProtocol.HttpProtobuf;
```

## 1.11.2

Released 2025-Mar-04
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Grpc.Core" Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(NetFrameworkMinimumSupportedVersion)'" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Net.Http" Condition="'$(TargetFramework)' == '$(NetFrameworkMinimumSupportedVersion)'" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public class OtlpExporterOptions : IOtlpExporterOptions
{
internal const string DefaultGrpcEndpoint = "http://localhost:4317";
internal const string DefaultHttpEndpoint = "http://localhost:4318";
#if NET462_OR_GREATER || NETSTANDARD2_0
internal const OtlpExportProtocol DefaultOtlpExportProtocol = OtlpExportProtocol.HttpProtobuf;
#else
internal const OtlpExportProtocol DefaultOtlpExportProtocol = OtlpExportProtocol.Grpc;
#endif

internal static readonly KeyValuePair<string, string>[] StandardHeaders = new KeyValuePair<string, string>[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
using OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation;
using OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.ExportClient;
using OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.Transmission;
#if NET462_OR_GREATER || NETSTANDARD2_0
using Grpc.Core;
#endif

namespace OpenTelemetry.Exporter;

Expand All @@ -25,30 +22,6 @@ internal static class OtlpExporterOptionsExtensions
private const string MetricsHttpServicePath = "v1/metrics";
private const string LogsHttpServicePath = "v1/logs";

#if NET462_OR_GREATER || NETSTANDARD2_0
public static Channel CreateChannel(this OtlpExporterOptions options)
{
if (options.Endpoint.Scheme != Uri.UriSchemeHttp && options.Endpoint.Scheme != Uri.UriSchemeHttps)
{
throw new NotSupportedException($"Endpoint URI scheme ({options.Endpoint.Scheme}) is not supported. Currently only \"http\" and \"https\" are supported.");
}

ChannelCredentials channelCredentials;
if (options.Endpoint.Scheme == Uri.UriSchemeHttps)
{
channelCredentials = new SslCredentials();
}
else
{
channelCredentials = ChannelCredentials.Insecure;
}

return new Channel(options.Endpoint.Authority, channelCredentials);
}

public static Metadata GetMetadataFromHeaders(this OtlpExporterOptions options) => options.GetHeaders<Metadata>((m, k, v) => m.Add(k, v));
#endif

public static THeaders GetHeaders<THeaders>(this OtlpExporterOptions options, Action<THeaders, string, string> addHeader)
where THeaders : new()
{
Expand Down Expand Up @@ -134,20 +107,6 @@ public static IExportClient GetExportClient(this OtlpExporterOptions options, Ot
throw new NotSupportedException($"Protocol {options.Protocol} is not supported.");
}

#if NET462_OR_GREATER || NETSTANDARD2_0
if (options.Protocol == OtlpExportProtocol.Grpc)
{
var servicePath = otlpSignalType switch
{
OtlpSignalType.Traces => TraceGrpcServicePath,
OtlpSignalType.Metrics => MetricsGrpcServicePath,
OtlpSignalType.Logs => LogsGrpcServicePath,
_ => throw new NotSupportedException($"OtlpSignalType {otlpSignalType} is not supported."),
};
return new GrpcExportClient(options, servicePath);
}
#endif

return otlpSignalType switch
{
OtlpSignalType.Traces => options.Protocol == OtlpExportProtocol.Grpc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ internal static BaseProcessor<LogRecord> BuildOtlpLogExporter(
Debug.Assert(sdkLimitOptions != null, "sdkLimitOptions was null");
Debug.Assert(experimentalOptions != null, "experimentalOptions was null");

#if NET462_OR_GREATER || NETSTANDARD2_0
if (exporterOptions!.Protocol == OtlpExportProtocol.Grpc &&
ReferenceEquals(exporterOptions.HttpClientFactory, exporterOptions.DefaultHttpClientFactory))
{
throw new NotSupportedException("OtlpExportProtocol.Grpc with the default HTTP client factory is not supported on .NET Framework or .NET Standard 2.0." +
"Please switch to OtlpExportProtocol.HttpProtobuf or provide a custom HttpClientFactory.");
}
#endif

if (!skipUseOtlpExporterRegistrationCheck)
{
serviceProvider!.EnsureNoUseOtlpExporterRegistrations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ internal static MetricReader BuildOtlpExporterMetricReader(
Debug.Assert(metricReaderOptions != null, "metricReaderOptions was null");
Debug.Assert(experimentalOptions != null, "experimentalOptions was null");

#if NET462_OR_GREATER || NETSTANDARD2_0
if (exporterOptions!.Protocol == OtlpExportProtocol.Grpc &&
ReferenceEquals(exporterOptions.HttpClientFactory, exporterOptions.DefaultHttpClientFactory))
{
throw new NotSupportedException("OtlpExportProtocol.Grpc with the default HTTP client factory is not supported on .NET Framework or .NET Standard 2.0." +
"Please switch to OtlpExportProtocol.HttpProtobuf or provide a custom HttpClientFactory.");
}
#endif

if (!skipUseOtlpExporterRegistrationCheck)
{
serviceProvider!.EnsureNoUseOtlpExporterRegistrations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ internal static BaseProcessor<Activity> BuildOtlpExporterProcessor(
Debug.Assert(experimentalOptions != null, "experimentalOptions was null");
Debug.Assert(batchExportProcessorOptions != null, "batchExportProcessorOptions was null");

#if NET462_OR_GREATER || NETSTANDARD2_0
if (exporterOptions!.Protocol == OtlpExportProtocol.Grpc &&
ReferenceEquals(exporterOptions.HttpClientFactory, exporterOptions.DefaultHttpClientFactory))
{
throw new NotSupportedException("OtlpExportProtocol.Grpc with the default HTTP client factory is not supported on .NET Framework or .NET Standard 2.0." +
"Please switch to OtlpExportProtocol.HttpProtobuf or provide a custom HttpClientFactory.");
}
#endif

if (!skipUseOtlpExporterRegistrationCheck)
{
serviceProvider!.EnsureNoUseOtlpExporterRegistrations();
Expand Down
Loading