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: collapsed fields by calling more indepth function #10430

Merged
merged 12 commits into from
Jan 27, 2022

Conversation

MyaLongmire
Copy link
Contributor

@MyaLongmire MyaLongmire commented Jan 12, 2022

Required for all PRs:

resolves #9470

Changes calling node.RenderQualified to calling smi.RenderOid as a suggestion of @Hipska

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Jan 12, 2022
Copy link
Contributor

@Hipska Hipska left a comment

Choose a reason for hiding this comment

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

Hmm, no test changes and all tests succeed, so no change in behaviour? Do you have before and after output please?

@MyaLongmire
Copy link
Contributor Author

I did not test against the user's mib. Just implemented the idea you were adamant about.

@Hipska
Copy link
Contributor

Hipska commented Jan 13, 2022

Adamant? Sorry, if you have another or better solution, please be my guest and implement as You want. I just want to make sure the previous behaviour is restored..

Copy link
Contributor

@Hipska Hipska left a comment

Choose a reason for hiding this comment

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

Good that you found a way without using smi.RenderOid, but I think there are still some mistakes.

internal/snmp/translate.go Outdated Show resolved Hide resolved
internal/snmp/translate.go Outdated Show resolved Hide resolved
plugins/inputs/snmp_trap/snmp_trap_test.go Outdated Show resolved Hide resolved
plugins/inputs/snmp_trap/snmp_trap_test.go Outdated Show resolved Hide resolved
@MyaLongmire MyaLongmire marked this pull request as draft January 19, 2022 15:07
@MyaLongmire
Copy link
Contributor Author

I don't think this is the right way to do either. I am going to mark this as a draft and try a different idea.

@Hipska
Copy link
Contributor

Hipska commented Jan 26, 2022

The latest build even hangs when trying to start up..

Nevermind, that was my fault by trying to put it in a docker container 😛

@Hipska Hipska marked this pull request as ready for review January 26, 2022 20:10
@sspaink
Copy link
Contributor

sspaink commented Jan 26, 2022

@reimda and I took a look at the failing tests and noticed that the test2 mibs file hadn't setup sysUpTimeInstance and coldstart correctly therefore it was adding the trailing numbers we went ahead and fixed it and pushed a commit. The new code for TrapLookup looks good but we also need to add a test case for partially resolved names like the issue has (e.g. enterprises.232.165.1.1.1).

@Hipska
Copy link
Contributor

Hipska commented Jan 27, 2022

Yes I know it needs to have a test. I asked @MyaLongmire to help with that.

Copy link
Contributor

@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.

Hey @MyaLongmire, please make the error messages starting lowercase... :-)

internal/snmp/translate.go Outdated Show resolved Hide resolved
@Hipska Hipska mentioned this pull request Jan 27, 2022
7 tasks
@Hipska Hipska self-assigned this Jan 27, 2022
plugins/inputs/snmp_trap/snmp_trap_test.go Outdated Show resolved Hide resolved
@@ -111,22 +111,29 @@ type MibEntry struct {
}

func TrapLookup(oid string) (e MibEntry, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be nicer if we just passed an Oid type instead of string?

Suggested change
func TrapLookup(oid string) (e MibEntry, err error) {
func TrapLookup(givenOid types.Oid) (e MibEntry, err error) {

Copy link
Contributor

@reimda reimda Jan 27, 2022

Choose a reason for hiding this comment

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

The oid arrives from the trap through gosnmp as a string. If we make TrapLookup take gosmi's types.Oid, we would have to convert from string to types.Oid everywhere TrapLookup (aka lookupFunc) is called. Makes sense to me to leave the argument a string.

Copy link
Contributor

@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.

The code looks good to me. I don't have any preference regarding @Hipska's comment on passing an OID struct instead of a string. However, the commented code section should be removed.

@Hipska Hipska 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 Jan 27, 2022
… to internal/snmp. Remove remaining translate test from plugins/inputs/snmp_trap.
@reimda reimda merged commit 84c1efb into master Jan 27, 2022
@reimda reimda deleted the snmp-trap-collapsed-fields branch January 27, 2022 21:38
reimda pushed a commit that referenced this pull request Jan 27, 2022
@Hipska Hipska restored the snmp-trap-collapsed-fields branch January 28, 2022 08:05
@Hipska Hipska deleted the snmp-trap-collapsed-fields branch January 28, 2022 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/snmp fix pr to fix corresponding bug 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.

some fields are collapsed in input.snmp_trap
5 participants