Skip to content

Commit a3fc63c

Browse files
committed
Add pipeline ID to the error message for unused connectors.
1 parent 9ea6963 commit a3fc63c

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

service/internal/graph/graph.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ func (g *Graph) createNodes(set Settings) error {
171171
if supportedUse {
172172
continue
173173
}
174-
return fmt.Errorf("connector %q used as exporter in %s pipeline but not used in any supported receiver pipeline", connID, expType)
174+
return fmt.Errorf("connector %q used as exporter in %s pipeline but not used in any supported receiver pipeline", connID, formatPipelineNameWithSignal(connectorsAsExporter[connID], expType))
175175
}
176176
for recType, supportedUse := range recTypes {
177177
if supportedUse {
178178
continue
179179
}
180-
return fmt.Errorf("connector %q used as receiver in %s pipeline but not used in any supported exporter pipeline", connID, recType)
180+
return fmt.Errorf("connector %q used as receiver in %s pipeline but not used in any supported exporter pipeline", connID, formatPipelineNameWithSignal(connectorsAsReceiver[connID], recType))
181181
}
182182

183183
for _, eID := range connectorsAsExporter[connID] {
@@ -196,6 +196,18 @@ func (g *Graph) createNodes(set Settings) error {
196196
return nil
197197
}
198198

199+
// formatPipelineNameWithSignal formats pipeline name with signal as "signal[/name]" format.
200+
func formatPipelineNameWithSignal(pipelineIDs []pipeline.ID, signal pipeline.Signal) string {
201+
var formatted string
202+
for _, pid := range pipelineIDs {
203+
if pid.Signal() == signal {
204+
formatted = pid.String()
205+
break
206+
}
207+
}
208+
return formatted
209+
}
210+
199211
func (g *Graph) createReceiver(pipelineID pipeline.ID, recvID component.ID) *receiverNode {
200212
rcvrNode := newReceiverNode(pipelineID.Signal(), recvID)
201213
if node := g.componentGraph.Node(rcvrNode.ID()); node != nil {

service/internal/graph/graph_test.go

+20-20
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ func TestGraphBuildErrors(t *testing.T) {
16491649
Exporters: []component.ID{component.MustNewID("nop")},
16501650
},
16511651
},
1652-
expected: "connector \"bf\" used as exporter in traces pipeline but not used in any supported receiver pipeline",
1652+
expected: "connector \"bf\" used as exporter in traces/in pipeline but not used in any supported receiver pipeline",
16531653
},
16541654
{
16551655
name: "not_supported_connector_traces_metrics.yaml",
@@ -1672,7 +1672,7 @@ func TestGraphBuildErrors(t *testing.T) {
16721672
Exporters: []component.ID{component.MustNewID("nop")},
16731673
},
16741674
},
1675-
expected: "connector \"bf\" used as exporter in traces pipeline but not used in any supported receiver pipeline",
1675+
expected: "connector \"bf\" used as exporter in traces/in pipeline but not used in any supported receiver pipeline",
16761676
},
16771677
{
16781678
name: "not_supported_connector_traces_logs.yaml",
@@ -1695,7 +1695,7 @@ func TestGraphBuildErrors(t *testing.T) {
16951695
Exporters: []component.ID{component.MustNewID("nop")},
16961696
},
16971697
},
1698-
expected: "connector \"bf\" used as exporter in traces pipeline but not used in any supported receiver pipeline",
1698+
expected: "connector \"bf\" used as exporter in traces/in pipeline but not used in any supported receiver pipeline",
16991699
},
17001700
{
17011701
name: "not_supported_connector_traces_profiles.yaml",
@@ -1718,7 +1718,7 @@ func TestGraphBuildErrors(t *testing.T) {
17181718
Exporters: []component.ID{component.MustNewID("nop")},
17191719
},
17201720
},
1721-
expected: "connector \"bf\" used as exporter in traces pipeline but not used in any supported receiver pipeline",
1721+
expected: "connector \"bf\" used as exporter in traces/in pipeline but not used in any supported receiver pipeline",
17221722
},
17231723
{
17241724
name: "not_supported_connector_metrics_traces.yaml",
@@ -1741,7 +1741,7 @@ func TestGraphBuildErrors(t *testing.T) {
17411741
Exporters: []component.ID{component.MustNewID("nop")},
17421742
},
17431743
},
1744-
expected: "connector \"bf\" used as exporter in metrics pipeline but not used in any supported receiver pipeline",
1744+
expected: "connector \"bf\" used as exporter in metrics/in pipeline but not used in any supported receiver pipeline",
17451745
},
17461746
{
17471747
name: "not_supported_connector_metrics_metrics.yaml",
@@ -1764,7 +1764,7 @@ func TestGraphBuildErrors(t *testing.T) {
17641764
Exporters: []component.ID{component.MustNewID("nop")},
17651765
},
17661766
},
1767-
expected: "connector \"bf\" used as exporter in metrics pipeline but not used in any supported receiver pipeline",
1767+
expected: "connector \"bf\" used as exporter in metrics/in pipeline but not used in any supported receiver pipeline",
17681768
},
17691769
{
17701770
name: "not_supported_connector_metrics_logs.yaml",
@@ -1787,7 +1787,7 @@ func TestGraphBuildErrors(t *testing.T) {
17871787
Exporters: []component.ID{component.MustNewID("nop")},
17881788
},
17891789
},
1790-
expected: "connector \"bf\" used as exporter in metrics pipeline but not used in any supported receiver pipeline",
1790+
expected: "connector \"bf\" used as exporter in metrics/in pipeline but not used in any supported receiver pipeline",
17911791
},
17921792
{
17931793
name: "not_supported_connector_metrics_profiles.yaml",
@@ -1810,7 +1810,7 @@ func TestGraphBuildErrors(t *testing.T) {
18101810
Exporters: []component.ID{component.MustNewID("nop")},
18111811
},
18121812
},
1813-
expected: "connector \"bf\" used as exporter in metrics pipeline but not used in any supported receiver pipeline",
1813+
expected: "connector \"bf\" used as exporter in metrics/in pipeline but not used in any supported receiver pipeline",
18141814
},
18151815
{
18161816
name: "not_supported_connector_logs_traces.yaml",
@@ -1833,7 +1833,7 @@ func TestGraphBuildErrors(t *testing.T) {
18331833
Exporters: []component.ID{component.MustNewID("nop")},
18341834
},
18351835
},
1836-
expected: "connector \"bf\" used as exporter in logs pipeline but not used in any supported receiver pipeline",
1836+
expected: "connector \"bf\" used as exporter in logs/in pipeline but not used in any supported receiver pipeline",
18371837
},
18381838
{
18391839
name: "not_supported_connector_logs_metrics.yaml",
@@ -1856,7 +1856,7 @@ func TestGraphBuildErrors(t *testing.T) {
18561856
Exporters: []component.ID{component.MustNewID("nop")},
18571857
},
18581858
},
1859-
expected: "connector \"bf\" used as exporter in logs pipeline but not used in any supported receiver pipeline",
1859+
expected: "connector \"bf\" used as exporter in logs/in pipeline but not used in any supported receiver pipeline",
18601860
},
18611861
{
18621862
name: "not_supported_connector_logs_logs.yaml",
@@ -1879,7 +1879,7 @@ func TestGraphBuildErrors(t *testing.T) {
18791879
Exporters: []component.ID{component.MustNewID("nop")},
18801880
},
18811881
},
1882-
expected: "connector \"bf\" used as exporter in logs pipeline but not used in any supported receiver pipeline",
1882+
expected: "connector \"bf\" used as exporter in logs/in pipeline but not used in any supported receiver pipeline",
18831883
},
18841884
{
18851885
name: "not_supported_connector_logs_profiles.yaml",
@@ -1902,7 +1902,7 @@ func TestGraphBuildErrors(t *testing.T) {
19021902
Exporters: []component.ID{component.MustNewID("nop")},
19031903
},
19041904
},
1905-
expected: "connector \"bf\" used as exporter in logs pipeline but not used in any supported receiver pipeline",
1905+
expected: "connector \"bf\" used as exporter in logs/in pipeline but not used in any supported receiver pipeline",
19061906
},
19071907
{
19081908
name: "not_supported_connector_profiles_traces.yaml",
@@ -1925,7 +1925,7 @@ func TestGraphBuildErrors(t *testing.T) {
19251925
Exporters: []component.ID{component.MustNewID("nop")},
19261926
},
19271927
},
1928-
expected: "connector \"bf\" used as exporter in profiles pipeline but not used in any supported receiver pipeline",
1928+
expected: "connector \"bf\" used as exporter in profiles/in pipeline but not used in any supported receiver pipeline",
19291929
},
19301930
{
19311931
name: "not_supported_connector_profiles_metrics.yaml",
@@ -1948,7 +1948,7 @@ func TestGraphBuildErrors(t *testing.T) {
19481948
Exporters: []component.ID{component.MustNewID("nop")},
19491949
},
19501950
},
1951-
expected: "connector \"bf\" used as exporter in profiles pipeline but not used in any supported receiver pipeline",
1951+
expected: "connector \"bf\" used as exporter in profiles/in pipeline but not used in any supported receiver pipeline",
19521952
},
19531953
{
19541954
name: "not_supported_connector_profiles_logs.yaml",
@@ -1971,7 +1971,7 @@ func TestGraphBuildErrors(t *testing.T) {
19711971
Exporters: []component.ID{component.MustNewID("nop")},
19721972
},
19731973
},
1974-
expected: "connector \"bf\" used as exporter in profiles pipeline but not used in any supported receiver pipeline",
1974+
expected: "connector \"bf\" used as exporter in profiles/in pipeline but not used in any supported receiver pipeline",
19751975
},
19761976
{
19771977
name: "not_supported_connector_profiles_profiles.yaml",
@@ -1994,7 +1994,7 @@ func TestGraphBuildErrors(t *testing.T) {
19941994
Exporters: []component.ID{component.MustNewID("nop")},
19951995
},
19961996
},
1997-
expected: "connector \"bf\" used as exporter in profiles pipeline but not used in any supported receiver pipeline",
1997+
expected: "connector \"bf\" used as exporter in profiles/in pipeline but not used in any supported receiver pipeline",
19981998
},
19991999
{
20002000
name: "orphaned-connector-use-as-exporter",
@@ -2013,7 +2013,7 @@ func TestGraphBuildErrors(t *testing.T) {
20132013
Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")},
20142014
},
20152015
},
2016-
expected: `connector "nop/conn" used as exporter in metrics pipeline but not used in any supported receiver pipeline`,
2016+
expected: `connector "nop/conn" used as exporter in metrics/in pipeline but not used in any supported receiver pipeline`,
20172017
},
20182018
{
20192019
name: "orphaned-connector-use-as-receiver",
@@ -2032,7 +2032,7 @@ func TestGraphBuildErrors(t *testing.T) {
20322032
Exporters: []component.ID{component.MustNewID("nop")},
20332033
},
20342034
},
2035-
expected: `connector "nop/conn" used as receiver in traces pipeline but not used in any supported exporter pipeline`,
2035+
expected: `connector "nop/conn" used as receiver in traces/out pipeline but not used in any supported exporter pipeline`,
20362036
},
20372037
{
20382038
name: "partially-orphaned-connector-use-as-exporter",
@@ -2059,7 +2059,7 @@ func TestGraphBuildErrors(t *testing.T) {
20592059
Exporters: []component.ID{component.MustNewID("mockforward")},
20602060
},
20612061
},
2062-
expected: `connector "mockforward" used as exporter in metrics pipeline but not used in any supported receiver pipeline`,
2062+
expected: `connector "mockforward" used as exporter in metrics/in pipeline but not used in any supported receiver pipeline`,
20632063
},
20642064
{
20652065
name: "partially-orphaned-connector-use-as-receiver",
@@ -2086,7 +2086,7 @@ func TestGraphBuildErrors(t *testing.T) {
20862086
Exporters: []component.ID{component.MustNewID("nop")},
20872087
},
20882088
},
2089-
expected: `connector "mockforward" used as receiver in traces pipeline but not used in any supported exporter pipeline`,
2089+
expected: `connector "mockforward" used as receiver in traces/out pipeline but not used in any supported exporter pipeline`,
20902090
},
20912091
{
20922092
name: "not_allowed_simple_cycle_traces.yaml",

0 commit comments

Comments
 (0)