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: parallelism fix for ifname processor #10007

Merged
merged 8 commits into from
Dec 3, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions plugins/processors/ifname/ifname.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,13 @@ type IfName struct {

lock sync.Mutex `toml:"-"`
cache *TTLCache `toml:"-"`
sigs sigMap `toml:"-"`
Hipska marked this conversation as resolved.
Show resolved Hide resolved

parallel parallel.Parallel `toml:"-"`
acc telegraf.Accumulator `toml:"-"`

getMapRemote mapFunc `toml:"-"`
makeTable makeTableFunc `toml:"-"`

gsBase snmp.GosnmpWrapper `toml:"-"`

sigs sigMap `toml:"-"`
}

const minRetry time.Duration = 5 * time.Minute
Expand Down Expand Up @@ -195,7 +192,7 @@ func (d *IfName) Start(acc telegraf.Accumulator) error {
d.acc = acc

var err error
d.gsBase, err = snmp.NewWrapper(d.ClientConfig)
_, err = snmp.NewWrapper(d.ClientConfig)
if err != nil {
return fmt.Errorf("parsing SNMP client config: %w", err)
}
Expand Down Expand Up @@ -299,7 +296,7 @@ func (d *IfName) getMap(agent string) (entry nameMap, age time.Duration, err err
}

func (d *IfName) getMapRemoteNoMock(agent string) (nameMap, error) {
gs := d.gsBase
gs, _ := snmp.NewWrapper(d.ClientConfig)
Hipska marked this conversation as resolved.
Show resolved Hide resolved
err := gs.SetAgent(agent)
if err != nil {
return nil, fmt.Errorf("parsing agent tag: %w", err)
Expand Down