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 command does not validate pipeline type #8007

Closed
andrzej-stencel opened this issue Jul 3, 2023 · 2 comments · Fixed by #9257
Closed

validate command does not validate pipeline type #8007

andrzej-stencel opened this issue Jul 3, 2023 · 2 comments · Fixed by #9257
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Good issue for contributors to OpenTelemetry Service to pick up

Comments

@andrzej-stencel
Copy link
Member

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

$ 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.

@andrzej-stencel andrzej-stencel added the bug Something isn't working label Jul 3, 2023
@atoulme atoulme added good first issue Good for newcomers help wanted Good issue for contributors to OpenTelemetry Service to pick up labels Dec 14, 2023
@ycombinator
Copy link
Contributor

I would like to work on this one.

@andrzej-stencel
Copy link
Member Author

Sounds great @ycombinator, assigning the issue to you.

mx-psi added a commit that referenced this issue Apr 10, 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.-->

This change adds another layer of validation to pipelines. It validates
that all the components in a pipeline are of the same type as the
pipeline.

For example, if a `metrics` pipeline contains a `traces`-only receiver,
the `otelcol validate -config ...` command will fail.

**Link to tracking Issue:** 
Fixes #8007.

**Testing:** 
Added unit test + existing tests are passing.

**Documentation:**
godoc.

---------

Co-authored-by: Pablo Baeyens <pablo.baeyens@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Good issue for contributors to OpenTelemetry Service to pick up
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants