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

[EXPORTER] Support empty arrays in OtlpRecordable attributes #2166

Merged
merged 2 commits into from
May 31, 2023

Conversation

mbrobbel
Copy link
Contributor

Changes

This PR changes behavior for empty array attribute values in OtlpRecordable. Empty array attribute values did not set the AnyValue field to ArrayValue.

However, following the spec it seems we should forward empty arrays.

https://github.com/open-telemetry/opentelemetry-specification/blob/ce2c5946faa9c961ea01d89c7aed83621865b67b/specification/common/README.md?plain=1#L37-L39

Invoking mutable_array_value() before looping over the values sets the AnyValue variant to ArrayValue regardless of the number of items in the iterator.

@mbrobbel mbrobbel requested a review from a team May 31, 2023 10:10
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean PR, thanks.

Please expand the unit tests to cover every data types beside std::vector<int64_t>.

This will help to catch bugs if somehow the fix for other alternatives gets lost, with bad merges.

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Merging #2166 (c6dfea7) into main (8b7f9b4) will decrease coverage by 0.02%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2166      +/-   ##
==========================================
- Coverage   87.17%   87.15%   -0.02%     
==========================================
  Files         166      166              
  Lines        4777     4777              
==========================================
- Hits         4164     4163       -1     
- Misses        613      614       +1     

see 1 file with indirect coverage changes

Copy link
Member

@owent owent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and thanks.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix.

@marcalff marcalff merged commit 0eca570 into open-telemetry:main May 31, 2023
@mbrobbel mbrobbel deleted the empty-arrays branch May 31, 2023 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants