Files
telemetry/otelcol/testdata/otelcol-cyclic-connector.yaml
Sudipto BaralandGitHub 73d7d76e07 Statically validate connector config during dry-run. (#12712)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
As described in
[#8721](https://github.com/open-telemetry/opentelemetry-collector/issues/8721),
the current `validate` command cannot capture improper connector usage
errors during a dry run.

One proposed solution _(as mentioned in [this
comment](https://github.com/open-telemetry/opentelemetry-collector/issues/8721#issuecomment-1775393905))_
is to surface configuration errors by instantiating the service during
the dry run. However, reviewers preferred statically verifying the
errors over instantiating the service (see the [PR #12488
comments](https://github.com/open-telemetry/opentelemetry-collector/pull/12488)).

The validation logic for connectors is located in the
[`service/internal/graph`](https://github.com/open-telemetry/opentelemetry-collector/blob/1daa315455d02bac90185027878d858ba08a0f07/service/internal/graph)
package. In the discussion of [PR
#12681](https://github.com/open-telemetry/opentelemetry-collector/pull/12681),
it was concluded that instantiating the graph is the better approach
(see [this
comment](https://github.com/open-telemetry/opentelemetry-collector/pull/12681#issuecomment-2746258749)).

Finally, this PR uses the `graph.Build()` method to surface
configuration errors during the dry run.

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #8721 #12535

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Signed-off-by: sudipto baral <[email protected]>
2025-04-09 15:37:07 +00:00

19 lines
286 B
YAML

receivers:
nop:
exporters:
nop:
connectors:
nop/forward:
service:
pipelines:
traces/in:
receivers: [nop/forward]
processors: [ ]
exporters: [nop/forward]
traces/out:
receivers: [nop/forward]
processors: [ ]
exporters: [nop/forward]