Skip to content

Commit

Permalink
[receiver/snowflake] Change the type of Config.Password to be `conf…
Browse files Browse the repository at this point in the history
…igopaque.String` (#24065)

**Description:**
Split out from: #17353

**Link to tracking Issue:** #17273
  • Loading branch information
mackjmr committed Jul 18, 2023
1 parent f7fbcd2 commit 4232e5e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
20 changes: 20 additions & 0 deletions .chloggen/snowflake-use-configopaque.yaml
Original file line number Diff line number Diff line change
@@ -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/snowflake

# 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:
2 changes: 1 addition & 1 deletion receiver/snowflakereceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func buildDSN(cfg Config) string {
conf := &sf.Config{
Account: cfg.Account,
User: cfg.Username,
Password: cfg.Password,
Password: string(cfg.Password),
Database: cfg.Database,
Schema: cfg.Schema,
Role: cfg.Role,
Expand Down
15 changes: 8 additions & 7 deletions receiver/snowflakereceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package snowflakereceiver // import "github.com/open-telemetry/opentelemetry-col
import (
"errors"

"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/receiver/scraperhelper"
"go.uber.org/multierr"

Expand All @@ -22,13 +23,13 @@ var (
type Config struct {
scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
metadata.MetricsBuilderConfig `mapstructure:",squash"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Account string `mapstructure:"account"`
Schema string `mapstructure:"schema"`
Warehouse string `mapstructure:"warehouse"`
Database string `mapstructure:"database"`
Role string `mapstructure:"role"`
Username string `mapstructure:"username"`
Password configopaque.String `mapstructure:"password"`
Account string `mapstructure:"account"`
Schema string `mapstructure:"schema"`
Warehouse string `mapstructure:"warehouse"`
Database string `mapstructure:"database"`
Role string `mapstructure:"role"`
}

func (cfg *Config) Validate() error {
Expand Down
1 change: 1 addition & 0 deletions receiver/snowflakereceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/snowflakedb/gosnowflake v1.6.18
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/component v0.81.0
go.opentelemetry.io/collector/config/configopaque v0.81.0
go.opentelemetry.io/collector/confmap v0.81.0
go.opentelemetry.io/collector/consumer v0.81.0
go.opentelemetry.io/collector/pdata v1.0.0-rcv0013
Expand Down
2 changes: 2 additions & 0 deletions receiver/snowflakereceiver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4232e5e

Please sign in to comment.