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

chore: remove config Validate call in docker #34699

Merged
merged 12 commits into from
Aug 28, 2024

Conversation

rogercoll
Copy link
Contributor

Description:

Configuration validation is done during collector's startup, making it redundant when being called inside component's logic. This PR removes the Validate call done during Dockers's receiver start function.

Link to tracking Issue:
#33498

Testing:
No testing needed to be modified as the Validate functionality is already covered.

Documentation:

@rogercoll
Copy link
Contributor Author

Skip changelog?

@rogercoll rogercoll marked this pull request as ready for review August 15, 2024 07:45
@rogercoll rogercoll requested a review from a team August 15, 2024 07:45
Comment on lines -59 to -64
if config.Endpoint == "" {
return errors.New("config.Endpoint must be specified")
}
if err := VersionIsValidAndGTE(config.DockerAPIVersion, minimumRequiredDockerAPIVersion); err != nil {
return err
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is already being validated by each components Validate:

func (config Config) Validate() error {

@rogercoll
Copy link
Contributor Author

cc @mx-psi

@mx-psi mx-psi added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Aug 16, 2024
@mx-psi mx-psi self-requested a review August 16, 2024 09:26
@rogercoll rogercoll force-pushed the remove_validate_call_docker branch from 3d6a7e9 to 6dfd875 Compare August 21, 2024 09:25
return err
}
return nil

if len(config.ExcludedImages) == 0 {
Copy link
Contributor

@MovieStoreGuy MovieStoreGuy Aug 28, 2024

Choose a reason for hiding this comment

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

I am not certain this is strictly needed, zero and empty lists are effectively the same when iterating over them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, I added this check to keep the PR nop. The component's configuration test expect a nil list but the inner Unmarshal is now returning an empty one. If prefered, I can readapt the test to assert an empty list.

@mx-psi
Copy link
Member

mx-psi commented Aug 28, 2024

@rogercoll can you fix CI? we can merge after that

@rogercoll
Copy link
Contributor Author

@rogercoll can you fix CI? we can merge after that

@mx-psi Fixed 👍 Thanks for the heads up

@mx-psi mx-psi merged commit ee7be8b into open-telemetry:main Aug 28, 2024
156 checks passed
@github-actions github-actions bot added this to the next release milestone Aug 28, 2024
@rogercoll rogercoll deleted the remove_validate_call_docker branch August 28, 2024 08:58
f7o pushed a commit to f7o/opentelemetry-collector-contrib that referenced this pull request Sep 12, 2024
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Configuration validation is done during collector's startup, making it
redundant when being called inside component's logic. This PR removes
the Validate call done during Dockers's receiver start function.

**Link to tracking Issue:** <Issue number if applicable>

open-telemetry#33498

**Testing:** <Describe what testing was performed and which tests were
added.>
No testing needed to be modified as the `Validate` functionality is
already covered.

**Documentation:** <Describe the documentation added.>

---------

Co-authored-by: Sean Marciniak <30928402+MovieStoreGuy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants