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(inputs.snmp): Hint to use source tag #14111

Merged
merged 3 commits into from
Nov 13, 2023

Conversation

Hipska
Copy link
Contributor

@Hipska Hipska commented Oct 16, 2023

Required for all PRs

Related to #8011 and #4413

Add hint to use the source tag to standardise the snmp input by marking others as deprecated.

@telegraf-tiger telegraf-tiger bot added area/snmp feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Oct 16, 2023
@srebhan
Copy link
Member

srebhan commented Oct 17, 2023

@Hipska while I love the PR, the issue is that you double the cardinality (at least for InfluxDB) users with this change. Can you please add an option to switch between the existing tag and the new source tag!

@Hipska
Copy link
Contributor Author

Hipska commented Oct 17, 2023

The added tag isn't holding high cardinality, it is one of the values of the agents config.

@powersj
Copy link
Contributor

powersj commented Oct 17, 2023

While it is not a potential source of lots of different values, it does affects a user's cardinality unnecessarily. Hence the request for a config value to opt-in to the change, rather than force this on users and tell them how to opt-out after they realize the change.

@srebhan srebhan self-assigned this Oct 18, 2023
@Hipska
Copy link
Contributor Author

Hipska commented Oct 23, 2023

Meaning this PR is useless, as you can opt-in with the agent_host_tag setting already.

The intention of this PR was to have a source tag by default and not opt-in.

@powersj
Copy link
Contributor

powersj commented Oct 25, 2023

@Hipska what do you want to do with this PR then? Make it a doc change to suggest using "source" or close this?

@Hipska
Copy link
Contributor Author

Hipska commented Oct 26, 2023

I still would like to deprecate the agent_host_tag setting..

@powersj
Copy link
Contributor

powersj commented Oct 26, 2023

ok happy to see that, let us know when the PR is updated and ready for review again please

@powersj powersj added the waiting for response waiting for response from contributor label Oct 26, 2023
@Hipska
Copy link
Contributor Author

Hipska commented Oct 26, 2023

It is already done..

@telegraf-tiger telegraf-tiger bot removed the waiting for response waiting for response from contributor label Oct 26, 2023
@powersj
Copy link
Contributor

powersj commented Oct 26, 2023

Yes, but you have not changed anything with respect to our previous concerns around a new tag.

@Hipska
Copy link
Contributor Author

Hipska commented Oct 26, 2023

Correct.

The intention of this PR was to have a source tag by default and not opt-in.

@powersj
Copy link
Contributor

powersj commented Oct 26, 2023

Thomas,

I am not going to go around with you on this. Both Sven and I are in agreement that we are not making this change. As-is this PR will not be accepted.

If you wish to still deprecate the option, that is fine, but any new option must be opt-in.

@Hipska
Copy link
Contributor Author

Hipska commented Oct 26, 2023

Is it okay to have a warning in the log when the value of agent_host_tag is not "source" or if it is still the default?

@powersj
Copy link
Contributor

powersj commented Oct 26, 2023

If you mark the agent_host_tag as deprecated, that would result in two warnings for the user, right?

@Hipska
Copy link
Contributor Author

Hipska commented Oct 27, 2023

Sorry, I wasn't clear enough. In that case the property wouldn't be deprecated anymore, as we cannot say it is deprecated and at the same time ask to set it to a specific value.

So, I would do an if(agent_host_tag != "source"){log.warn("..")} instead of the regular deprecation message. As the current way I did by adding an additional source tag doesn't get accepted.

@srebhan
Copy link
Member

srebhan commented Oct 31, 2023

@Hipska I agree that we need to only conditionally warn if the setting is not "source". So how about

	if s.AgentHostTag != "source" {
		models.PrintOptionDeprecationNotice(telegraf.Warn, "inputs.snmp", "agent_host_tag", telegraf.DeprecationInfo{
			Since:  "1.29.0",
			Notice: `should be set to "source" and will thus be removed`,
		})
	}

which uses the deprecation-style and thus might trigger action while a usual warning will not...

@Hipska
Copy link
Contributor Author

Hipska commented Oct 31, 2023

Indeed, it was something like this I was hinting at. I will use PrintOptionValueDeprecationNotice instead..

@Hipska Hipska marked this pull request as draft October 31, 2023 09:57
@Hipska Hipska marked this pull request as ready for review November 7, 2023 15:13
@Hipska Hipska changed the title feat(inputs.snmp): Add default source tag feat(inputs.snmp): Hint to use source tag Nov 9, 2023
@Hipska

This comment was marked as outdated.

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 @Hipska!

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 10, 2023
@srebhan srebhan removed their assignment Nov 10, 2023
plugins/inputs/snmp/README.md Outdated Show resolved Hide resolved
plugins/inputs/snmp/snmp.go Outdated Show resolved Hide resolved
@telegraf-tiger
Copy link
Contributor

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.

Thank you!

@powersj powersj merged commit 2d8416c into influxdata:master Nov 13, 2023
23 checks passed
@github-actions github-actions bot added this to the v1.29.0 milestone Nov 13, 2023
@Hipska Hipska deleted the feat/inputs/snmp/source_tag branch November 13, 2023 14:09
@Hr0bar
Copy link
Contributor

Hr0bar commented Jan 5, 2024

Think its OK the way it is, but its still incredibly confusing for the user. We got hit by it:

2024-01-05T06:41:57Z W! DeprecationWarning: Value "agent_host" for option "agent_host_tag" of plugin "inputs.snmp" deprecated since version 1.29.0 and will be removed in : should be set to "source" for consistent usage across plugins

And had to look at this thread to understand why we are getting a deprecation for a DEFAULT value that we dont explicitly set. But I see it was the default default without setting it explicitly, so hard to find a good decision how to handle... but the docs could exaplain it better perhaps? This is quite confusing in the docs (without looking up more details elsewhere):

snmp
tags:
agent_host (deprecated in 1.29: use source instead)

If agent_host_tag should be "source" and anything else is deprecated, then perhaps the deprecation should be for the entire agent_host_tag option that should get removed entirely in the future though? Instead of deprecating ANY value other than "source". Otherwise the deprecation warning will be kept forever if the option to set it to something different is kept?

@srebhan
Copy link
Member

srebhan commented Jan 17, 2024

@Hr0bar a PR for an explanation in the README (or config) is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/snmp feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants