-
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
feat(plugins.nvidia_smi): Implement Probe()
#16305
base: master
Are you sure you want to change the base?
feat(plugins.nvidia_smi): Implement Probe()
#16305
Conversation
Probe()
Probe()
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
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.
Thank you for the PR @LandonTClipp! I do have two comments in the code and want to ask you to split the PR into
- adding the probing framework
- adding probing support to NVidia SMI
func (r *RunningInput) Probe() error { | ||
p, ok := r.Input.(telegraf.ProbePlugin) | ||
if !ok || r.Config.StartupErrorBehavior != "probe" { | ||
r.log.Debug("Not probing plugin") | ||
return nil | ||
} | ||
r.log.Debug("Probing plugin") | ||
return p.Probe() | ||
} | ||
|
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.
Please remove the debug messages here as they don't add value for the user!
func (r *RunningInput) Probe() error { | |
p, ok := r.Input.(telegraf.ProbePlugin) | |
if !ok || r.Config.StartupErrorBehavior != "probe" { | |
r.log.Debug("Not probing plugin") | |
return nil | |
} | |
r.log.Debug("Probing plugin") | |
return p.Probe() | |
} | |
func (r *RunningInput) Probe() error { | |
p, ok := r.Input.(telegraf.ProbePlugin) | |
if !ok || r.Config.StartupErrorBehavior != "probe" { | |
return nil | |
} | |
return p.Probe() | |
} | |
|
||
type mockProbingInput struct { | ||
probeReturn error | ||
} | ||
|
||
func (m *mockProbingInput) SampleConfig() string { | ||
return "" | ||
} | ||
|
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.
I think you don't need the test here as the testing in running_input_test.go
already covers the case...
Summary
This PR implements tsd-009 at various levels:
Probe
method to thenvidia_smi
plugin.Probe
method to theRunningInput
model that will selectively call theProbe
method of the plugin if available and configured as such instartup_error_behavior
.Start
method ofRunningInput
such that if the plugin returns an error fromStart
, we treat it the same asstartup_error_behavior = ignore
.Agent
to callRunningInput.Probe()
after the plugin has started. IfProbe()
returns a non-nil error, the agent will unconditionally skip the plugin.Checklist
Related issues
inputs.nvidia-smi
: Add config option to test a single run of nvidia-smi on plugin startup #15915probe_on_startup
: Add input config and interface similar tostartup_error_behavior
#16028