Skip to content

Conversation

@edmocosta
Copy link
Collaborator

Prior to this change, the config validation wasn't being performed by the playground, and invalid configurations (values) were run as it's. This PR changed the config parsing logic to also call the xconfmap.Validator.Validate function, making it closer to a real collector and avoiding running config with invalid values.

@edmocosta edmocosta changed the title Add component config validation Add configuration validation Jan 13, 2026
@edmocosta edmocosta requested a review from Copilot January 13, 2026 13:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds configuration validation to the playground by integrating the xconfmap.Validator.Validate function into the config parsing logic, ensuring invalid configurations are caught before execution rather than being run with invalid values.

Changes:

  • Extracted common unmarshaling and validation logic into a new unmarshalValidConfig function
  • Added validation step that checks if configs implement xconfmap.Validator and calls Validate() if present
  • Added comprehensive test coverage with a mock config type to verify validation behavior

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
internal/config.go Refactored config parsing to extract unmarshalValidConfig function that performs both unmarshaling and validation
internal/config_test.go Added test cases and mock config type to verify validation logic works for both single and multiple configs
go.mod Added dependency on go.opentelemetry.io/collector/confmap/xconfmap package
Makefile Updated Go mod tidy compatibility version from 1.22.0 to 1.24.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@edmocosta edmocosta force-pushed the add-config-validation branch from c2fb7e9 to 44d05d8 Compare January 13, 2026 14:04
@edmocosta edmocosta requested a review from Copilot January 13, 2026 14:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@edmocosta edmocosta merged commit 4422dae into elastic:main Jan 13, 2026
2 checks passed
@edmocosta edmocosta deleted the add-config-validation branch January 13, 2026 14:08
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.

1 participant