fix(parsers/xpath): Reduce debug messages when empty selection is allowed (#11302)
This commit is contained in:
parent
05285a1fdb
commit
2424852aa7
|
|
@ -100,11 +100,9 @@ func (p *Parser) Parse(buf []byte) ([]telegraf.Metric, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(selectedNodes) < 1 || selectedNodes[0] == nil {
|
||||
if (len(selectedNodes) < 1 || selectedNodes[0] == nil) && !p.AllowEmptySelection {
|
||||
p.debugEmptyQuery("metric selection", doc, config.Selection)
|
||||
if !p.AllowEmptySelection {
|
||||
return metrics, fmt.Errorf("cannot parse with empty selection node")
|
||||
}
|
||||
return metrics, fmt.Errorf("cannot parse with empty selection node")
|
||||
}
|
||||
p.Log.Debugf("Number of selected metric nodes: %d", len(selectedNodes))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue