[bug] Null attributes not serialized to protobuf correctly, breaking Loki #6138
Labels
bug
Something isn't working
needs-triage
New issues which have not been classified or triaged by a community member
pkg:OpenTelemetry
Issues related to OpenTelemetry NuGet package
Package
OpenTelemetry
Package Version
Runtime Version
net9.0
Description
As discovered via this issue, the
TagWriter
class of theOpenTelemetry.Exporter.OpenTelemetryProtocol
package is misbehaving when aLogRecord
has an attribute with anull
value. Instead of writing the attribute's key followed by an empty (missing) value, it skips the attribute altogether (see this code). This results in what I assume is an invalid serialized object and it ends up breaking Loki when it receives such a log record.To repro this, it was as simple as doing this and forwarding it onto Loki:
Steps to Reproduce
grafana/otel-lgtm:latest
and mapping a volume to a local directory so I can quickly and easily delete all its storage and start afresh. See my docker compose service belowdotnet new console
dotnet add package Microsoft.Extensions.Hosting
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
Program.cs
, copy/paste the below codeservice_name
null
value and re-execute the reproDocker Compose service
Program.cs:
Expected Result
I should see the log entry in Grafana's log viewer.
Actual Result
Once the poisoned log entry is submitted to the GRPC endpoint, the Grafana log viewer will spin for a while before displaying an error message:
Error message as text for search purposes:
Additional Context
No response
The text was updated successfully, but these errors were encountered: