From b43b9c88917ee84824c40931d178210e54f632d6 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Fri, 11 Nov 2022 08:42:01 -0800 Subject: [PATCH] Register featuregate, otherwise does not work Signed-off-by: Bogdan Drutu --- .chloggen/fixunregistergate.yaml | 11 +++++++++++ processor/spanmetricsprocessor/config.go | 19 +++++++++++-------- processor/spanmetricsprocessor/factory.go | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) create mode 100755 .chloggen/fixunregistergate.yaml diff --git a/.chloggen/fixunregistergate.yaml b/.chloggen/fixunregistergate.yaml new file mode 100755 index 0000000000000..5e1b9f3032747 --- /dev/null +++ b/.chloggen/fixunregistergate.yaml @@ -0,0 +1,11 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: spanmetricsprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Register `processor.spanmetrics.PermissiveLabelSanitization` featuregate, which was only defined but not registered. + +# One or more tracking issues related to the change +issues: [16269] diff --git a/processor/spanmetricsprocessor/config.go b/processor/spanmetricsprocessor/config.go index 54ce33fadd1d6..6fe9caed9605e 100644 --- a/processor/spanmetricsprocessor/config.go +++ b/processor/spanmetricsprocessor/config.go @@ -23,10 +23,19 @@ import ( ) const ( - delta = "AGGREGATION_TEMPORALITY_DELTA" - cumulative = "AGGREGATION_TEMPORALITY_CUMULATIVE" + delta = "AGGREGATION_TEMPORALITY_DELTA" + cumulative = "AGGREGATION_TEMPORALITY_CUMULATIVE" + dropSanitizationGateID = "processor.spanmetrics.PermissiveLabelSanitization" ) +func init() { + featuregate.GetRegistry().MustRegisterID( + dropSanitizationGateID, + featuregate.StageAlpha, + featuregate.WithRegisterDescription("Controls whether to change labels starting with '_' to 'key_'"), + ) +} + // Dimension defines the dimension name and optional default value if the Dimension is missing from a span attribute. type Dimension struct { Name string `mapstructure:"name"` @@ -64,12 +73,6 @@ type Config struct { skipSanitizeLabel bool } -var dropSanitizationGate = featuregate.Gate{ - ID: "processor.spanmetrics.PermissiveLabelSanitization", - Enabled: false, - Description: "Controls whether to change labels starting with '_' to 'key_'", -} - // GetAggregationTemporality converts the string value given in the config into a AggregationTemporality. // Returns cumulative, unless delta is correctly specified. func (c Config) GetAggregationTemporality() pmetric.AggregationTemporality { diff --git a/processor/spanmetricsprocessor/factory.go b/processor/spanmetricsprocessor/factory.go index a6ca2b6d958d6..17607ea7a1c43 100644 --- a/processor/spanmetricsprocessor/factory.go +++ b/processor/spanmetricsprocessor/factory.go @@ -44,7 +44,7 @@ func createDefaultConfig() component.ProcessorConfig { ProcessorSettings: config.NewProcessorSettings(component.NewID(typeStr)), AggregationTemporality: "AGGREGATION_TEMPORALITY_CUMULATIVE", DimensionsCacheSize: defaultDimensionsCacheSize, - skipSanitizeLabel: featuregate.GetRegistry().IsEnabled(dropSanitizationGate.GetID()), + skipSanitizeLabel: featuregate.GetRegistry().IsEnabled(dropSanitizationGateID), } }