-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[confmap] Start deprecation processor for env var expand syntax ($ENV) #10144
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: deprecation | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: expandconverter | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Adds `confmap.allowEnvVarExpansion` feature gate to control use of $ENV syntax. | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [10144] | ||
|
||
# (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: Deprecates expandconverter | ||
|
||
# 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: [] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,6 +14,16 @@ import ( | |||||
"go.opentelemetry.io/collector/confmap/provider/httpprovider" | ||||||
"go.opentelemetry.io/collector/confmap/provider/httpsprovider" | ||||||
"go.opentelemetry.io/collector/confmap/provider/yamlprovider" | ||||||
"go.opentelemetry.io/collector/featuregate" | ||||||
) | ||||||
|
||||||
// PreventEnvVarExpansionFeatureGate is the feature gate that controls whether the collector | ||||||
// supports configuring the OpenTelemetry SDK via configuration | ||||||
var PreventEnvVarExpansionFeatureGate = featuregate.GlobalRegistry().MustRegister( | ||||||
"confmap.preventEnvVarExpansion", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think we should refine the name a bit, since we will still allow env var expansion even after the deprecation process. We could also say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have a single feature gate for all changes related to the environment variable revamp? Or should we have one for each change? I am inclined to say we should have one (easier to figure out how to revert back to the old behavior without having to understand its intricacies) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is another change? I thought There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making types stricter and unified between |
||||||
featuregate.StageAlpha, | ||||||
featuregate.WithRegisterDescription("controls whether the collector supports expanding $ENV in configuration"), | ||||||
featuregate.WithRegisterFromVersion("v0.101.0"), | ||||||
) | ||||||
|
||||||
// ConfigProvider provides the service configuration. | ||||||
|
@@ -132,6 +142,12 @@ func (cm *configProvider) GetConfmap(ctx context.Context) (*confmap.Conf, error) | |||||
} | ||||||
|
||||||
func newDefaultConfigProviderSettings(uris []string) ConfigProviderSettings { | ||||||
var converterFactories []confmap.ConverterFactory | ||||||
if !PreventEnvVarExpansionFeatureGate.IsEnabled() { | ||||||
converterFactories = []confmap.ConverterFactory{ | ||||||
expandconverter.NewFactory(), | ||||||
} | ||||||
} | ||||||
return ConfigProviderSettings{ | ||||||
ResolverSettings: confmap.ResolverSettings{ | ||||||
URIs: uris, | ||||||
|
@@ -142,7 +158,7 @@ func newDefaultConfigProviderSettings(uris []string) ConfigProviderSettings { | |||||
httpprovider.NewFactory(), | ||||||
httpsprovider.NewFactory(), | ||||||
}, | ||||||
ConverterFactories: []confmap.ConverterFactory{expandconverter.NewFactory()}, | ||||||
ConverterFactories: converterFactories, | ||||||
}, | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to explicitly call out SDK configuration here; I also don't think this has to do with the Collector's SDK instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I had a bad copy-paste