go.d/nvidia_smi: use configured "timeout" in loop mode (#18692)
Ilya Mashchenko committed
Oct 6, 2024 at 15:32 UTC
108e5936d1bc76a72baca01229aa059a9d8d16a4
3 files changed
+5
-5
src/go/plugin/go.d/modules/nvidia_smi/config_schema.json
+2
-2
@@ -19,7 +19,7 @@
19
},
20
"timeout": {
21
"title": "Timeout",
22
- "description": "Timeout for executing the binary, specified in seconds.",
22
+ "description": "The maximum duration, in seconds, to wait for an `nvidia-smi` command to complete.",
23
"type": "number",
24
"minimum": 0.5,
25
"default": 10
@@ -47,7 +47,7 @@
47
"ui:help": "If an absolute path is provided, the collector will use it directly; otherwise, it will search for the binary in directories specified in the PATH environment variable."
48
},
49
"timeout": {
50
- "ui:help": "Accepts decimals for precise control (e.g., type 1.5 for 1.5 seconds)."
50
+ "ui:help": "This setting applies differently based on the collector's mode. **Loop Mode:** In loop mode, the timeout primarily determines how long to wait for the initial `nvidia-smi` execution. If the initial query takes longer than the timeout, the collector may report an error. For systems with multiple GPUs, the initial load time can sometimes be significant (e.g., 5-10 seconds). **Regular Mode:** If the collector is in regular mode, the timeout specifies how long to wait for each individual `nvidia-smi` execution."
51
},
52
"loop_mode": {
53
"ui:help": "In loop mode, `nvidia-smi` will repeatedly query GPU data at specified intervals, defined by the `-l SEC` or `--loop=SEC` parameter, rather than just running the query once. This enables ongoing performance tracking by putting the application to sleep between queries."
src/go/plugin/go.d/modules/nvidia_smi/exec.go
+1
-1
@@ -34,7 +34,7 @@ func newNvidiaSmiBinary(path string, cfg Config, log *logger.Logger) (nvidiaSmiB
34
Logger: log,
35
binPath: path,
36
updateEvery: cfg.UpdateEvery,
37
- firstSampleTimeout: time.Second * 3,
37
+ firstSampleTimeout: cfg.Timeout.Duration(),
38
}
39
40
if err := smi.run(); err != nil {
src/go/plugin/go.d/modules/nvidia_smi/metadata.yaml
+2
-2
@@ -65,8 +65,8 @@ modules:
65
default_value: nvidia_smi
66
required: false
67
- name: timeout
68
- description: nvidia_smi binary execution timeout.
69
- default_value: 2
68
+ description: The maximum duration, in seconds, to wait for an `nvidia-smi` command to complete. This setting applies differently based on the collector's mode. **Loop Mode:** In loop mode, the timeout primarily determines how long to wait for the initial `nvidia-smi` execution. If the initial query takes longer than the timeout, the collector may report an error. For systems with multiple GPUs, the initial load time can sometimes be significant (e.g., 5-10 seconds). **Regular Mode:** If the collector is in regular mode, the timeout specifies how long to wait for each individual `nvidia-smi` execution.
69
+ default_value: 10
70
required: false
71
- name: loop_mode
72
description: "When enabled, `nvidia-smi` is executed continuously in a separate thread using the `-l` option."