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

Wrap component opts for exporter and processor #2825

Closed
wants to merge 2 commits into from

Conversation

punya
Copy link
Member

@punya punya commented Mar 26, 2021

Fixes #2787
Fixes #2788

@punya punya force-pushed the wrap-component-opts branch from a84536e to fd0a682 Compare March 26, 2021 20:19
@punya punya force-pushed the wrap-component-opts branch from fd0a682 to b350d8d Compare March 26, 2021 20:26
func WithShutdown(shutdown componenthelper.Shutdown) Option {
return func(o *baseSettings) {
o.componentOptions = append(o.componentOptions, componenthelper.WithShutdown(shutdown))
o.componentOptions = append(o.componentOptions, opts...)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to call append here or overwrite?

Copy link
Member Author

Choose a reason for hiding this comment

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

I chose append on purpose, but I don't have a strong preference.

Copy link
Member

@bogdandrutu bogdandrutu Mar 26, 2021

Choose a reason for hiding this comment

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

what was the reasoning?

Copy link
Member Author

Choose a reason for hiding this comment

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

If a piece of code configures startup and shutdown options far apart for any reason, the append approach gives them a way forward (because they can replace WithStart -> WithComponentOptions(c.WithStart) etc.) rather than forcing them to pull the two calls close together. As I said, it's not a big deal either way.

@punya
Copy link
Member Author

punya commented Mar 26, 2021

Is this change actually worth making?

Pros:

  • avoid repetition in core code
  • make it easy to add future options that affect all components

Cons:

  • callers (i.e. authors of processors/exporters) have to deal with more verbosity
  • callers have to import and understand an additional package

I suggest that we decline this PR and WONTFIX the two issues.

@codecov
Copy link

codecov bot commented Mar 26, 2021

Codecov Report

Merging #2825 (637e605) into main (d9b2c4b) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2825      +/-   ##
==========================================
- Coverage   91.77%   91.77%   -0.01%     
==========================================
  Files         281      281              
  Lines       15131    15129       -2     
==========================================
- Hits        13886    13884       -2     
  Misses        852      852              
  Partials      393      393              
Impacted Files Coverage Δ
exporter/exporterhelper/common.go 100.00% <100.00%> (ø)
exporter/jaegerexporter/exporter.go 94.80% <100.00%> (+0.13%) ⬆️
exporter/kafkaexporter/factory.go 100.00% <100.00%> (ø)
exporter/loggingexporter/logging_exporter.go 96.40% <100.00%> (ø)
exporter/opencensusexporter/factory.go 100.00% <100.00%> (ø)
exporter/otlpexporter/factory.go 85.29% <100.00%> (ø)
exporter/prometheusremotewriteexporter/factory.go 100.00% <100.00%> (ø)
processor/memorylimiter/factory.go 100.00% <100.00%> (ø)
processor/processorhelper/processor.go 100.00% <100.00%> (ø)

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 d9b2c4b...637e605. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 3, 2021

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Apr 3, 2021
@bogdandrutu bogdandrutu removed the Stale label Apr 6, 2021
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Apr 14, 2021
@punya
Copy link
Member Author

punya commented Apr 14, 2021

Closing because a) this doesn't seem high priority and b) we couldn't come to a conclusion on which API is better.

@punya punya closed this Apr 14, 2021
@punya punya deleted the wrap-component-opts branch April 14, 2021 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants