Skip to content

[bug] Exporting using gRPC doesn't work in net48 projects #6067

Closed
@AB027PS

Description

@AB027PS

Package

OpenTelemetry.Exporter.OpenTelemetryProtocol

Package Version

Package Name Version
OpenTelemetry.Exporter.OpenTelemetryProtocol 1.11.0

Runtime Version

net48

Description

I'm not able to export logs/metrics/traces using gRPC in net48 projects .

Steps to Reproduce

using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleAppFramework
{
    internal class Program
    {
        static void Main(string[] args)
        {
            using (var provider = Sdk
                .CreateTracerProviderBuilder()
                .AddSource("test")
                .SetResourceBuilder(ResourceBuilder
                    .CreateEmpty()
                    .AddService("ConsoleAppFramework"))
                .AddOtlpExporter()
                .Build())
            {
                var source = new ActivitySource("test");

                while (true)
                {
                    using (var activity = source.StartActivity("testing"))
                    {
                        Thread.Sleep(1000);
                    }
                }
            }
        }

    }
}

Expected Result

Traces get successfully exported

Actual Result

An exception is thrown at line 42 here

/// <inheritdoc/>
public override ExportClientResponse SendExportRequest(byte[] buffer, int contentLength, DateTime deadlineUtc, CancellationToken cancellationToken = default)
{
try
{
using var httpRequest = this.CreateHttpRequest(buffer, contentLength);
using var httpResponse = this.SendHttpRequest(httpRequest, cancellationToken);
httpResponse.EnsureSuccessStatusCode();

The exception message is Only HTTP/1.0 and HTTP/1.1 version requests are currently supported. Parameter name: value

Additional Context

Exporting via HTTP works fine.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions