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

[baggage] Remove unused private field #4318

Merged

Conversation

yurishkuro
Copy link
Member

There was no way to create a valid property with hasData=false, so the field is not necessary.

Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jul 15, 2023
@codecov
Copy link

codecov bot commented Jul 15, 2023

Codecov Report

Merging #4318 (e1dd61d) into main (3904523) will decrease coverage by 0.1%.
The diff coverage is 100.0%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #4318     +/-   ##
=======================================
- Coverage   78.9%   78.9%   -0.1%     
=======================================
  Files        254     254             
  Lines      20650   20646      -4     
=======================================
- Hits       16307   16303      -4     
  Misses      3998    3998             
  Partials     345     345             
Files Changed Coverage Δ
baggage/baggage.go 98.9% <100.0%> (-0.1%) ⬇️

@MrAlias
Copy link
Contributor

MrAlias commented Jul 16, 2023

The following will create a Property with hasData=false:

var p Property

@yurishkuro
Copy link
Member Author

var p Property

which would still be invalid because of empty key, and validity is the only thing hasData field impacts

Copy link
Contributor

@MadVikingGod MadVikingGod left a comment

Choose a reason for hiding this comment

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

I support this change.

We have the hasData to fail fast if the property key is empty. But all property keys require at least one character. This is used ultimately in NewMember. This is thus a CPU optimization for the failure case, but adds memory cost for all cases. If we wanted to keep the same error messages, we could do a length check on the key or check if it is empty.

Note: this doesn't apply to Values that can be empty, so we need some way to check if it has been set.

@pellared
Copy link
Member

@MrAlias Can you take another look?

@MadVikingGod MadVikingGod merged commit 14b3a98 into open-telemetry:main Aug 15, 2023
@XSAM XSAM added this to the Old Untracked PRs milestone Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants