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

Unnecessary call to config.Validate during component's initialization #33498

Open
rogercoll opened this issue Jun 11, 2024 · 1 comment
Open

Comments

@rogercoll
Copy link
Contributor

Component(s)

exporter/dataset, exporter/elasticsearch, exporter/opensearch, receiver/dockerstats, receiver/podman

Describe the issue you're reporting

All collector's components must implement the component.ValidateConfig interface. During collector's startup, it goes through all components and calls the Validate method. Its execution is finished if any component returns an error. Nonetheless, some components call the Validate method during its initialization, which is redundant taking into account the collector life cycle. (e.g. Podman receiver)

I think that the Validate interface should be called by the configuration validator consumer (e.g. collector) instead of the configuration producers (components).

Context for Podman's receiver: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/32981/files#r1621849257

I linked to this issue the components that seems to be internally calling the configuration Validate method. I would not say calling Validate is forbidden, just that might be redundant during collector's execution. However, feel free to unlink your component from this issue if the Validate method call is necessary for your specific use case or if it performs additional checks that are not covered during the startup validation phase.

Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

mx-psi pushed a commit that referenced this issue Jun 24, 2024
**Description:** This PR is upgrading dataset-go to version v0.19.0 -
https://github.com/scalyr/dataset-go/releases/tag/v0.19.0

This PR is also fixing:
* #33498 - config validation is not called during conversion, therefore
I had to remove tests from logs and trace exporter. These tests are now
moved to the factory.
* #32533 - fixing failing integration tests, that were never updated and
therefore the configuration contained invalid values

**Link to tracking Issue:** #33498, #32533, #33675

**Testing:** Unit tests and integration tests.

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

fixes #32533

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Curtis Robert <crobert@splunk.com>
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
Co-authored-by: Ishan Shanware <shanware.ishan@gmail.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Paulo Janotti <pjanotti@splunk.com>
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
Co-authored-by: Rong Hu <hardproblems@users.noreply.github.com>
tomasmota pushed a commit to SpringerPE/opentelemetry-collector-contrib that referenced this issue Jul 1, 2024
…try#33675)

**Description:** This PR is upgrading dataset-go to version v0.19.0 -
https://github.com/scalyr/dataset-go/releases/tag/v0.19.0

This PR is also fixing:
* open-telemetry#33498 - config validation is not called during conversion, therefore
I had to remove tests from logs and trace exporter. These tests are now
moved to the factory.
* open-telemetry#32533 - fixing failing integration tests, that were never updated and
therefore the configuration contained invalid values

**Link to tracking Issue:** open-telemetry#33498, open-telemetry#32533, open-telemetry#33675

**Testing:** Unit tests and integration tests.

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

fixes open-telemetry#32533

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Curtis Robert <crobert@splunk.com>
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
Co-authored-by: Ishan Shanware <shanware.ishan@gmail.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Paulo Janotti <pjanotti@splunk.com>
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
Co-authored-by: Rong Hu <hardproblems@users.noreply.github.com>
andrzej-stencel added a commit that referenced this issue Jul 11, 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 Podman's receiver start function.

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

#33498

Context:
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/32981/files#r1621849257

**Testing:** <Describe what testing was performed and which tests were
added.>
Tests moved to the `config_test.go` file following the testdata
strategy.

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

---------

Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this issue Jul 11, 2024
…try#33675)

**Description:** This PR is upgrading dataset-go to version v0.19.0 -
https://github.com/scalyr/dataset-go/releases/tag/v0.19.0

This PR is also fixing:
* open-telemetry#33498 - config validation is not called during conversion, therefore
I had to remove tests from logs and trace exporter. These tests are now
moved to the factory.
* open-telemetry#32533 - fixing failing integration tests, that were never updated and
therefore the configuration contained invalid values

**Link to tracking Issue:** open-telemetry#33498, open-telemetry#32533, open-telemetry#33675

**Testing:** Unit tests and integration tests.

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

fixes open-telemetry#32533

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Curtis Robert <crobert@splunk.com>
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
Co-authored-by: Ishan Shanware <shanware.ishan@gmail.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Paulo Janotti <pjanotti@splunk.com>
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
Co-authored-by: Rong Hu <hardproblems@users.noreply.github.com>
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this issue Jul 11, 2024
…y#33555)

**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 Podman's receiver start function.

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

open-telemetry#33498

Context:
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/32981/files#r1621849257

**Testing:** <Describe what testing was performed and which tests were
added.>
Tests moved to the `config_test.go` file following the testdata
strategy.

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

---------

Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant