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

[component] Refactor to use pipeline.ID and pipeline.Signal #11204

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

TylerHelmuth
Copy link
Member

@TylerHelmuth TylerHelmuth commented Sep 17, 2024

Description

Depends on #11209

This PR is a non-breaking implementation of #10947. It adds a new module, pipeline, which houses a pipeline.ID and pipeline.Signal. pipeline.ID is used to identify a pipeline within the service. pipeline.Signal is uses to identify the signal associated to a pipeline.

I do this work begrudgingly. As the PR shows, this is a huge refactor when done in a non-breaking way, will require 3 full releases, and doesn't benefit our End Users or, in my opinion, our Component Developers or Collector Library Users. I view this refactor as a Nice-To-Have, not a requirement for Component 1.0.

Link to tracking issue

Works towards #9429

@TylerHelmuth TylerHelmuth requested review from a team and bogdandrutu September 17, 2024 22:44
@TylerHelmuth TylerHelmuth force-pushed the component-refactor-datatype branch 5 times, most recently from fe90c10 to 1225ae3 Compare September 17, 2024 23:30
Copy link

codecov bot commented Sep 17, 2024

Codecov Report

Attention: Patch coverage is 81.49254% with 62 lines in your changes missing coverage. Please review.

Project coverage is 91.41%. Comparing base (7253ab8) to head (fa074b6).

Files with missing lines Patch % Lines
component/componentstatus/instance.go 45.71% 19 Missing ⚠️
receiver/receivertest/nop_receiver.go 0.00% 8 Missing ⚠️
connector/internal/factory.go 61.11% 7 Missing ⚠️
receiver/receivertest/contract_checker.go 41.66% 7 Missing ⚠️
service/service.go 14.28% 5 Missing and 1 partial ⚠️
service/config.go 37.50% 3 Missing and 2 partials ⚠️
exporter/exporterqueue/queue.go 50.00% 1 Missing and 1 partial ⚠️
service/internal/graph/host.go 88.23% 2 Missing ⚠️
service/pipelines/config.go 84.61% 2 Missing ⚠️
exporter/internal/factory.go 75.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11204      +/-   ##
==========================================
- Coverage   91.80%   91.41%   -0.39%     
==========================================
  Files         424      424              
  Lines       20094    20198     +104     
==========================================
+ Hits        18447    18465      +18     
- Misses       1268     1349      +81     
- Partials      379      384       +5     

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

.chloggen/component-refactor-datatype-2.yaml Show resolved Hide resolved
component/componentprofiles/config.go Show resolved Hide resolved
component/componentstatus/instance.go Show resolved Hide resolved
.chloggen/component-refactor-datatype-6.yaml Outdated Show resolved Hide resolved
cmd/mdatagen/internal/templates/component_test.go.tmpl Outdated Show resolved Hide resolved
exporter/exporterqueue/queue.go Outdated Show resolved Hide resolved
@TylerHelmuth TylerHelmuth requested a review from a team as a code owner September 18, 2024 18:37
@TylerHelmuth TylerHelmuth marked this pull request as draft September 18, 2024 18:37
mx-psi pushed a commit that referenced this pull request Sep 20, 2024
#### Description
To facilitate the work in
#11204 as
some breaking changes and some deprecations, this PR adds the new
pipeline module separately so that future PRs can handle the breaking
changes and deprecations.

In order to make `Signal` uninstantiable outside of this repo, while
still being extendable in places like `componentprofiles`, a new
internal module is added to handle the `Signal` logic. To reduce the
dependency sprawl that would happen if `signal` was an internal package
in `go.opentelemetry.io/collector`, I made it a module, similar to
`globalgates`.

<!-- Issue number if applicable -->
#### Link to tracking issue
Related to
#10947

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests

<!--Describe the documentation added.-->
#### Documentation
Added godoc comments
Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Other than fixing the merge conflicts, this looks good to me

@TylerHelmuth TylerHelmuth marked this pull request as ready for review September 20, 2024 15:44
@TylerHelmuth TylerHelmuth added the release:blocker The issue must be resolved before cutting the next release label Sep 20, 2024
exporter/exporterqueue/queue.go Show resolved Hide resolved
exporter/exportertest/contract_checker.go Show resolved Hide resolved
@@ -153,5 +154,41 @@ func (cfg *Config) Validate() error {
return fmt.Errorf("service::pipelines::%s: references exporter %q which is not configured", pipelineID, ref)
}
}

// Check that all pipelines reference only configured components.
for pipelineID, pipeline := range cfg.Service.PipelinesWithPipelineID {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need a second for loop here?

Copy link
Member Author

@TylerHelmuth TylerHelmuth Sep 20, 2024

Choose a reason for hiding this comment

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

This is a duplicate of the for pipelineID, pipeline := range cfg.Service.Pipelines { loop above it.

I didn't want to handle the merging of cfg.Service.Pipelines into cfg.Service.PipelinesWithPipelineID via the Validate function (it is instead handled in service.initGraph) so I instead opted to validate both cfg.Service.Pipelines and cfg.Service.PipelinesWithPipelineID.

The line above, if err := cfg.Service.Validate(); err != nil, will validate that only one of the 2 is set, so in reality only one of the two for loops is ever entered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:blocker The issue must be resolved before cutting the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants