Skip to content

Commit

Permalink
Register featuregate, otherwise does not work (#16269)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Nov 11, 2022
1 parent 7e7703f commit 1750b99
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .chloggen/fixunregistergate.yaml
Original file line number Diff line number Diff line change
@@ -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]
19 changes: 11 additions & 8 deletions processor/spanmetricsprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion processor/spanmetricsprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down

0 comments on commit 1750b99

Please sign in to comment.