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

Split component into its own module #6187

Closed
Tracked by #5992
jpkrohling opened this issue Sep 29, 2022 · 7 comments · Fixed by #6543
Closed
Tracked by #5992

Split component into its own module #6187

jpkrohling opened this issue Sep 29, 2022 · 7 comments · Fixed by #6543

Comments

@jpkrohling
Copy link
Member

jpkrohling commented Sep 29, 2022

From @bogdandrutu:

One question is if we want to have this package OR move everything into go.opentelemetry.io/collector/CMP (where CMP is one of receiver/processor/exporter/extension).

@jpkrohling jpkrohling changed the title component. One question is if we want to have this package OR move everything into go.opentelemetry.io/collector/CMP (where CMP is one of receiver/processor/exporter/extension). Split component into its own module Sep 29, 2022
@codeboten
Copy link
Contributor

is there an agreement on how to proceed with this split? I guess if we were to split all the type specific stuff out of component, we'd end up with some amount of repetition in the name:

import "go.opentelemetry.io/collector/exporter"

exporter.ExporterFactory
exporter.Exporter
exporter.TracesExporter

instead of what it is currently:

import "go.opentelemetry.io/collector/component"

component.ExporterFactory
component.Exporter
component.TracesExporter

It would be possible to remove some of that repetition, but I'm not sure what we would call the TracesExporter for example to make it less repetitive. I do like having the components packages separated per type to only include what's relevant in each one, and reduce the amount of code imported for each one.

@open-telemetry/collector-approvers any thoughts?

@Aneurysm9
Copy link
Member

We could eliminate a bunch of that repetition in the per-component case, I think:

import "go.opentelemetry.io/collector/exporter"

exporter.Factory
exporter.Exporter
exporter.Traces

Not sure that there's a better name for exporter.Exporter, but url.URL exists and the world hasn't come to an end. v0v

@codeboten
Copy link
Contributor

Some observations after digging into this a bit further while trying to split exporter out of component:

  1. making component.Exporter an alias to exporter.Exporter causes a circular dependency since exporter.Exporter depends on component
  2. this lead me down the road to split the minimum of component first and lead me to the next bump in the road
  3. splitting exporter/extension from component means handling the circular dependency on Host which currently uses Extension and Exporter

Thoughts?

@dmitryax
Copy link
Member

dmitryax commented Nov 7, 2022

I don't believe we can move things from component to go.opentelemetry.io/collector/[receiver|processor|exporter|extension] at least because of component.Host. I'm not 100% sure we need to extract those parts from component, but, if we want to, maybe we can have the following packages instead:

go.opentelemetry.io/collector/component/exporter
go.opentelemetry.io/collector/component/receiver
go.opentelemetry.io/collector/component/processor
go.opentelemetry.io/collector/component/extention
go.opentelemetry.io/collector/component/host

And it's not that simple, we will also need to move other things (like component.Kind/Component) since there are interdependencies with Host.

@codeboten
Copy link
Contributor

After further digging into this, the Host complication makes the split per component impractical. My plan is to keep component as a single package containing the different component types within it.

codeboten pushed a commit to codeboten/opentelemetry-collector that referenced this issue Nov 10, 2022
codeboten pushed a commit to codeboten/opentelemetry-collector that referenced this issue Nov 10, 2022
codeboten pushed a commit to codeboten/opentelemetry-collector that referenced this issue Nov 14, 2022
codeboten pushed a commit to codeboten/opentelemetry-collector that referenced this issue Nov 15, 2022
codeboten pushed a commit to codeboten/opentelemetry-collector that referenced this issue Nov 15, 2022
@bogdandrutu
Copy link
Member

I made a prototype, and I think it is simple to do the split, see #6552

The main idea behind is that Host depends on "Extension" and "Exporter" interfaces which are useless anyway, they can be replaced by using Component (since they are simple renames for Component anyway), something like #6553

codeboten pushed a commit that referenced this issue Nov 15, 2022
@dmitryax
Copy link
Member

I submitted a follow-up issue for the split suggested by @bogdandrutu #6578

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants