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

feat: add settings for go sql.DB settings #11551

Merged
merged 3 commits into from
Jul 29, 2022
Merged

Conversation

reimda
Copy link
Contributor

@reimda reimda commented Jul 26, 2022

resolves #11498

The golang SQL API exposes a few settings related to pooled connections. (see https://pkg.go.dev/database/sql#DB) These settings need to be changed for some SQL drivers to connect reliably to some databases.

This PR adds telegraf settings that mirror the golang sql settings. This allows users to set them through telegraf.conf and be able to connect to databases that require specific settings.

The golang sql settings have defaults and since telegraf didn't set the settings, it was using the defaults. I mirrored the default values in the new telegraf settings. This should make the sql output behave the same as before.

@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Jul 26, 2022
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @reimda for the fix. I only have a comment about option naming to make it consistent with the sql input plugin...

plugins/outputs/sql/sample.conf Outdated Show resolved Hide resolved
@srebhan srebhan self-assigned this Jul 28, 2022
@srebhan srebhan added plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins area/sql labels Jul 28, 2022
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for jumping on this one!

@telegraf-tiger
Copy link
Contributor

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @reimda! Looks good to me.

@srebhan srebhan merged commit 6721187 into master Jul 29, 2022
@srebhan srebhan deleted the sql-db-generic-settings branch July 29, 2022 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sql feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

outputs.mysql loses connection to sql server after 24-36 hours
4 participants