Skip to content

Conversation

@Reneg973
Copy link
Contributor

@Reneg973 Reneg973 commented Oct 26, 2025

Fixes # (issue)
none

Changes

  • prevent superfluous copy in construction of OwnedAttributeValue with std::string or span
  • combined identical lambdas of both constructors
  • use const-ref
  • removed unneeded (stateless) members

Regarding the 2 constructors, IMO the pointer constructor is superfluous. Unfortunately it is being referenced already. So I'm not sure whether it's allowed to remove it.

Details:

  • const std::vector<T> copy(vals.begin(), vals.end()); this const prevents from moving
  • removing stateless members reduces sizeof(class)

@Reneg973 Reneg973 requested a review from a team as a code owner October 26, 2025 10:31
@codecov
Copy link

codecov bot commented Oct 26, 2025

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.00%. Comparing base (3efc14b) to head (2f4ccee).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...include/opentelemetry/sdk/common/attribute_utils.h 91.67% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3716      +/-   ##
==========================================
+ Coverage   89.95%   90.00%   +0.06%     
==========================================
  Files         225      225              
  Lines        7103     7099       -4     
==========================================
  Hits         6389     6389              
+ Misses        714      710       -4     
Files with missing lines Coverage Δ
...include/opentelemetry/sdk/common/attribute_utils.h 98.81% <91.67%> (+4.50%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 once the formatting issue is resolved

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 cleanup

@marcalff marcalff changed the title fixed some code flaws [SDK] Misc cleanup in attribute_utils.h Oct 26, 2025
@marcalff
Copy link
Member

@Reneg973

See clang-format, there is an extra blank line that needs to be removed.

Will merge after that, congratulations on your first merged PR.

- prevent superfluous copy in construction of OwnedAttributeValue with std::string or span
- combined identical lambdas of both lamdas
- use const-ref
- removed unneeded (stateless) members
@marcalff marcalff merged commit d882c6b into open-telemetry:main Oct 28, 2025
67 checks passed
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.

3 participants