Skip to content

[chore] Do not introduce pointers in the deprecated batcher fields #12496

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

Closed

Conversation

dmitryax
Copy link
Member

@dmitryax dmitryax commented Feb 26, 2025

Do not introduce an unnecessary Go API breaking change.

Fixes contrib tests.

A follow-up to #12486.

Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.18%. Comparing base (8099e51) to head (166e662).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
exporter/exporterhelper/internal/base_exporter.go 0.00% 0 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (80.00%) 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   #12496      +/-   ##
==========================================
+ Coverage   92.15%   92.18%   +0.02%     
==========================================
  Files         465      465              
  Lines       25183    25183              
==========================================
+ Hits        23208    23214       +6     
+ Misses       1576     1572       -4     
+ Partials      399      397       -2     

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

@@ -70,7 +70,7 @@ func NewBaseExporter(set exporter.Settings, signal pipeline.Signal, options ...O
}

//nolint: staticcheck
if be.batcherCfg.MinSizeItems != nil || be.batcherCfg.MaxSizeItems != nil {
if be.batcherCfg.MinSizeItems != 0 || be.batcherCfg.MaxSizeItems != 0 {
Copy link
Member Author

Choose a reason for hiding this comment

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

Potentially, we could update the Unmarshal func to set a private field indicating whether min/max_size_items were set, but that would require moving/aliasing the exporterbatcher.Config in some internal module along with a function showing this warning. I could do that separately.

Do not introduce an unnecessary Go API breaking change
@dmitryax dmitryax force-pushed the avoid-int-pointer-changes branch from ec3b179 to 166e662 Compare February 26, 2025 08:24
if c.MinSizeItems != nil {
c.SizeConfig.MinSize = *c.MinSizeItems
if conf.IsSet("min_size_items") {
c.SizeConfig.MinSize = c.MinSizeItems
Copy link
Contributor

@jade-guiton-dd jade-guiton-dd Feb 26, 2025

Choose a reason for hiding this comment

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

Not directly related to the PR, but the deprecation comment says that min_size_items is "ignored if SizeConfig is set". Doesn't this code do the opposite, ie. ignore SizeConfig if min/max_size_items are set?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I can submit another PR to address this

Copy link
Member Author

Choose a reason for hiding this comment

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

Submitted #12502

@dmitryax
Copy link
Member Author

Some contrib tests still needs to be updated. So maybe it's ok to switch to pointers to keep it simple. I'll proceed with open-telemetry/opentelemetry-collector-contrib#38214

@dmitryax dmitryax marked this pull request as draft February 26, 2025 17:27
@dmitryax dmitryax closed this Feb 26, 2025
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