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

Minimum changes to component.Host, to allow split of the component package #6553

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

bogdandrutu
Copy link
Member

@bogdandrutu bogdandrutu commented Nov 15, 2022

This is the first step towards moving the [Receiver|Processor|Exporter|Extension] specific parts of the components package to its corresponding packages as defined in #6578. For that, we need to remove the component.Host dependency on component.Exporter and component.Extension.

Since component.[Exporter|Receiver|Processor] are useless interface given that we component.[Traces|Metrics|Log][Exporter|Receiver|Processor] exist, they can be simply removed.

component.Extension should not be removed, but GetExtensions() method of component.Host interface has to be changed to component.Host.GetExtensions() map[component.ID]component.Component to remove dependency on component.Extension. In this PR, it's done through aliasing, so it's not a breaking change. But, later, we will need to remove the aliasing, so make sure to update your implementations of component.Host.GetExtensions() from

component.Host.GetExtensions() map[component.ID]component.Extension

to

component.Host.GetExtensions() map[component.ID]component.Component

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.

Just one question, one way I could imagine doing this gracefully is by providing a new HostWithComponent interface and deprecating Host in favour of it, any thoughts?

component/componenttest/nop_host.go Show resolved Hide resolved
@bogdandrutu
Copy link
Member Author

@codeboten the idea behind this draft PR was mostly to agree on the path forward that it is possible to split component as I proposed initially, if we do this change (if we are ok with the result). We can debate how to get there, but important is the part that we have a path forward for the split of component, and I showed that in #6552

@codeboten
Copy link
Contributor

@codeboten the idea behind this draft PR was mostly to agree on the path forward that it is possible to split component as I proposed initially, if we do this change (if we are ok with the result). We can debate how to get there, but important is the part that we have a path forward for the split of component, and I showed that in #6552

I'm ok with this plan, assuming others are as well. I think the changes to Host are minimal enough and help us untangle all the other components into more meaningful packages. I'm in favour of #6552

@bogdandrutu bogdandrutu force-pushed the draftminhost branch 2 times, most recently from efa0d4d to 6906dc2 Compare November 17, 2022 21:52
@bogdandrutu bogdandrutu marked this pull request as ready for review November 17, 2022 21:52
@bogdandrutu bogdandrutu requested review from a team and codeboten November 17, 2022 21:52
@codecov
Copy link

codecov bot commented Nov 17, 2022

Codecov Report

Base: 90.94% // Head: 90.91% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (fed87b8) compared to base (86d886c).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6553      +/-   ##
==========================================
- Coverage   90.94%   90.91%   -0.04%     
==========================================
  Files         241      241              
  Lines       14025    14077      +52     
==========================================
+ Hits        12755    12798      +43     
- Misses       1021     1027       +6     
- Partials      249      252       +3     
Impacted Files Coverage Δ
component/exporter.go 96.07% <ø> (ø)
component/extension.go 86.66% <ø> (ø)
component/processor.go 96.07% <ø> (ø)
component/receiver.go 96.07% <ø> (ø)
component/componenttest/nop_host.go 100.00% <100.00%> (ø)
config/configauth/configauth.go 100.00% <100.00%> (ø)
exporter/exporterhelper/queued_retry.go 95.23% <100.00%> (ø)
receiver/scraperhelper/scrapercontroller.go 89.28% <100.00%> (ø)
service/extensions/extensions.go 82.97% <100.00%> (ø)
service/host.go 100.00% <100.00%> (ø)
... and 5 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.

@dmitryax
Copy link
Member

Do we to remove component.Exporter and component.Extension only? What about component.Receiver and component.Processor?

@bogdandrutu
Copy link
Member Author

Do we to remove component.Exporter and component.Extension only? What about component.Receiver and component.Processor?

Extension is the only one that needs to stay as a type.

@bogdandrutu bogdandrutu force-pushed the draftminhost branch 2 times, most recently from 943c008 to 0ef1531 Compare November 17, 2022 22:38
@dmitryax
Copy link
Member

Extension is the only one that needs to stay as a type

Can you please point me to why? I'm not sure splitting component package justifies removing only component.Exporter and leaving others as is

@bogdandrutu
Copy link
Member Author

Can you please point me to why? I'm not sure splitting component package justifies removing only component.Exporter and leaving others as is

Not sure I understand, I said that only "Extension" needs to stay as a type since we don't have a TracesExtension, all the other will go, as you see in the PR.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
@bogdandrutu bogdandrutu changed the title Draft minimum changes to component.Host Minimum changes to component.Host, to allow split of the component package Nov 18, 2022
Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

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

Could you also please provide some reasoning behind this change in the PR description

.chloggen/draftminhost.yaml Outdated Show resolved Hide resolved
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
@bogdandrutu bogdandrutu merged commit aaaa356 into open-telemetry:main Nov 18, 2022
@bogdandrutu bogdandrutu deleted the draftminhost branch November 18, 2022 17:44
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