Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register featuregate, otherwise does not work #16269

Merged
merged 1 commit into from
Nov 11, 2022
Merged
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
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