diff --git a/.chloggen/signaltometrics-default-error-mode-ignore.yaml b/.chloggen/signaltometrics-default-error-mode-ignore.yaml new file mode 100644 index 0000000000000..e0131dfc48ae3 --- /dev/null +++ b/.chloggen/signaltometrics-default-error-mode-ignore.yaml @@ -0,0 +1,30 @@ +# 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. receiver/filelog) +component: connector/signaltometrics + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add `connector.signaltometrics.defaultErrorModeIgnore` feature gate to change default `error_mode` to `ignore` + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [48419] + +# (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: | + When the feature gate is enabled, the connector defaults to `ignore` mode which preserves + valid data when an OTTL condition or statement error occurs, improving resiliency. This is + a breaking change rolled out via feature gate to allow gradual adoption. + +# 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/signaltometricsconnector/config/config.go b/connector/signaltometricsconnector/config/config.go index 8e0b518636d01..7ef6457ba3e4c 100644 --- a/connector/signaltometricsconnector/config/config.go +++ b/connector/signaltometricsconnector/config/config.go @@ -61,7 +61,8 @@ type Config struct { // If an error occurs, the record is skipped and the error is logged. // `silent` means the connector ignores errors returned by conditions and continues processing. // If an error occurs, the record is skipped and the error is not logged. - // The default value is `propagate`. + // The default value is `propagate`, but when the `connector.signaltometrics.defaultErrorModeIgnore` + // feature gate is enabled, the default changes to `ignore`. ErrorMode ottl.ErrorMode `mapstructure:"error_mode"` // prevent unkeyed literal initialization _ struct{} diff --git a/connector/signaltometricsconnector/factory.go b/connector/signaltometricsconnector/factory.go index 498c987c792e3..63e104ce3fbad 100644 --- a/connector/signaltometricsconnector/factory.go +++ b/connector/signaltometricsconnector/factory.go @@ -24,6 +24,13 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottlspan" ) +func defaultErrorMode() ottl.ErrorMode { + if metadata.ConnectorSignaltometricsDefaultErrorModeIgnoreFeatureGate.IsEnabled() { + return ottl.IgnoreError + } + return ottl.PropagateError +} + // NewFactory returns a ConnectorFactory. func NewFactory() connector.Factory { return xconnector.NewFactory( @@ -39,7 +46,7 @@ func NewFactory() connector.Factory { func createDefaultConfig() component.Config { return &config.Config{ - ErrorMode: ottl.PropagateError, + ErrorMode: defaultErrorMode(), } } diff --git a/connector/signaltometricsconnector/internal/metadata/generated_feature_gates.go b/connector/signaltometricsconnector/internal/metadata/generated_feature_gates.go new file mode 100644 index 0000000000000..391a869ddaefd --- /dev/null +++ b/connector/signaltometricsconnector/internal/metadata/generated_feature_gates.go @@ -0,0 +1,14 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/featuregate" +) + +var ConnectorSignaltometricsDefaultErrorModeIgnoreFeatureGate = featuregate.GlobalRegistry().MustRegister( + "connector.signaltometrics.defaultErrorModeIgnore", + featuregate.StageAlpha, + featuregate.WithRegisterDescription("When enabled, the default error_mode is `ignore` instead of `propagate`."), + featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/48419"), +) diff --git a/connector/signaltometricsconnector/metadata.yaml b/connector/signaltometricsconnector/metadata.yaml index 8452b6a995de7..4be26820021ec 100644 --- a/connector/signaltometricsconnector/metadata.yaml +++ b/connector/signaltometricsconnector/metadata.yaml @@ -17,6 +17,12 @@ status: codeowners: active: [ChrsMark, lahsivjar] +feature_gates: + - id: connector.signaltometrics.defaultErrorModeIgnore + description: When enabled, the default error_mode is `ignore` instead of `propagate`. + stage: alpha + reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/48419 + tests: config: spans: