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

validate subcommand does not display component names on validation failure #9863

Closed
FISHMANPET opened this issue Mar 27, 2024 · 0 comments · Fixed by #9866
Closed

validate subcommand does not display component names on validation failure #9863

FISHMANPET opened this issue Mar 27, 2024 · 0 comments · Fixed by #9866
Labels
bug Something isn't working

Comments

@FISHMANPET
Copy link

Describe the bug
When a validation fails because the collector can't find the referenced component, it displays some YAML serialization of valid components instead of their name

Steps to reproduce
Specify a config with a component that isn't included in the collector and validate it (see config later on in report)

% otelcol validate --config=config.yaml

What did you expect to see?
A list of component names as possible values

What did you see instead?

% otelcol validate --config=config.yaml
Error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:

* error decoding 'exporters': unknown type: "lorging" for id: "lorging" (valid values: [<component.Type Value> <component.Type Value> <component.Type Value> <component.Type Value> <component.Type Value>])
2024/03/27 11:23:56 collector server run finished with error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:

* error decoding 'exporters': unknown type: "lorging" for id: "lorging" (valid values: [<component.Type Value> <component.Type Value> <component.Type Value> <component.Type Value> <component.Type Value>])

Specifically the valid values are listed as <component.Type Value> instead of the actual exporters I have in this custom collector. This custom collector has 5 exporters and <component.Type Value> appears 5 times in the list so it's properly iterating through all the possible processors, it's just not correctly printing their names.

To be clear, the failure of validation is expected, it's the output of that validation failure that is the issue.

What version did you use?
A custom built collector built against 0.97.0 with 5 exporter components.

What config did you use?
This config has an error that it's trying to load the lorging with an extra r component rather than the actual logging component.

receivers:
  otlp:
    protocols:
      http:

exporters:
  lorging:

service:
  pipelines:
    traces:
      receivers:
        - otlp
      exporters:
        - logging

Environment
MacOS 13.6.6
Custom collector built using ocb 0.97.0, running go 1.22.1

Additional context
Much like #9855, this is probably caused by changes in #9472, but the changes in #9856 don't fix this, so I'm opening a new issue by request of @TylerHelmuth

@FISHMANPET FISHMANPET added the bug Something isn't working label Mar 27, 2024
dmitryax pushed a commit that referenced this issue Mar 27, 2024
**Description:**
Fixes issue where validate command was not properly printing valid
values.

**Link to tracking Issue:**
Closes
#9863

**Testing:**
Updated unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant