improve(go.d/nvidia_smi): add autodetection_retry option (#21311)
Ilya Mashchenko committed
Nov 17, 2025 at 19:44 UTC
ba6b62cd74650f23585fb66df3dc8675cc082cfb
5 files changed
+15
-5
src/go/plugin/go.d/collector/nvidia_smi/collector.go
+5
-4
@@ -44,10 +44,11 @@ func New() *Collector {
44
}
45
46
type Config struct {
47
- UpdateEvery int `yaml:"update_every,omitempty" json:"update_every"`
48
- Timeout confopt.Duration `yaml:"timeout,omitempty" json:"timeout"`
49
- BinaryPath string `yaml:"binary_path" json:"binary_path"`
50
- LoopMode bool `yaml:"loop_mode,omitempty" json:"loop_mode"`
47
+ UpdateEvery int `yaml:"update_every,omitempty" json:"update_every"`
48
+ AutoDetectionRetry int `yaml:"autodetection_retry,omitempty" json:"autodetection_retry"`
49
+ Timeout confopt.Duration `yaml:"timeout,omitempty" json:"timeout"`
50
+ BinaryPath string `yaml:"binary_path" json:"binary_path"`
51
+ LoopMode bool `yaml:"loop_mode,omitempty" json:"loop_mode"`
52
}
53
54
type Collector struct {
src/go/plugin/go.d/collector/nvidia_smi/config_schema.json
+7
@@ -11,6 +11,13 @@
11
"minimum": 1,
12
"default": 10
13
},
14
+ "autodetection_retry": {
15
+ "title": "Detection retry",
16
+ "description": "Recheck interval in seconds. Zero means no recheck will be scheduled.",
17
+ "type": "integer",
18
+ "minimum": 0,
19
+ "default": 60
20
+ },
21
"binary_path": {
22
"title": "Binary path",
23
"description": "Path to the `nvidia-smi` binary.",
src/go/plugin/go.d/collector/nvidia_smi/metadata.yaml
+1
-1
@@ -57,7 +57,7 @@ modules:
57
default_value: 10
58
required: false
59
- name: autodetection_retry
60
- description: Recheck interval in seconds. Zero means no recheck will be scheduled.
60
+ description: Autodetection retry interval (seconds). Set 0 to disable.
61
default_value: 0
62
required: false
63
- name: binary_path
src/go/plugin/go.d/collector/nvidia_smi/testdata/config.json
+1
@@ -1,5 +1,6 @@
1
{
2
"update_every": 123,
3
+ "autodetection_retry": 123,
4
"timeout": 123.123,
5
"binary_path": "ok",
6
"loop_mode": true
src/go/plugin/go.d/collector/nvidia_smi/testdata/config.yaml
+1
@@ -1,4 +1,5 @@
1
update_every: 123
2
+autodetection_retry: 123
3
timeout: 123.123
4
binary_path: "ok"
5
loop_mode: true