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

Add pipeline ID to the error message for unused connectors. #12410

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .chloggen/add-pipeline-names-with-signal-in-logs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: pipeline

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "output pipeline name with signal as signal[/name] format in logs."

# One or more tracking issues or pull requests related to the change
issues: [12410]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
15 changes: 13 additions & 2 deletions service/internal/graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ func (g *Graph) createNodes(set Settings) error {
if supportedUse {
continue
}
return fmt.Errorf("connector %q used as exporter in %s pipeline but not used in any supported receiver pipeline", connID, expType)
return fmt.Errorf("connector %q used as exporter in %v pipeline but not used in any supported receiver pipeline", connID, formatPipelineNamesWithSignal(connectorsAsExporter[connID], expType))
}
for recType, supportedUse := range recTypes {
if supportedUse {
continue
}
return fmt.Errorf("connector %q used as receiver in %s pipeline but not used in any supported exporter pipeline", connID, recType)
return fmt.Errorf("connector %q used as receiver in %v pipeline but not used in any supported exporter pipeline", connID, formatPipelineNamesWithSignal(connectorsAsReceiver[connID], recType))
}

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

// formatPipelineNamesWithSignal formats pipeline name with signal as "signal[/name]" format.
func formatPipelineNamesWithSignal(pipelineIDs []pipeline.ID, signal pipeline.Signal) []string {
var formatted []string
for _, pid := range pipelineIDs {
if pid.Signal() == signal {
formatted = append(formatted, pid.String())
}
}
return formatted
}

func (g *Graph) createReceiver(pipelineID pipeline.ID, recvID component.ID) *receiverNode {
rcvrNode := newReceiverNode(pipelineID.Signal(), recvID)
if node := g.componentGraph.Node(rcvrNode.ID()); node != nil {
Expand Down
40 changes: 20 additions & 20 deletions service/internal/graph/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in traces pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [traces/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_traces_metrics.yaml",
Expand All @@ -1672,7 +1672,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in traces pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [traces/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_traces_logs.yaml",
Expand All @@ -1695,7 +1695,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in traces pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [traces/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_traces_profiles.yaml",
Expand All @@ -1718,7 +1718,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in traces pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [traces/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_metrics_traces.yaml",
Expand All @@ -1741,7 +1741,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in metrics pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [metrics/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_metrics_metrics.yaml",
Expand All @@ -1764,7 +1764,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in metrics pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [metrics/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_metrics_logs.yaml",
Expand All @@ -1787,7 +1787,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in metrics pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [metrics/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_metrics_profiles.yaml",
Expand All @@ -1810,7 +1810,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in metrics pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [metrics/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_logs_traces.yaml",
Expand All @@ -1833,7 +1833,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in logs pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [logs/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_logs_metrics.yaml",
Expand All @@ -1856,7 +1856,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in logs pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [logs/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_logs_logs.yaml",
Expand All @@ -1879,7 +1879,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in logs pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [logs/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_logs_profiles.yaml",
Expand All @@ -1902,7 +1902,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in logs pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [logs/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_profiles_traces.yaml",
Expand All @@ -1925,7 +1925,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in profiles pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [profiles/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_profiles_metrics.yaml",
Expand All @@ -1948,7 +1948,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in profiles pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [profiles/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_profiles_logs.yaml",
Expand All @@ -1971,7 +1971,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in profiles pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [profiles/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "not_supported_connector_profiles_profiles.yaml",
Expand All @@ -1994,7 +1994,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: "connector \"bf\" used as exporter in profiles pipeline but not used in any supported receiver pipeline",
expected: "connector \"bf\" used as exporter in [profiles/in] pipeline but not used in any supported receiver pipeline",
},
{
name: "orphaned-connector-use-as-exporter",
Expand All @@ -2013,7 +2013,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")},
},
},
expected: `connector "nop/conn" used as exporter in metrics pipeline but not used in any supported receiver pipeline`,
expected: `connector "nop/conn" used as exporter in [metrics/in] pipeline but not used in any supported receiver pipeline`,
},
{
name: "orphaned-connector-use-as-receiver",
Expand All @@ -2032,7 +2032,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: `connector "nop/conn" used as receiver in traces pipeline but not used in any supported exporter pipeline`,
expected: `connector "nop/conn" used as receiver in [traces/out] pipeline but not used in any supported exporter pipeline`,
},
{
name: "partially-orphaned-connector-use-as-exporter",
Expand All @@ -2059,7 +2059,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("mockforward")},
},
},
expected: `connector "mockforward" used as exporter in metrics pipeline but not used in any supported receiver pipeline`,
expected: `connector "mockforward" used as exporter in [metrics/in] pipeline but not used in any supported receiver pipeline`,
},
{
name: "partially-orphaned-connector-use-as-receiver",
Expand All @@ -2086,7 +2086,7 @@ func TestGraphBuildErrors(t *testing.T) {
Exporters: []component.ID{component.MustNewID("nop")},
},
},
expected: `connector "mockforward" used as receiver in traces pipeline but not used in any supported exporter pipeline`,
expected: `connector "mockforward" used as receiver in [traces/out] pipeline but not used in any supported exporter pipeline`,
},
{
name: "not_allowed_simple_cycle_traces.yaml",
Expand Down
Loading