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

BreakingChange: Change to use interface instead of func for MapConverter #5382

Merged
merged 1 commit into from
May 24, 2022

Conversation

bogdandrutu
Copy link
Member

The main reason to do this, is because if in the future we want to extend the capabilities of the "MapConverter" we don't have any way to do that. By using an interface we can define "optional" interfaces that some converters may implement to enable future improvements.

Signed-off-by: Bogdan Drutu bogdandrutu@gmail.com

@bogdandrutu bogdandrutu requested review from a team and dmitryax May 17, 2022 21:26
@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #5382 (d2e2b10) into main (ab79681) will decrease coverage by 0.05%.
The diff coverage is 88.88%.

@@            Coverage Diff             @@
##             main    #5382      +/-   ##
==========================================
- Coverage   90.75%   90.70%   -0.06%     
==========================================
  Files         190      191       +1     
  Lines       11422    11423       +1     
==========================================
- Hits        10366    10361       -5     
- Misses        837      842       +5     
- Partials      219      220       +1     
Impacted Files Coverage Δ
config/configmap.go 90.09% <ø> (ø)
config/mapconverter.go 0.00% <0.00%> (ø)
config/mapconverter/expandmapconverter/expand.go 100.00% <100.00%> (ø)
...rter/overwritepropertiesmapconverter/properties.go 100.00% <100.00%> (ø)
service/command.go 80.00% <100.00%> (ø)
service/config_provider.go 90.32% <100.00%> (ø)
service/mapresolver.go 93.10% <100.00%> (ø)
pdata/internal/common.go 91.82% <0.00%> (-0.75%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab79681...d2e2b10. Read the comment docs.

@bogdandrutu bogdandrutu force-pushed the mapconverter branch 2 times, most recently from 76aa6d1 to e75acd6 Compare May 17, 2022 23:04
The main reason to do this, is because if in the future we want to extend the capabilities of the "MapConverter" we don't have any way to do that. By using an interface we can define "optional" interfaces that some converters may implement to enable future improvements.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

I prefer the use of an interface as per the change. Is there a way to deprecate the existing converter's New functions before changing them? Otherwise this breaks the "breaking change" policy

Convert(ctx context.Context, cfgMap *Map) error
}

// Deprecated: Implement MapConverter interface.
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing version

@bogdandrutu
Copy link
Member Author

bogdandrutu commented May 19, 2022

Otherwise this breaks the "breaking change" policy

Indeed that's why it is called "braking change" and not deprecation, we need @open-telemetry/collector-approvers to say they are ok with this.

@bogdandrutu
Copy link
Member Author

New functions before changing them

The result of the New function is only (I haven't seen any other way) used in the "converters" slice of service.ConfigProvider. So this will not be that disruptive for users, the most annoying will be if they implement converters by themselves...

@dmitryax
Copy link
Member

I'm Ok with accepting this exception. This API doesn't seem to be widely adopted at this point

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

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

I am OK with the change.

@bogdandrutu
Copy link
Member Author

@codeboten ptal

@codeboten codeboten merged commit 82d9252 into open-telemetry:main May 24, 2022
@bogdandrutu bogdandrutu deleted the mapconverter branch May 25, 2022 15:59
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.

4 participants