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

[extension] Error out if passed extension.Settings has incorrect type #12305

Merged
merged 8 commits into from
Feb 7, 2025

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Feb 6, 2025

Description

Explicitly error out if the passed component.ID does not have a matching component.Type

Link to tracking issue

Updates #12221

@mx-psi mx-psi requested a review from bogdandrutu February 6, 2025 10:51
@mx-psi mx-psi requested a review from dmitryax as a code owner February 6, 2025 11:07
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.39%. Comparing base (7d603aa) to head (5897f4e).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12305      +/-   ##
==========================================
- Coverage   91.41%   91.39%   -0.03%     
==========================================
  Files         467      468       +1     
  Lines       25583    25598      +15     
==========================================
+ Hits        23387    23395       +8     
- Misses       1778     1787       +9     
+ Partials      418      416       -2     

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

Comment on lines +41 to +42
set := extensiontest.NewNopSettings()
set.ID = component.NewID(factory.Type())
Copy link
Member

Choose a reason for hiding this comment

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

Should we switch extensiontest.NewNopSettings() to accept a type? Also we can generate a helper like metadatatest.NewNopSettings for components that calls the extensiontest but passes the type

Copy link
Member Author

Choose a reason for hiding this comment

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

Added extensiontest.NewNopSettingsWithType, PTAL!

@bogdandrutu bogdandrutu added this pull request to the merge queue Feb 7, 2025
Merged via the queue into open-telemetry:main with commit 183d7ed Feb 7, 2025
51 of 54 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Feb 11, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes `"go.opentelemetry.io/collector/component"` to be always
present to create component type:
```
var typ = component.MustNewType("{{ .Type }}")
```

cc @mx-psi 
<!-- Issue number if applicable -->
#### Link to tracking issue
Relevant to #12305 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
n/a

<!--Describe the documentation added.-->
#### Documentation
n/a

<!--Please delete paragraphs that you did not use before submitting.-->
github-merge-queue bot pushed a commit that referenced this pull request Feb 11, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->

Deprecate `Create*` methods. This is a small part of #12305, but applied
to all other component kinds

#### Link to tracking issue
Updates #12221
github-merge-queue bot pushed a commit that referenced this pull request Feb 13, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->

Creates `NewNopSettingsWithType` function on test modules and deprecates
the `NewNopSettings` functions on those modules. Replace all usages of
`NewNopSettings` with `NewNopSettingsWithType`.

Part of #12305 but applied to all component kinds.

#### Link to tracking issue
Updates #12221
mx-psi added a commit to mx-psi/opentelemetry-collector that referenced this pull request Feb 14, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->

Creates `NewNopSettingsWithType` function on test modules and deprecates
the `NewNopSettings` functions on those modules. Replace all usages of
`NewNopSettings` with `NewNopSettingsWithType`.

Part of open-telemetry#12305 but applied to all component kinds.

#### Link to tracking issue
Updates open-telemetry#12221
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->

Remove deprecated symbols

#### Link to tracking issue
Updates #12222, #12305, #11524
mx-psi pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Feb 20, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Remove `NewNopSettings` introduced recently cc @mx-psi 

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry/opentelemetry-collector#12305

<!--Describe what testing was performed and which tests were added.-->
#### Testing
n/a

<!--Describe the documentation added.-->
#### Documentation
n/a

<!--Please delete paragraphs that you did not use before submitting.-->
github-merge-queue bot pushed a commit that referenced this pull request Feb 21, 2025
…NopSettingsWithType` (#12452)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Add `component.Type` parameter to `NewNopSettings` And deprecate
`NewNopSettingsWithType` cc @mx-psi

<!-- Issue number if applicable -->
#### Link to tracking issue
Relevant to #12305 

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

<!--Describe the documentation added.-->
#### Documentation
Added

<!--Please delete paragraphs that you did not use before submitting.-->
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