dotnet opentelemetry client is not working for httpprotobuf

40 Views Asked by At

I'm not able to send data with httpprotobuf protocol but everything is working fine with grpc protocol

otel.WithTracing(tracing =>
{
    tracing.AddAspNetCoreInstrumentation();
    tracing.AddHttpClientInstrumentation();
    tracing.AddSource("CustomActivityName");
    tracing.AddOtlpExporter(otlpOptions =>
    {
        otlpOptions.Endpoint = new Uri("http://otel-url:4318/");
        otlpOptions.Protocol = OtlpExportProtocol.HttpProtobuf;
    });
    tracing.AddConsoleExporter();
});

I'm bit confused as I'm not seeing any error logs

1

There are 1 best solutions below

0
Lybr4 On

According to Exporter Readme:

When using OtlpExportProtocol.HttpProtobuf, the full URL MUST be provided, including the signal-specific path v1/{signal}. For example, for traces, the full URL will look like http://your-custom-endpoint/v1/traces.

In your case this would be:

otel.WithTracing(tracing =>
{
    tracing.AddAspNetCoreInstrumentation();
    tracing.AddHttpClientInstrumentation();
    tracing.AddSource("CustomActivityName");
    tracing.AddOtlpExporter(otlpOptions =>
    {
        otlpOptions.Endpoint = new Uri("http://otel-url:4318/v1/traces");
        otlpOptions.Protocol = OtlpExportProtocol.HttpProtobuf;
    });
    tracing.AddConsoleExporter();
});