Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[otlp] Change serialization of null protobuf values #6149

Merged

Conversation

matt-hensley
Copy link
Contributor

@matt-hensley matt-hensley commented Feb 21, 2025

Fixes #6138

Changes

The OTLP exporter generated protobuf payloads that Loki cannot consume when attributes contained null values.

PR extends TagWriter to include TryWriteEmptyTag method. When a null value is encountered, TryWriteEmptyTag is called in tag writer implementations instead of only returning false.

Tag writers for console, OTLP, and Zipkin exporters have new TryWriteEmptyTag implementations

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions bot added pkg:OpenTelemetry.Exporter.Console Issues related to OpenTelemetry.Exporter.Console NuGet package pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package pkg:OpenTelemetry.Exporter.Zipkin Issues related to OpenTelemetry.Exporter.Zipkin NuGet package pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package labels Feb 21, 2025
@rajkumar-rangaraj
Copy link
Contributor

rajkumar-rangaraj commented Feb 22, 2025

@matt-hensley Changes looks good to me, this should solve the issue. Please update the changelog.

@matt-hensley matt-hensley marked this pull request as ready for review February 22, 2025 15:23
@matt-hensley matt-hensley requested a review from a team as a code owner February 22, 2025 15:23
Co-authored-by: Rajkumar Rangaraj <[email protected]>
@rajkumar-rangaraj rajkumar-rangaraj merged commit 7b076c6 into open-telemetry:main Feb 25, 2025
49 checks passed
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.36%. Comparing base (0aba0cd) to head (0a0dca9).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #6149   +/-   ##
=======================================
  Coverage   86.36%   86.36%           
=======================================
  Files         257      257           
  Lines       11574    11574           
=======================================
  Hits         9996     9996           
  Misses       1578     1578           
Files with missing lines Coverage Δ
...xporter.Console/Implementation/ConsoleTagWriter.cs 11.11% <ø> (ø)
...Implementation/Serializer/ProtobufOtlpTagWriter.cs 95.45% <ø> (ø)
....Exporter.Zipkin/Implementation/ZipkinTagWriter.cs 63.63% <ø> (ø)

@Kielek Kielek mentioned this pull request Feb 25, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:OpenTelemetry.Exporter.Console Issues related to OpenTelemetry.Exporter.Console NuGet package pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package pkg:OpenTelemetry.Exporter.Zipkin Issues related to OpenTelemetry.Exporter.Zipkin NuGet package pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Null attributes not serialized to protobuf correctly, breaking Loki
2 participants