Skip to content

[chore] [pdata] Avoid allocations when copy oneOf fields #13291

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmitryax
Copy link
Member

Similar to #13290, for oneOf fields

@dmitryax dmitryax requested review from bogdandrutu and a team as code owners June 28, 2025 18:03
@dmitryax dmitryax changed the title [chore] [pdata] Avoid an allocation when copy oneOf fields [chore] [pdata] Avoid allocations when copy oneOf fields Jun 28, 2025
Copy link

codecov bot commented Jun 28, 2025

Codecov Report

Attention: Patch coverage is 79.66102% with 12 lines in your changes missing coverage. Please review.

Project coverage is 91.57%. Comparing base (6746dda) to head (7b4c926).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pdata/pmetric/generated_exemplar.go 50.00% 6 Missing ⚠️
pdata/pmetric/generated_numberdatapoint.go 50.00% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (79.66%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13291      +/-   ##
==========================================
- Coverage   91.64%   91.57%   -0.07%     
==========================================
  Files         522      522              
  Lines       29111    29146      +35     
==========================================
+ Hits        26678    26691      +13     
- Misses       1919     1938      +19     
- Partials      514      517       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmitryax
Copy link
Member Author

contrib tests are fixed in open-telemetry/opentelemetry-collector-contrib#40978

@dmathieu
Copy link
Member

Should the new code path be tested?

@dmitryax
Copy link
Member Author

It's actually already covered. We just don't test every option for the primitive oneOf's. In copyOrigExemplar, we cover otlpmetrics.Exemplar_AsInt case. In copyOrigNumberDataPoint, we cover otlpmetrics.NumberDataPoint_AsDouble

@dmitryax dmitryax force-pushed the avoid-allocation-oneoff branch from 7e003ca to 7b4c926 Compare June 30, 2025 15:22
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.

2 participants