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.gnmi): Rework plugin #14091

Merged
merged 9 commits into from
Oct 31, 2023
Merged

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Oct 11, 2023

resolves #14044
resolves #14063

This PR reworks the GNMI input plugin to untangle the functions and get a clearer structure. The new code is easier to follow and has a better modularity.
In the course of restructuring issue #14044 is fixed and a unit-test for the issue was added. Furthermore, we can now guess the path tag for strange devices (as e.g. reported in #14044) that do not provide prefix information.

@telegraf-tiger telegraf-tiger bot added area/gnmi 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 11, 2023
@whizkidTRW
Copy link

Yes, that works! And I think this formatting of the field names by default is much better.

I almost didn't think it was working but in simplifying the config for testing, I found the problem. The fieldpass config I had been using all along was blocking it with this new 1.29.0 binary as the returned field names have changed vs. previous versions.

For anyone else interested in the details, the fields were coming through as (up through 1.26.3):

Ciena:/oc_if:interfaces/oc_if:interface/oc_if:state/oc_if:countersCiena:/out_octets=330249284806i

but now with this new code, they are:

out_octets=35445208113i

And, apparently, this was also changed starting in 1.27.0 as now those versions work too just as long as the fieldpass is updated accordingly. My apologies in not catching it earlier! From 1.27.0 to the latest (1.28.2), the fields come through as this: (notice the lack of Ciena on the end of oc_if:counters)

Ciena:/oc_if:interfaces/oc_if:interface/oc_if:state/oc_if:counters/out_octets=35457943306i

And, to clarify, for versions 1.27.0 thru 1.28.2, setting origin = "Ciena" causes the above (1.29.0) shortened behavior to occur as well. Versions prior to 1.27.0 have a bug where the field comes through like this if origin = "Ciena":

iena:/out_octets=330286427762i

@srebhan
Copy link
Member Author

srebhan commented Oct 11, 2023

@whizkidTRW there is also a canonical_field_names option which should bring back the long field names... Just in case you like cryptic names... ;-P

@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 Oct 11, 2023
@whizkidTRW
Copy link

LOL That's good to know, but I'm good. I was already overriding them to something sensical, very close to the new output . . .

Thanks!

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.

wow - thank you for improving this plugin.

@powersj
Copy link
Contributor

powersj commented Oct 31, 2023

@srebhan 2 conflicts to address, then feel free to land it

@powersj powersj assigned srebhan and unassigned powersj Oct 31, 2023
@telegraf-tiger
Copy link
Contributor

@srebhan srebhan requested a review from powersj October 31, 2023 16:50
@srebhan srebhan merged commit c6f1c66 into influxdata:master Oct 31, 2023
4 checks passed
@srebhan srebhan deleted the gnmi_issue_14044 branch October 31, 2023 16:51
@github-actions github-actions bot added this to the v1.29.0 milestone Oct 31, 2023
Hipska added a commit to Super-Visions/telegraf that referenced this pull request Nov 2, 2023
…nmp_lookup

* upstream/master:
  chore(linters): Fix findings found by testifylint: expected-actual (influxdata#14229)
  chore(deps): Bump github.com/nats-io/nkeys from 0.4.5 to 0.4.6 (influxdata#14225)
  feat(inputs.procstat)!: Remove useless zero cpu_times (influxdata#14224)
  feat(inputs.gnmi): Rework plugin (influxdata#14091)
  fix(outputs.timestream): Clip uint64 values (influxdata#14213)
  fix(inputs.cgroup): Escape backslashes (influxdata#14187)
  test(outputs.kafka): Use private network for testing (influxdata#14220)
  test(inputs.vault): Fix integration test by only testing for subset (influxdata#14222)
  fix(outputs.elasticsearch): Print error status value (influxdata#14115)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gnmi 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.

inputs.gnmi fails when metric-name is empty GNMI / Got empty metric-name for response /
3 participants