Closed
Description
Describe the bug
Thew validate
command intoduced in #7835 does not validate the type of pipeline a component is assigned to. For example, if a metrics-only component is used in a logs pipeline, validation passes, but I would expect it to fail.
Steps to reproduce
- Download the latest contrib distro (to have access to various types of components) from https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/v0.80.0
- Prepare a config file that uses components in invalid pipeline types, see below.
- Run the collector to verify that the configuration is invalid:
$ otelcol-contrib-0.80.0-linux_amd64 --config config.yaml
2023-07-03T11:49:33.120+0200 info service/telemetry.go:81 Setting up own telemetry...
2023-07-03T11:49:33.120+0200 info service/telemetry.go:104 Serving Prometheus metrics {"address": ":8888", "level": "Basic"}
2023-07-03T11:49:33.120+0200 info exporter@v0.80.0/exporter.go:275 Stability level of component is undefined {"kind": "exporter", "data_type": "logs", "name": "prometheus"}
Error: failed to build pipelines: failed to create "prometheus" exporter for data type "logs": telemetry type is not supported
2023/07/03 11:49:33 collector server run finished with error: failed to build pipelines: failed to create "prometheus" exporter for data type "logs": telemetry type is not supported
- Run the
validate
command:
$ otelcol-contrib-0.80.0-linux_amd64 validate --config config.yaml
$ echo $?
0
What did you expect to see?
Validation fails
What did you see instead?
Validation succeeds
What version did you use?
v0.80.0
What config did you use?
exporters:
awscloudwatchlogs:
log_group_name: x
log_stream_name: x
jaeger:
endpoint: x
prometheus:
receivers:
filelog:
httpcheck:
endpoint: x
zipkin:
service:
pipelines:
logs:
exporters:
- prometheus # metrics-only
receivers:
- zipkin # traces-only
metrics:
exporters:
- jaeger # traces-only
receivers:
- filelog # logs-only
traces:
exporters:
- awscloudwatchlogs # logs-only
receivers:
- httpcheck # metrics-only
Environment
OS: Ubuntu 23.04 lunar
Additional context
Currently, there is no documentation describing to what extent the validation works. I believe it's reasonable for the user to assume the pipeline types would be validated. I understand that what the validate
command does under the hood is just run Validate()
on the config object.