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

Remove reference to defaultcomponents in core and deprecate include_core flag #4087

Merged

Conversation

JamesJHPark
Copy link
Contributor

@JamesJHPark JamesJHPark commented Sep 21, 2021

Description:
This PR is to remove reference to defaultcomponents in core and deprecate the include_core flag in builder.

Link to tracking Issue:
Issue #3927

@JamesJHPark JamesJHPark requested review from a team and dmitryax September 21, 2021 21:37
@JamesJHPark JamesJHPark changed the title Remove default components from core Remove defaultcomponents from core Sep 22, 2021
Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

This removes a lot of unit tests. Is there a reason they are no longer needed, or should we add them back in in the new location?

@bogdandrutu
Copy link
Member

Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

Got it, thanks.

@alolita alolita added the ready-to-merge Code review completed; ready to merge by maintainers label Sep 24, 2021
.github/workflows/build-and-test.yml Outdated Show resolved Hide resolved
cmd/otelcol/main.go Outdated Show resolved Hide resolved
internal/testcomponents/example_factories.go Outdated Show resolved Hide resolved
@bogdandrutu bogdandrutu removed the ready-to-merge Code review completed; ready to merge by maintainers label Sep 26, 2021
@codecov
Copy link

codecov bot commented Sep 29, 2021

Codecov Report

Merging #4087 (5f9b4e0) into main (42566a6) will decrease coverage by 0.17%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4087      +/-   ##
==========================================
- Coverage   90.67%   90.50%   -0.18%     
==========================================
  Files         179      178       -1     
  Lines       10414    10455      +41     
==========================================
+ Hits         9443     9462      +19     
- Misses        755      776      +21     
- Partials      216      217       +1     
Impacted Files Coverage Δ
cmd/builder/internal/builder/config.go 85.52% <100.00%> (+1.01%) ⬆️
internal/testcomponents/example_factories.go 79.54% <100.00%> (+48.77%) ⬆️
exporter/loggingexporter/known_sync_error.go 0.00% <0.00%> (-80.00%) ⬇️
exporter/loggingexporter/logging_exporter.go 88.04% <0.00%> (-5.44%) ⬇️
receiver/otlpreceiver/otlp.go 76.00% <0.00%> (-3.58%) ⬇️
processor/memorylimiterprocessor/memorylimiter.go 85.32% <0.00%> (-3.27%) ⬇️
config/confighttp/confighttp.go 100.00% <0.00%> (ø)
service/defaultcomponents/defaults.go
exporter/otlphttpexporter/otlp.go 82.92% <0.00%> (+0.87%) ⬆️
exporter/otlpexporter/otlp.go 74.41% <0.00%> (+1.57%) ⬆️

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 42566a6...5f9b4e0. Read the comment docs.

Aneurysm9
Aneurysm9 previously approved these changes Sep 29, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2021

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

…ference to defaultcomponents and extracted otel-config components to a function
@JamesJHPark
Copy link
Contributor Author

JamesJHPark commented Nov 17, 2021

Hi @bogdandrutu, with reference to the discussions, I have made the following changes:


  1. Partially removed dependency on the real components and removed reference to defaultcomponents in tests (exception: cmd/otelcol/main.go file). For discussion, the function call to assertZPages in the test requires zpages extension. To address this, I have extracted the components of testdata/otelcol-config.yaml to a function in testcomponents package. I have also replaced the reference to defaultcomponents with this function in collector_windows_test.go file.
  2. Since the collector-builder and collector-contrib depend on defaultcomponents from the core repository, I have not removed the defaultcomponents package. I have removed the tests in this package as they have already been copied to contrib. 


Please let me know if there may be a recommended approach/fixes to address the issue for next steps. Thank you.

@alolita
Copy link
Member

alolita commented Nov 18, 2021

@Aneurysm9 @codeboten can you pl re-review?

CHANGELOG.md Outdated Show resolved Hide resolved
@jpkrohling
Copy link
Member

As discussed during the SIG meeting today, we need first to get the builder to deprecate/remove the include_core flag, as new distributions will then not have core components in by default. When that flag is set to true, we use the default components, hence the dependency. Contrib might also use the default components, so, that needs changing as well. Once we have a release of the builder out with the new default, we can then merge this.

CHANGELOG.md Outdated Show resolved Hide resolved
cmd/builder/README.md Show resolved Hide resolved
cmd/builder/internal/builder/config.go Show resolved Hide resolved
cmd/builder/internal/builder/templates/components.go.tmpl Outdated Show resolved Hide resolved
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

You might need to set the default value of the flag in DefaultConfig. This would solve your nil pointer error. Also, make sure the distribution is indeed not having the default components, as I believe there might be a change needed in the templates.

cmd/builder/README.md Show resolved Hide resolved
cmd/builder/internal/command.go Outdated Show resolved Hide resolved
@JamesJHPark
Copy link
Contributor Author

JamesJHPark commented Dec 2, 2021

You might need to set the default value of the flag in DefaultConfig. This would solve your nil pointer error. Also, make sure the distribution is indeed not having the default components, as I believe there might be a change needed in the templates.

Thank you for your reply. I have set the default value of the flag in the DefaultConfig to fix the nil pointer dereference issue but the nocore test failed with duplicate components. 
This may be related to dereferencing .Distribution.IncludeCore to a boolean value and to use this value in the pipeline in the go.tmpl file.

I have implemented a suggested approach to include the warn log before unmarshalling the config and the MarkDeprecated flag message with IncludeCore set to bool. Please let me know if these changes may be suitable to achieve the same goals to deprecate the include_core flag.

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

I think those are my final concerns, after this, this will be ready to be merged.

cmd/builder/internal/command.go Outdated Show resolved Hide resolved
internal/testcomponents/example_factories.go Outdated Show resolved Hide resolved
@Aneurysm9 Aneurysm9 added the ready-to-merge Code review completed; ready to merge by maintainers label Dec 8, 2021
@JamesJHPark JamesJHPark changed the title Remove defaultcomponents from core Remove reference to defaultcomponents in core and deprecate include_core flag Dec 8, 2021
@sodabrew
Copy link
Contributor

sodabrew commented Jan 10, 2022

I no longer understand what to put in my builder.yml to get the core modules back, or which ones were default-in that I was relying upon without knowing it. Would appreciate more clarity in the builder's README file on this.

Edit: I copy pastad from this example and now it's working
https://github.com/open-telemetry/opentelemetry-collector/blob/main/cmd/otelcorecol/builder-config.yaml

@jpkrohling
Copy link
Member

jpkrohling commented Jan 11, 2022

I apologize, this change should have been better communicated. This PR brought clarity to the readme: #4664

If you think there's still something we should document elsewhere, let me know.

@sodabrew
Copy link
Contributor

Thank you for the README example improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants