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

fix (inputs/mongodb): Add direct connection to mongod plugin #10098

Conversation

denispershin
Copy link
Contributor

@denispershin denispershin commented Nov 11, 2021

Required for all PRs:

Since 1.19.2 version, telegraf collect statistics from primary node, even if secondary node was specified. It can be fixed with connection=direct with connection string in config file, but I think this MR better way to fix this problem, no any action from users required.

resolves #9555

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Nov 11, 2021
@denispershin denispershin force-pushed the add-direct-connection-to-mongod-plugin branch from 6a6dab6 to 1609c5e Compare November 11, 2021 22:51
@denispershin denispershin changed the title Add direct connection to mongod plugin fix (inputs/mongodb): Add direct connection to mongod plugin Nov 11, 2021
@denispershin denispershin force-pushed the add-direct-connection-to-mongod-plugin branch from 1609c5e to bd6bda8 Compare November 11, 2021 22:54
@telegraf-tiger
Copy link
Contributor

@srebhan
Copy link
Member

srebhan commented Dec 1, 2021

To be honest I would prefer documenting the option to set connection=direct to the connection string instead of adding (redundant) code. @reimda any preference?

@denispershin
Copy link
Contributor Author

To be honest I would prefer documenting the option to set connection=direct to the connection string instead of adding (redundant) code. @reimda any preference?

it could, but i guess, that many developers just update telegraf and can't realize that they receive wrong data, after they understand it, tried figure out what the problem and after many hours they may be remember about documentation, find what changed and fix it.
In this fix, no any action needed from user side.

@srebhan
Copy link
Member

srebhan commented Dec 2, 2021

@denispershin I understand your point, but changing the behavior of telegraf will fix the problem for you , but it might break the setup of other people that rely on the current behavior. So changing the behavior by default cannot be done anyway as telegraf "guarantees" that your existing config will exhibit the same behavior for minor-version updates.

This being said, the difference is either setting the connection=direct option in the server string OR setting an explicit option direct_connection = true in the config. The later is more explicit but comes with all the burden of redundancy. What if direct_connection is set to true but the server string contains directConnection=false etc.
Another point is that the first (specifying options via the server string) is extensively documented and does provide a ton of other options. We really don't want to duplicate those.

So my suggestion would be to add a big warning to the config option, that you need to set directConnection=true on secondaries if you want to get data from there...

Let's see what the Influx people think about it...

@srebhan
Copy link
Member

srebhan commented Feb 15, 2022

@denispershin after having talked to the Influx people, we agreed on that having that option in the connection string is good enough. However, we also agreed on that the documentation could be improved maybe spending an extra section or a heads-up on this fact. Are you willing to enhance the documentation of the current behavior and the use of connection=direct?

@Hipska Hipska added waiting for response waiting for response from contributor and removed needs design review labels Feb 22, 2022
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Mar 1, 2022

Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Page. Thank you!

@telegraf-tiger telegraf-tiger bot closed this Mar 1, 2022
@telegraf-tiger telegraf-tiger bot removed the waiting for response waiting for response from contributor label Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mongodb fix pr to fix corresponding bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MongoDB Input Plugin unexcepted output
3 participants