diff --git a/.chloggen/rabbitmq-use-configopaque.yaml b/.chloggen/rabbitmq-use-configopaque.yaml new file mode 100755 index 000000000000..ed09ef1b322d --- /dev/null +++ b/.chloggen/rabbitmq-use-configopaque.yaml @@ -0,0 +1,20 @@ +# Use this changelog template to create an entry for release notes. +# If your change doesn't affect end users, such as a test fix or a tooling change, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: receiver/rabbitmq + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Change the type of `Config.Password` to be `configopaque.String` + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [17273] + +# (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: diff --git a/receiver/rabbitmqreceiver/client.go b/receiver/rabbitmqreceiver/client.go index e5ddd9f6cc2d..f0888e0f9ae7 100644 --- a/receiver/rabbitmqreceiver/client.go +++ b/receiver/rabbitmqreceiver/client.go @@ -49,7 +49,7 @@ func newClient(cfg *Config, host component.Host, settings component.TelemetrySet hostEndpoint: cfg.Endpoint, creds: rabbitmqCredentials{ username: cfg.Username, - password: cfg.Password, + password: string(cfg.Password), }, logger: logger, }, nil diff --git a/receiver/rabbitmqreceiver/client_test.go b/receiver/rabbitmqreceiver/client_test.go index 21653a2113b4..e45fcfb6fc8b 100644 --- a/receiver/rabbitmqreceiver/client_test.go +++ b/receiver/rabbitmqreceiver/client_test.go @@ -81,7 +81,7 @@ func TestNewClient(t *testing.T) { require.True(t, ok) require.Equal(t, tc.cfg.Username, actualClient.creds.username) - require.Equal(t, tc.cfg.Password, actualClient.creds.password) + require.Equal(t, string(tc.cfg.Password), actualClient.creds.password) require.Equal(t, tc.cfg.Endpoint, actualClient.hostEndpoint) require.Equal(t, tc.logger, actualClient.logger) require.NotNil(t, actualClient.client) diff --git a/receiver/rabbitmqreceiver/config.go b/receiver/rabbitmqreceiver/config.go index 30d349a22511..1d2c211b475e 100644 --- a/receiver/rabbitmqreceiver/config.go +++ b/receiver/rabbitmqreceiver/config.go @@ -9,6 +9,7 @@ import ( "net/url" "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/config/configopaque" "go.opentelemetry.io/collector/receiver/scraperhelper" "go.uber.org/multierr" @@ -29,8 +30,8 @@ const defaultEndpoint = "http://localhost:15672" type Config struct { scraperhelper.ScraperControllerSettings `mapstructure:",squash"` confighttp.HTTPClientSettings `mapstructure:",squash"` - Username string `mapstructure:"username"` - Password string `mapstructure:"password"` + Username string `mapstructure:"username"` + Password configopaque.String `mapstructure:"password"` metadata.MetricsBuilderConfig `mapstructure:",squash"` } diff --git a/receiver/rabbitmqreceiver/go.mod b/receiver/rabbitmqreceiver/go.mod index 8148bafaf84c..0d223dd74188 100644 --- a/receiver/rabbitmqreceiver/go.mod +++ b/receiver/rabbitmqreceiver/go.mod @@ -9,6 +9,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.81.0 go.opentelemetry.io/collector/config/confighttp v0.81.0 + go.opentelemetry.io/collector/config/configopaque v0.81.0 go.opentelemetry.io/collector/config/configtls v0.81.0 go.opentelemetry.io/collector/confmap v0.81.0 go.opentelemetry.io/collector/consumer v0.81.0 @@ -45,7 +46,6 @@ require ( go.opentelemetry.io/collector v0.81.0 // indirect go.opentelemetry.io/collector/config/configauth v0.81.0 // indirect go.opentelemetry.io/collector/config/configcompression v0.81.0 // indirect - go.opentelemetry.io/collector/config/configopaque v0.81.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.81.0 // indirect go.opentelemetry.io/collector/config/internal v0.81.0 // indirect go.opentelemetry.io/collector/exporter v0.81.0 // indirect