-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
SqlServer - Modified how default server list is set #8655
Conversation
Merging original master to forked master
@ssoroka - As per conversation here, I've moved the default server list setting to the init method. Could you please help review the same? @Trovalo, @denzilribeiro - FYI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @avinash-nigam, could you please outline why you are introducing the NewSQLServer()
function? It's not that the change cannot be accepted, but why not doing the minimum necessary change?
@srebhan - This was introduced with the thought that if we need extra processing steps before creating the initializing object, then those can be done in this function. I see such usage in other plug-ins too. Having said that, I see no harm in directly initializing in the init method instead of creating a separate method. |
@avinash-nigam please see my comment above and let me know on how to proceed. |
@srebhan - I've updated code as per above conversation. |
@avinash-nigam the code looks good but let me ask one question: Now if the user enters an empty list, i.e. he/she uncomments the server line and specifies |
Yes @srebhan, the intention was to not throw an error (and obviously no metrics either) when the server list is defined as empty, considering it as an indication from the user to not process anything. This change's background context is here. Below is a summary of the points that were in consideration -
I'd happy to hear your thoughts on this. ++ @ssoroka |
@avinash-nigam I understand your comment, but I don't get why the user specifies a plugin and does not want to process anything!? I guess the more real-world use-case is that the user just forgot to specify the server list or did expect something wrong. This would only make sense for some automatically generated configs where the server-list might be empty, but then just fix the generator... To be honest I would rather error out in this case as most likely the user did something that is very unlikely to be wanted (forgot list or assumes some default behavior erroneously). |
But yeah, let @ssoroka decide. ;-) |
LGTM. I think you need to ask it from the user's perspective: "Ok so I've set the servers list to empty, and I start Telegraf. What do I expect it to do?". There's two cases: 1. I meant to set it to based on these I think you have your ideal answer: don't crash or error, but write out a warning in the (big i) |
I agree with the warning, but a different aspect is that a lot of other plugins use some sensible default on empty lists (like include everything etc.). From this perspective it might be unexpected that nothing is collected. But if there is a warning the user will likely be able to discover the problem if there is any. |
@ssoroka - As per your comment, added a warning when the server list is empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Required for all PRs:
For SqlServer plugin, modified how the default server list is set. This allows the following three scenarios -