Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify http_listener error response with influxdb #4766

Merged
merged 3 commits into from
Oct 1, 2018
Merged

Conversation

glinton
Copy link
Contributor

@glinton glinton commented Sep 27, 2018

Resolves #4742

@danielnelson
Copy link
Contributor

The error strings need to match up with what the influxdb output expects to trigger the cases that will cause an upstream Telegraf to retry.

// Other partial write errors, such as "field type conflict", are not
// correctable at this point and so the point is dropped instead of
// retrying.
if strings.Contains(desc, errStringPartialWrite) {
log.Printf("E! [outputs.influxdb]: when writing to [%s]: received error %v; discarding points",
c.URL(), desc)
return nil
}
// This error indicates a bug in either Telegraf line protocol
// serialization, retries would not be successful.
if strings.Contains(desc, errStringUnableToParse) {
log.Printf("E! [outputs.influxdb]: when writing to [%s]: received error %v; discarding points",
c.URL(), desc)
return nil
}

@glinton
Copy link
Contributor Author

glinton commented Sep 28, 2018

That seems quite brittle, but good point. This depends on #4743 as the errors returned from the parser doesn't return the proper errors:

# telegraf
$ curl -XPOST 'http://telegraf:8086/write' --data-binary 'cpu value='
{"error":"metric parse error: expected field at offset 10: \"cpu value=\""}

$ echo -e "cpu value=84\ncpu value=" | curl 'http://telegraf:8086/write?db=telegraf' --data-binary @-
{"error":"metric parse error: expected field at offset 23: \"cpu value=84\\ncpu value=\\n\""}


# influx
$ curl -i -XPOST 'http://influx:8086/write?db=telegraf' --data-binary 'cpu value='
{"error":"unable to parse 'cpu value=': missing field value"}

$ echo -e "cpu value=84\ncpu value=" | curl -i 'http://influx:8086/write?db=telegraf' --data-binary @-
{"error":"partial write: unable to parse 'cpu value=': missing field value dropped=0"}

Should we also require a db to be set? Writing to influx at /write returns {"error":"database is required"}.

@danielnelson danielnelson added this to the 1.8.1 milestone Sep 28, 2018
@danielnelson danielnelson added the fix pr to fix corresponding bug label Oct 1, 2018
@danielnelson danielnelson merged commit 11baebd into master Oct 1, 2018
@danielnelson danielnelson deleted the bugfix/4742 branch October 1, 2018 23:14
danielnelson pushed a commit that referenced this pull request Oct 1, 2018
rgitzel pushed a commit to rgitzel/telegraf that referenced this pull request Oct 17, 2018
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants