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

[pdata] Do not wrap orig fields when it's not required #7081

Merged
merged 1 commit into from
Jan 30, 2023

Conversation

dmitryax
Copy link
Member

This change simplifies the generated pdata code to not wrap orig fields in the internal package for structs that are not being used by other packages.

The code generator is adjusted to generate wrapped or unwrapped code only for structs that need it based on the package name. The only exception is Slice struct that was pulled from the generator because:

  • We don't have and don't expect any new slices used by other packages.
  • The Slice struct has two additional methods AsRaw and FromRaw which are not generated and defined in a separate file which is a bit confusing.

This simplification is also needed for #6794 PoCs

@dmitryax dmitryax requested review from a team and jpkrohling January 30, 2023 18:35
@dmitryax dmitryax added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 30, 2023
@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

Base: 89.86% // Head: 89.33% // Decreases project coverage by -0.54% ⚠️

Coverage data is based on head (9efb7d5) compared to base (6896a37).
Patch coverage: 97.66% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7081      +/-   ##
==========================================
- Coverage   89.86%   89.33%   -0.54%     
==========================================
  Files         245      239       -6     
  Lines       14721    13989     -732     
==========================================
- Hits        13229    12497     -732     
  Misses       1221     1221              
  Partials      271      271              
Impacted Files Coverage Δ
pdata/internal/generated_wrapper_common.go 100.00% <ø> (ø)
pdata/plog/plogotlp/response.go 12.50% <0.00%> (ø)
pdata/pmetric/pmetricotlp/response.go 12.50% <0.00%> (ø)
pdata/ptrace/ptraceotlp/response.go 12.50% <0.00%> (ø)
pdata/plog/generated_logs.go 97.74% <97.27%> (-0.10%) ⬇️
pdata/ptrace/generated_traces.go 97.89% <97.44%> (-0.10%) ⬇️
pdata/pmetric/generated_metrics.go 96.68% <98.03%> (-0.15%) ⬇️
pdata/internal/wrapper_common.go 100.00% <100.00%> (ø)
pdata/pcommon/common.go 95.05% <100.00%> (+0.60%) ⬆️
pdata/pcommon/generated_common.go 100.00% <100.00%> (ø)
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

This change simplifies the generated pdata code to not wrap orig fields in the internal package for structs that are not being used by other packages.

The code generator is adjusted to generate wrapped or unwrapped code for only for structs that need it based on the package name. The only exception is `Slice` struct that was pulled from the generator because:
- We don't have and don't expect to have any new slices that are used by other packages.
- The `Slice` struct have two additional methods `AsRaw` and `FromRaw` that are not generated and defined in a separate file which is a bit confusing.
@bogdandrutu bogdandrutu merged commit de4867f into open-telemetry:main Jan 30, 2023
@dmitryax dmitryax deleted the simplify-pdata branch January 31, 2023 02:39
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.

2 participants