-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(inputs.gnmi): Handle canonical field-name correctly (#14953)
- Loading branch information
Showing
4 changed files
with
204 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
plugins/inputs/gnmi/testcases/issue_14946_canonical_field_names/expected.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gnmi_sys_memory,path=/system/memory/state,source=127.0.0.1 /system/memory/state/reserved=6359478272u,/system/memory/state/used=3479629824u 1709737743568119333 | ||
gnmi_sys_memory,source=127.0.0.1 /system/memory/state/used=3479527424u 1709737753565697718 | ||
gnmi_sys_cpu,index=ALL,source=127.0.0.1 /system/cpus/cpu/state/hardware_interrupt/min_time=1709805333568034887u 1709805333566280930 | ||
gnmi_sys_cpu,index=ALL,path=/system/cpus/cpu/state,source=127.0.0.1 /system/cpus/cpu/state/hardware_interrupt/min_time=1709805343567684412u,/system/cpus/cpu/state/idle/avg=89u,/system/cpus/cpu/state/idle/instant=90u 1709805343565718902 |
182 changes: 182 additions & 0 deletions
182
plugins/inputs/gnmi/testcases/issue_14946_canonical_field_names/responses.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
[ | ||
{ | ||
"update": { | ||
"timestamp": "1709737743568119333", | ||
"prefix": { | ||
"elem": [ | ||
{ | ||
"name": "system" | ||
}, | ||
{ | ||
"name": "memory" | ||
}, | ||
{ | ||
"name": "state" | ||
} | ||
] | ||
}, | ||
"update": [ | ||
{ | ||
"path": { | ||
"elem": [ | ||
{ | ||
"name": "reserved" | ||
} | ||
] | ||
}, | ||
"val": { | ||
"uintVal": "6359478272" | ||
} | ||
}, | ||
{ | ||
"path": { | ||
"elem": [ | ||
{ | ||
"name": "used" | ||
} | ||
] | ||
}, | ||
"val": { | ||
"uintVal": "3479629824" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"update": { | ||
"timestamp": "1709737753565697718", | ||
"update": [ | ||
{ | ||
"path": { | ||
"elem": [ | ||
{ | ||
"name": "system" | ||
}, | ||
{ | ||
"name": "memory" | ||
}, | ||
{ | ||
"name": "state" | ||
}, | ||
{ | ||
"name": "used" | ||
} | ||
] | ||
}, | ||
"val": { | ||
"uintVal": "3479527424" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"update": { | ||
"timestamp": "1709805333566280930", | ||
"update": [ | ||
{ | ||
"path": { | ||
"elem": [ | ||
{ | ||
"name": "system" | ||
}, | ||
{ | ||
"name": "cpus" | ||
}, | ||
{ | ||
"name": "cpu", | ||
"key": { | ||
"index": "ALL" | ||
} | ||
}, | ||
{ | ||
"name": "state" | ||
}, | ||
{ | ||
"name": "hardware-interrupt" | ||
}, | ||
{ | ||
"name": "min-time" | ||
} | ||
] | ||
}, | ||
"val": { | ||
"uintVal": "1709805333568034887" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"update": { | ||
"timestamp": "1709805343565718902", | ||
"prefix": { | ||
"elem": [ | ||
{ | ||
"name": "system" | ||
}, | ||
{ | ||
"name": "cpus" | ||
}, | ||
{ | ||
"name": "cpu", | ||
"key": { | ||
"index": "ALL" | ||
} | ||
}, | ||
{ | ||
"name": "state" | ||
} | ||
] | ||
}, | ||
"update": [ | ||
{ | ||
"path": { | ||
"elem": [ | ||
{ | ||
"name": "hardware-interrupt" | ||
}, | ||
{ | ||
"name": "min-time" | ||
} | ||
] | ||
}, | ||
"val": { | ||
"uintVal": "1709805343567684412" | ||
} | ||
}, | ||
{ | ||
"path": { | ||
"elem": [ | ||
{ | ||
"name": "idle" | ||
}, | ||
{ | ||
"name": "avg" | ||
} | ||
] | ||
}, | ||
"val": { | ||
"uintVal": "89" | ||
} | ||
}, | ||
{ | ||
"path": { | ||
"elem": [ | ||
{ | ||
"name": "idle" | ||
}, | ||
{ | ||
"name": "instant" | ||
} | ||
] | ||
}, | ||
"val": { | ||
"uintVal": "90" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] |
15 changes: 15 additions & 0 deletions
15
plugins/inputs/gnmi/testcases/issue_14946_canonical_field_names/telegraf.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[[inputs.gnmi]] | ||
addresses = ["dummy"] | ||
canonical_field_names = true | ||
|
||
[[inputs.gnmi.subscription]] | ||
name = "gnmi_sys_cpu" | ||
path = "/system/cpus/cpu/state" | ||
subscription_mode = "sample" | ||
sample_interval = "10s" | ||
|
||
[[inputs.gnmi.subscription]] | ||
name = "gnmi_sys_memory" | ||
path = "/system/memory/state" | ||
subscription_mode = "sample" | ||
sample_interval = "10s" |