Skip to content

Commit 18e18b2

Browse files
Add pipeline ID to the error message for unused connectors. (#12410)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description As mentioned in this #8721 (comment), the error message for unused connectors currently lacks specific pipeline names, making debugging more difficult. This PR enhances the error message by including pipeline names in the `[signal/name]` format, consistent with how they appear in `config.yaml`. This provides a better context for identifying misconfigurations. <!-- Issue number if applicable --> #### Link to tracking issue Related to #8721 <!--Describe what testing was performed and which tests were added.--> #### Testing A few scenarios and example output are given below. I will do additional testing and add unit tests if necessary. **1. Used as a receiver but not used as an exporter with 1 signal** <details> <summary><strong>config.yaml</strong></summary> ```yaml receivers: otlp: protocols: grpc: exporters: debug: connectors: forward: service: pipelines: logs/in: receivers: [otlp] processors: [] exporters: [debug] logs/out: receivers: [forward] processors: [] exporters: [debug] ``` </details> Main Branch Output: ``` Error: failed to build pipelines: connector "forward" used as receiver in logs pipeline but not used in any supported exporter pipeline ``` Proposed Output: ``` Error: failed to build pipelines: connector "forward" used as receiver in [logs/out] pipeline but not used in any supported exporter pipeline ``` **2. Plain** <details> <summary><strong>config.yaml</strong></summary> ```yaml receivers: otlp: protocols: grpc: exporters: debug: connectors: forward: service: pipelines: traces: receivers: [ otlp ] processors: [ ] exporters: [ forward ] metrics: receivers: [ forward ] processors: [ ] exporters: [ debug ] ``` </details> Main Branch Output: ``` Error: failed to build pipelines: connector "forward" used as exporter in traces pipeline but not used in any supported receiver pipeline ``` Proposed Output: ``` Error: failed to build pipelines: connector "forward" used as exporter in [traces] pipeline but not used in any supported receiver pipeline ``` **3. Multiple pipeline** <details> <summary><strong>config.yaml</strong></summary> ```yaml receivers: otlp: protocols: grpc: exporters: debug: connectors: forward: service: pipelines: logs/in: receivers: [otlp] processors: [] exporters: [forward] logs/in2: receivers: [ otlp ] processors: [ ] exporters: [ forward ] logs/out: receivers: [otlp] processors: [] exporters: [debug] traces: receivers: [ otlp ] processors: [ ] exporters: [ forward ] metrics: receivers: [ forward ] processors: [ ] exporters: [ debug ] ``` </details> Main Branch Output: ``` Error: failed to build pipelines: connector "forward" used as exporter in logs pipeline but not used in any supported receiver pipeline ``` Proposed Output: ``` Error: failed to build pipelines: connector "forward" used as exporter in [logs/in2 logs/in] pipeline but not used in any supported receiver pipeline ``` --------- Co-authored-by: Bogdan Drutu <[email protected]>
1 parent 4c4a9c2 commit 18e18b2

File tree

3 files changed

+58
-22
lines changed

3 files changed

+58
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: pipeline
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "output pipeline name with signal as signal[/name] format in logs."
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [12410]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: [user]

service/internal/graph/graph.go

+13-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 %v pipeline but not used in any supported receiver pipeline", connID, formatPipelineNamesWithSignal(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 %v pipeline but not used in any supported exporter pipeline", connID, formatPipelineNamesWithSignal(connectorsAsReceiver[connID], recType))
181181
}
182182

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

199+
// formatPipelineNamesWithSignal formats pipeline name with signal as "signal[/name]" format.
200+
func formatPipelineNamesWithSignal(pipelineIDs []pipeline.ID, signal pipeline.Signal) []string {
201+
var formatted []string
202+
for _, pid := range pipelineIDs {
203+
if pid.Signal() == signal {
204+
formatted = append(formatted, pid.String())
205+
}
206+
}
207+
return formatted
208+
}
209+
199210
func (g *Graph) createReceiver(pipelineID pipeline.ID, recvID component.ID) *receiverNode {
200211
rcvrNode := newReceiverNode(pipelineID.Signal(), recvID)
201212
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)