diff --git a/.chloggen/kristofgyuracz-routing-table-warning.yaml b/.chloggen/kristofgyuracz-routing-table-warning.yaml new file mode 100755 index 000000000000..bc07b97a8fa6 --- /dev/null +++ b/.chloggen/kristofgyuracz-routing-table-warning.yaml @@ -0,0 +1,27 @@ +# 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. filelogreceiver) +component: routingconnector + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "a warning is logged if there are two or more routing items with the same routing statement" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [ 30663 ] + +# (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: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# 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] diff --git a/connector/routingconnector/router.go b/connector/routingconnector/router.go index 53558c6ff71a..24fc5978a0b6 100644 --- a/connector/routingconnector/router.go +++ b/connector/routingconnector/router.go @@ -6,6 +6,7 @@ package routingconnector // import "github.com/open-telemetry/opentelemetry-coll import ( "errors" "fmt" + "strings" "go.opentelemetry.io/collector/component" "go.uber.org/zap" @@ -119,6 +120,13 @@ func (r *router[C]) registerRouteConsumers() error { route, ok := r.routes[key(item)] if !ok { route.statement = statement + } else { + pipelineNames := []string{} + for _, pipeline := range item.Pipelines { + pipelineNames = append(pipelineNames, pipeline.String()) + } + exporters := strings.Join(pipelineNames, ", ") + r.logger.Warn(fmt.Sprintf(`Statement %q already exists in the routing table, the route with target pipeline(s) %q will be ignored.`, item.Statement, exporters)) } consumer, err := r.consumerProvider(item.Pipelines...)