Skip to content

Influx parser fails to parse but returns no error #2297

@phemmer

Description

@phemmer

Bug report

package main

import (
	"fmt"

	"github.com/influxdata/telegraf/plugins/parsers"
)

func main() {
	p, _ := parsers.NewInfluxParser()
	m, err := p.Parse([]byte("test,foo=bar v=1i 123456789"))
	fmt.Printf("err=%v\n", err)
	fmt.Printf("m=%#v\n", m)
}

Expected behavior:

err=<nil>
m=[]telegraf.Metric{(*metric.metric)(0xc42009a480)}

Actual behavior:

err=<nil>
m=[]telegraf.Metric{}

Additional info:

It parses fine only if there is a trailing newline.

This is a regression. I noticed this while trying to update PR #2094. Code that was previously working is now failing. While I would argue that a trailing newline should not be required to parse, at the very least if it does not parse, it should return an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions