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

Check for partial failures when posting to /v1/measurements #16

Open
tillberg opened this issue Jan 9, 2018 · 1 comment
Open

Check for partial failures when posting to /v1/measurements #16

tillberg opened this issue Jan 9, 2018 · 1 comment
Labels
Milestone

Comments

@tillberg
Copy link
Contributor

tillberg commented Jan 9, 2018

The measurements API can return a 202 when there's a partial failure. This is not currently captured by the error handling in the client.

We should probably check for the x-partial-failure header in addition to the response status code, and log or return an error as appropriate; the current behavior is to ignore these partial failures, which leads to the user discovering on their own that the invalid measurements are just missing.

For example, for this post with two measurements, one valid (with a tag) and one invalid:

$ curl \
...
  -d '{
    "measurements": [{"name": "test", "value": 1, "tags": {"hi":"hi"}},{"name": "test", "value": 2}]
  }' -i \
  -X POST \
  https://metrics-api.librato.com/v1/measurements                                                  
HTTP/2 202 
...
x-partial-failure: true
x-librato-ratelimit-agg: limit=2400000,remaining=2086687,reset=1515519000
x-librato-ratelimit-std: limit=600000,remaining=353107,reset=1515519000
...
{"measurements":{"summary":{"total":2,"accepted":1,"failed":1,"filtered":0}},"errors":[{"param":"tags","reason":"Must have at least one tag"}]}
@trevrosen trevrosen added the bug label Jan 9, 2018
@trevrosen trevrosen self-assigned this Jan 9, 2018
@trevrosen
Copy link
Contributor

Good catch. Filing this as a bug since it can lead to unexpected results.

@trevrosen trevrosen modified the milestones: 0.2.0, 0.3.0 Jan 9, 2018
@trevrosen trevrosen removed their assignment Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants