Skip to content

[receiver/sqlqueryreceiver]: break up datasource parameter into separate fields #39760

Closed
@justinianvoss22

Description

@justinianvoss22

Component(s)

receiver/sqlqueryreceiver

Is your feature request related to a problem? Please describe.

Right now, the datasource string does not have strong validation for the values in this string. We cannot directly pass encrypted passwords, send usernames, send additional options, without assembling the connection string with all of them. The current implementation breaks down when we start using encrypted sensitive values.

Describe the solution you'd like

My solution is to add an additional datasource_config parameter. This will have a struct DataSourceConfig struct that will have the fields: host, port, database, username, password, and additional_params. The struct will be parsed into the connection string in URL format. It is parsed differently depending on what driver is used.

Note: The receiver will use the datasource parameter if it is specified. If datasource is empty, then it will use the datasource_config struct parsed into a string.

Describe alternatives you've considered

An alternative would be to replace the existing datasource string value with this new struct. However, it makes sense to keep the same functionality, and check if datasource is empty in order to use the datasource_config struct.

Additional context

PR for this issue:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions