Skip to content
Open
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
2 changes: 1 addition & 1 deletion connector/routingconnector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The following settings are available:
- `copy`: Matched data is copied to the target pipeline(s) but remains available for evaluation by subsequent routes. This allows the same data to be routed to multiple pipelines.
- `table.pipelines (required)`: the list of pipelines to use when the routing condition is met.
- `default_pipelines (optional)`: contains the list of pipelines to use when a record does not meet any of specified conditions.
- `error_mode (optional)`: determines how errors returned from OTTL statements are handled. Valid values are `propagate`, `ignore` and `silent`. If `ignore` or `silent` is used and a statement's condition has an error then the payload will be routed to the default pipelines. When `silent` is used the error is not logged. If not supplied, `propagate` is used.
- `error_mode (optional)`: determines how errors returned from OTTL statements are handled. Valid values are `propagate`, `ignore` and `silent`. If `ignore` or `silent` is used and a statement's condition has an error then the payload will be routed to the default pipelines. When `silent` is used the error is not logged. If not supplied, `propagate` is used. This default will change to `ignore` when the `connector.routing.defaultErrorModeIgnore` feature gate is stable.

### Limitations

Expand Down
3 changes: 2 additions & 1 deletion connector/routingconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ type Config struct {
// condition has an error then the payload will be routed to the default exporter. `propagate`
// means the processor returns the error up the pipeline. This will result in the payload being
// dropped from the collector.
// The default value is `propagate`.
// The current default value is `propagate`, which will change to `ignore` when the
// `connector.routing.defaultErrorModeIgnore` feature gate is stable.
ErrorMode ottl.ErrorMode `mapstructure:"error_mode"`
// DefaultPipelines contains the list of pipelines to use when a more specific record can't be
// found in the routing table.
Expand Down
2 changes: 1 addition & 1 deletion connector/routingconnector/config.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ properties:
items:
$ref: go.opentelemetry.io/collector/pipeline.id
error_mode:
description: ErrorMode determines how the processor reacts to errors that occur while processing an OTTL condition. Valid values are `ignore` and `propagate`. `ignore` means the processor ignores errors returned by conditions and continues on to the next condition. This is the recommended mode. If `ignore` is used and a statement's condition has an error then the payload will be routed to the default exporter. `propagate` means the processor returns the error up the pipeline. This will result in the payload being dropped from the collector. The default value is `propagate`.
description: ErrorMode determines how the processor reacts to errors that occur while processing an OTTL condition. Valid values are `ignore` and `propagate`. `ignore` means the processor ignores errors returned by conditions and continues on to the next condition. This is the recommended mode. If `ignore` is used and a statement's condition has an error then the payload will be routed to the default exporter. `propagate` means the processor returns the error up the pipeline. This will result in the payload being dropped from the collector. The current default value is `propagate`, which will change to `ignore` when the `connector.routing.defaultErrorModeIgnore` feature gate is stable.
$ref: /pkg/ottl.error_mode
table:
description: Table contains the routing table for this processor. Required.
Expand Down
6 changes: 5 additions & 1 deletion connector/routingconnector/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ func NewFactory() connector.Factory {

// createDefaultConfig creates the default configuration.
func createDefaultConfig() component.Config {
defaultErrorMode := ottl.PropagateError
if metadata.ConnectorRoutingDefaultErrorModeIgnoreFeatureGate.IsEnabled() {
defaultErrorMode = ottl.IgnoreError
}
return &Config{
ErrorMode: ottl.PropagateError,
ErrorMode: defaultErrorMode,
}
}

Expand Down
18 changes: 18 additions & 0 deletions connector/routingconnector/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,33 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/connector"
"go.opentelemetry.io/collector/connector/connectortest"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/pipeline"

"github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
)

func TestFactoryCreateDefaultConfig(t *testing.T) {
t.Cleanup(func() {
_ = featuregate.GlobalRegistry().Set(metadata.ConnectorRoutingDefaultErrorModeIgnoreFeatureGate.ID(), false)
})

factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.Equal(t, ottl.PropagateError, cfg.(*Config).ErrorMode)

require.NoError(t, featuregate.GlobalRegistry().Set(metadata.ConnectorRoutingDefaultErrorModeIgnoreFeatureGate.ID(), true))

cfg = factory.CreateDefaultConfig()
assert.Equal(t, ottl.IgnoreError, cfg.(*Config).ErrorMode)
}

func TestConnectorCreatedWithValidConfiguration(t *testing.T) {
cfg := &Config{
Table: []RoutingTableItem{{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions connector/routingconnector/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ status:
tests:
skip_lifecycle: true
skip_shutdown: true

feature_gates:
- id: "connector.routing.defaultErrorModeIgnore"
description: Changes the default error_mode of the routing connector from propagate to ignore
stage: alpha
from_version: v0.153.0
reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/48418
Loading