Srinivas
Srinivas

Reputation: 11

dotnet opentelemetry client is not working for httpprotobuf

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

Upvotes: 0

Views: 133

Answers (1)

Lybr4
Lybr4

Reputation: 11

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();
});

Upvotes: 1

Related Questions