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 Connector Usage #8721

Open
arielvalentin opened this issue Oct 22, 2023 · 5 comments
Open

Validate Connector Usage #8721

arielvalentin opened this issue Oct 22, 2023 · 5 comments
Labels

Comments

@arielvalentin
Copy link

Is your feature request related to a problem? Please describe.

I expected the configuration validator to find pipeline issues related to invalid usage of connector components, however the collector fails to start due to invalid usage and exits.

Here is an example that defines a count connector and uses it as a receiver in a metrics pipeline:

---
receivers:
  otlp:
    protocols:
      grpc:
      http:
exporters:
  logging:
connectors:
  count:

service:
  pipelines:
    traces/in:
      receivers: [otlp]
      exporters: [logging]
    metrics/out:
      receivers: [count]
      exporters: [logging]

The config.yaml passes validation:

otel-validations(:|✔) %
🤘 docker run -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.87.0 validate --config=/etc/otelcol-contrib/config.yaml

otel-validations(:|✔) %
🤘 echo $?
0

However upon using this configuration, the collector reports an error and exits:

otel-validations(:|✔) %
🤘 docker run -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.87.0
2023-10-22T21:05:36.612Z	info	service@v0.87.0/telemetry.go:84	Setting up own telemetry...
2023-10-22T21:05:36.612Z	info	service@v0.87.0/telemetry.go:201	Serving Prometheus metrics	{"address": ":8888", "level": "Basic"}
Error: failed to build pipelines: connector "count" used as receiver in metrics pipeline but not used in any supported exporter pipeline
2023/10/22 21:05:36 collector server run finished with error: failed to build pipelines: connector "count" used as receiver in metrics pipeline but not used in any supported exporter pipeline

otel-validations(:|✔) %
🤘 echo $?
1

 
Describe the solution you'd like

I expect the validator to return an error

@mx-psi
Copy link
Member

mx-psi commented Oct 23, 2023

cc @djaglowski

@djaglowski
Copy link
Member

This problem is not specific to connectors. The validate command currently does not consider supported data types for any class of component.

That said, I agree there are additional configuration errors, such as this one, which we could surface within the command if we would try to instantiate (but not start) a service.

@ringerc
Copy link

ringerc commented Nov 15, 2023

I raised this in #8866 after missing this issue in a search (somehow).

As I noted in that issue, it'd also be extremely helpful if the connector error mentioned the specific pipeline name in its complaint, e.g logs/out instead of just logs, like this:

Error: failed to build pipelines: connector "forward/test" used as receiver in "logs/out" pipeline but not used in any supported exporter pipeline

Currently it doesn't name the actual pipeline, so in complex configurations it can be tricky to tell what exactly it's complaining about.

@robincw-gr
Copy link

robincw-gr commented Dec 13, 2024

Any eyes on this?
Shouldn't this have the label bug, because the validate command should definitely fail if the config prevents the collector from starting. Fixing is not an enhancement

@mx-psi mx-psi added bug Something isn't working and removed enhancement New feature or request labels Dec 17, 2024
@mx-psi
Copy link
Member

mx-psi commented Dec 17, 2024

@robincw-gr I don't think there is anyone working on this at the moment. In general there is no way to statically validate all things that would prevent the Collector from starting (think for example about a server using a port that is not available or some permissions issue). But I agree this should be considered a bug since it is statically verifiable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants