fix(parsers.json_v2): Log inner errors (#14296)

This commit is contained in:
Joshua Powers 2023-11-15 02:14:31 -07:00 committed by GitHub
parent 004f81651b
commit a590a1b5b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -346,6 +346,7 @@ func (p *Parser) expandArray(result MetricNode, timestamp time.Time) ([]telegraf
n.ParentIndex = n.Index + result.ParentIndex
r, err := p.combineObject(n, timestamp)
if err != nil {
p.Log.Error(err)
return false
}
@ -366,6 +367,7 @@ func (p *Parser) expandArray(result MetricNode, timestamp time.Time) ([]telegraf
n.ParentIndex = n.Index + result.ParentIndex
r, err := p.expandArray(n, timestamp)
if err != nil {
p.Log.Error(err)
return false
}
results = append(results, r...)
@ -586,6 +588,7 @@ func (p *Parser) combineObject(result MetricNode, timestamp time.Time) ([]telegr
if val.IsObject() {
results, err = p.combineObject(arrayNode, timestamp)
if err != nil {
p.Log.Error(err)
return false
}
} else {
@ -593,6 +596,7 @@ func (p *Parser) combineObject(result MetricNode, timestamp time.Time) ([]telegr
arrayNode.ParentIndex -= result.Index
r, err := p.expandArray(arrayNode, timestamp)
if err != nil {
p.Log.Error(err)
return false
}
results = cartesianProduct(r, results)