diff --git a/otelcol/config.go b/otelcol/config.go index 4f5a7680aed..9345405b4fd 100644 --- a/otelcol/config.go +++ b/otelcol/config.go @@ -82,10 +82,14 @@ func (cfg *Config) Validate() error { } if _, ok := cfg.Exporters[connID]; ok { - return fmt.Errorf("connectors::%s: there's already an exporter named %q", connID, connID) + return fmt.Errorf("connectors::%s: ambiguous ID: Found both %q exporter and %q connector. "+ + "Change one of the components' IDs to eliminate ambiguity (e.g. rename %q connector to %q)", + connID, connID, connID, connID, connID.String()+"/connector") } if _, ok := cfg.Receivers[connID]; ok { - return fmt.Errorf("connectors::%s: there's already a receiver named %q", connID, connID) + return fmt.Errorf("connectors::%s: ambiguous ID: Found both %q receiver and %q connector. "+ + "Change one of the components' IDs to eliminate ambiguity (e.g. rename %q connector to %q)", + connID, connID, connID, connID, connID.String()+"/connector") } } diff --git a/otelcol/config_test.go b/otelcol/config_test.go index 924a7f24a50..9a4ddb87c4f 100644 --- a/otelcol/config_test.go +++ b/otelcol/config_test.go @@ -177,7 +177,7 @@ func TestConfigValidate(t *testing.T) { pipe.Exporters = append(pipe.Exporters, component.NewIDWithName("nop", "2")) return cfg }, - expected: errors.New(`connectors::nop/2: there's already a receiver named "nop/2"`), + expected: errors.New(`connectors::nop/2: ambiguous ID: Found both "nop/2" receiver and "nop/2" connector. Change one of the components' IDs to eliminate ambiguity (e.g. rename "nop/2" connector to "nop/2/connector")`), }, { name: "ambiguous-connector-name-as-exporter", @@ -190,7 +190,7 @@ func TestConfigValidate(t *testing.T) { pipe.Exporters = append(pipe.Exporters, component.NewIDWithName("nop", "2")) return cfg }, - expected: errors.New(`connectors::nop/2: there's already an exporter named "nop/2"`), + expected: errors.New(`connectors::nop/2: ambiguous ID: Found both "nop/2" exporter and "nop/2" connector. Change one of the components' IDs to eliminate ambiguity (e.g. rename "nop/2" connector to "nop/2/connector")`), }, { name: "invalid-connector-reference-as-receiver",