You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# HELP file_pools_active Telegraf collected metric
# TYPE file_pools_active untyped
file_pools_active{host="vm.example.com",pools_name="main"} 1
# HELP file_error_list_count Telegraf collected metric
# TYPE file_error_list_count untyped
file_error_list_count{error_list_name="SomeError",host="vm.example.com"} 3
Actual behavior
Contents of metrics.prometheus file:
# HELP file_pools_active Telegraf collected metric
# TYPE file_pools_active untyped
file_pools_active{host="vm.example.com",pools_name="main"} 1
Additional info
The result of execution is affected by the offset within the parent element of the fields whose value must be found. With minimal change in input data, for example change the value from 3 to 30 the output result becomes correct.
Modified input data:
# HELP file_pools_active Telegraf collected metric
# TYPE file_pools_active untyped
file_pools_active{host="vm.example.com",pools_name="main"} 1
# HELP file_error_list_count Telegraf collected metric
# TYPE file_error_list_count untyped
file_error_list_count{error_list_name="SomeError",host="vm.example.com"} 3
Presumably the problem is that the subPathResults variable may contain the results of parsing several objects. Later, when calling the existsInpathResults function, the data of another object corresponding to the specified index may be returned. Although an empty result should have been returned.
In my opinion, a possible solution could be to reset the subPathResults variable inside the processObjects function at each iteration cycle of the objects variable.
Code snippet:
func (p *Parser) processObjects(input []byte, objects []Object, timestamp time.Time) ([]telegraf.Metric, error) {
p.iterateObjects = true
var t []telegraf.Metric
for _, c := range objects {
p.subPathResults = nil
p.objectConfig = c
The text was updated successfully, but these errors were encountered:
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf 1.32.0-a0755797
Docker
No response
Steps to reproduce
./telegraf --once --config ./telegraf.conf
Expected behavior
Contents of metrics.prometheus file:
Actual behavior
Contents of metrics.prometheus file:
Additional info
The result of execution is affected by the offset within the parent element of the fields whose value must be found. With minimal change in input data, for example change the value from 3 to 30 the output result becomes correct.
Modified input data:
Contents of metrics.prometheus file:
Presumably the problem is that the subPathResults variable may contain the results of parsing several objects. Later, when calling the existsInpathResults function, the data of another object corresponding to the specified index may be returned. Although an empty result should have been returned.
In my opinion, a possible solution could be to reset the subPathResults variable inside the processObjects function at each iteration cycle of the objects variable.
Code snippet:
The text was updated successfully, but these errors were encountered: