open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.18k stars 753 forks source link

How to send logs to Otel Collector with Content-Type JSON #5793

Closed smoms closed 1 month ago

smoms commented 1 month ago

How to send logs using Content-Type application/json ?

Hi,

I am using OTel dotnet libraries (1.7.0) to export logs to OpenTelemetry Collector Contrib. All fine but I would like to send logs in JSON instead of protobuf. I see that all work as expected when the Content-Type is set to application/x-protobuf (default behaviour). Is there a way to sent also as application/json? If yes, where is configuration change?

Edit: Am I correct that the dotnetcore SDK does not support JSON protocol option?

options.AddOtlpExporter(o => { o.Protocol = OtlpExportProtocol.HttpProtobuf; ........ }

thanks.

Additional context

No response

vishweshbankwar commented 1 month ago

@smoms - Your understanding is correct; it is not supported in .NET.

cijothomas commented 1 month ago

duplicate https://github.com/open-telemetry/opentelemetry-dotnet/issues/5764