Skip to content

Commit 780c85b

Browse files
authored
[chore]: (processor/transformprocessor) finish migrating feature gate to metadata.yaml and remove linting rule (#47542)
#### Description * Migrates last feature gate (``) for `processor/transformprocessor` to metadata.yaml * Updates factory test to use new metadata feature gate ID * Enables forbidigo linting rule for `processor/transformprocessor` (rule forbids manual creation of feature gates) #### Link to tracking issue Part of #46116 Follow-up for #47371 and #47506 #### Testing `make lint` and `make test` pass.
1 parent bc82cfd commit 780c85b

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ linters:
203203
- linters:
204204
- forbidigo
205205
path: processor/tailsamplingprocessor/
206-
- linters:
207-
- forbidigo
208-
path: processor/transformprocessor/
209206
- linters:
210207
- forbidigo
211208
path: receiver/awscontainerinsightreceiver/

processor/transformprocessor/documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This component has the following feature gates:
88

99
| Feature Gate | Stage | Description | From Version | To Version | Reference |
1010
| ------------ | ----- | ----------- | ------------ | ---------- | --------- |
11+
| `processor.transform.defaultErrorModeIgnore` | alpha | Changes the default error_mode of the transform processor from propagate to ignore | v0.150.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/47231) |
1112
| `transform.flatten.logs` | alpha | Flatten log data prior to transformation so every record has a unique copy of the resource and scope. Regroups logs based on resource and scope after transformations. | v0.103.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32080#issuecomment-2120764953) |
1213

1314
For more information about feature gates, see the [Feature Gates](https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md) documentation.

processor/transformprocessor/factory.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"go.opentelemetry.io/collector/component"
1111
"go.opentelemetry.io/collector/consumer"
1212
"go.opentelemetry.io/collector/consumer/xconsumer"
13-
"go.opentelemetry.io/collector/featuregate"
1413
"go.opentelemetry.io/collector/processor"
1514
"go.opentelemetry.io/collector/processor/processorhelper"
1615
"go.opentelemetry.io/collector/processor/processorhelper/xprocessorhelper"
@@ -34,16 +33,6 @@ import (
3433

3534
var processorCapabilities = consumer.Capabilities{MutatesData: true}
3635

37-
const defaultErrorModeIgnoreGateID = "processor.transform.defaultErrorModeIgnore"
38-
39-
var defaultErrorModeIgnoreFeatureGate = featuregate.GlobalRegistry().MustRegister(
40-
defaultErrorModeIgnoreGateID,
41-
featuregate.StageAlpha,
42-
featuregate.WithRegisterDescription("Changes the default error_mode of the transform processor from propagate to ignore"),
43-
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/47231"),
44-
featuregate.WithRegisterFromVersion("v0.150.0"),
45-
)
46-
4736
type transformProcessorFactory struct {
4837
dataPointFunctions map[string]ottl.Factory[*ottldatapoint.TransformContext]
4938
logFunctions map[string]ottl.Factory[*ottllog.TransformContext]
@@ -218,7 +207,7 @@ func NewFactoryWithOptions(options ...FactoryOption) processor.Factory {
218207

219208
func (f *transformProcessorFactory) createDefaultConfig() component.Config {
220209
defaultErrorMode := ottl.PropagateError
221-
if defaultErrorModeIgnoreFeatureGate.IsEnabled() {
210+
if metadata.ProcessorTransformDefaultErrorModeIgnoreFeatureGate.IsEnabled() {
222211
defaultErrorMode = ottl.IgnoreError
223212
}
224213
return &Config{

processor/transformprocessor/factory_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func TestFactory_Type(t *testing.T) {
6262

6363
func TestFactory_CreateDefaultConfig(t *testing.T) {
6464
t.Cleanup(func() {
65-
_ = featuregate.GlobalRegistry().Set(defaultErrorModeIgnoreGateID, false)
65+
_ = featuregate.GlobalRegistry().Set(metadata.ProcessorTransformDefaultErrorModeIgnoreFeatureGate.ID(), false)
6666
})
6767

6868
factory := NewFactory()
@@ -77,7 +77,7 @@ func TestFactory_CreateDefaultConfig(t *testing.T) {
7777
assertConfigContainsDefaultFunctions(t, *cfg.(*Config))
7878
require.NoError(t, componenttest.CheckConfigStruct(cfg))
7979

80-
err := featuregate.GlobalRegistry().Set(defaultErrorModeIgnoreGateID, true)
80+
err := featuregate.GlobalRegistry().Set(metadata.ProcessorTransformDefaultErrorModeIgnoreFeatureGate.ID(), true)
8181
require.NoError(t, err)
8282

8383
cfg = factory.CreateDefaultConfig()

processor/transformprocessor/internal/metadata/generated_feature_gates.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

processor/transformprocessor/metadata.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ status:
1414
seeking_new: true
1515

1616
feature_gates:
17+
- id: "processor.transform.defaultErrorModeIgnore"
18+
description: Changes the default error_mode of the transform processor from propagate to ignore
19+
stage: alpha
20+
from_version: v0.150.0
21+
reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/47231
22+
1723
- id: "transform.flatten.logs"
1824
description: Flatten log data prior to transformation so every record has a unique copy of the resource and scope. Regroups logs based on resource and scope after transformations.
1925
stage: alpha
2026
from_version: v0.103.0
2127
reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32080#issuecomment-2120764953
22-
28+
2329
tests:
2430
config:

0 commit comments

Comments
 (0)