-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[PRW 2.0] rc.2 (breaking change): Added required response headers for durability. #2486
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
Conversation
Fixes: prometheus/prometheus#14359 Signed-off-by: bwplotka <bwplotka@gmail.com>
Co-authored-by: Callum Styan <callumstyan@gmail.com> Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
* Added summary on top. * Be precise on 2xx / 204 status codes. * Simplified response header section * Removed eventual durability case, with "accepted" wording that's obvious. * Grammarly Signed-off-by: bwplotka <bwplotka@gmail.com>
Ok, with new wording suggested by @cstyan I was able to simplify the section plus add clear example. Also updated 200 section (we often use 204 No content HTTP status instead, which makes more sense). Changes:
|
Samples OR Histogram Samples not written = error Signed-off-by: bwplotka <bwplotka@gmail.com>
See Receiver prometheus/prometheus#14427 and Sender prometheus/prometheus#14444 implementation with those. Generally it allows Sender to catch common bug AND calculate correct partial error metrics. |
Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
Rdy for final call! |
* Broken 1.0 Receiver implementations: Senders SHOULD assume [415 HTTP Unsupported Media Type](https://www.rfc-editor.org/rfc/rfc9110.html#name-415-unsupported-media-type) status code when sending the data using `io.prometheus.write.v2.Request` request and receiving 2xx HTTP status code, but none of the `X-Prometheus-Remote-Write-Written-*` response headers from the Receiver. This is a common issue for the 1.0 Receivers that do not check the `Content-Type` request header; accidental decoding of the `io.prometheus.write.v2.Request` payload with `prometheus.WriteRequest` schema results in empty result and no decoding errors. | ||
* Unknown broken implementations or issues: Senders MAY use those headers to detect broken Sender and Receiver implementations or other problems. | ||
|
||
On the 2xx HTTP status code, Senders CAN assume that a missing write response header means that no such a piece of data was written by the Receiver (count of `0`). value. One exception is that Senders MUST NOT assume the same (empty header means zero) when using the deprecated `prometheus.WriteRequest` Protobuf Message in the request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the 2xx HTTP status code, Senders CAN assume that a missing write response header means that no such a piece of data was written by the Receiver (count of `0`). value. One exception is that Senders MUST NOT assume the same (empty header means zero) when using the deprecated `prometheus.WriteRequest` Protobuf Message in the request. | |
On the 2xx HTTP status code, Senders CAN assume that a missing write response header means that no such a piece of data was written by the Receiver (count of `0`). One exception is that Senders MUST NOT assume the same (empty header means zero) when using the deprecated `prometheus.WriteRequest` Protobuf Message in the request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can rephrase this for clarity. Something like:
Upon receiving a 2xx HTTP status code with missing write response headers:
- If the Sender used the
io.prometheus.write.v2.Request
schema to encode the request, it CAN assume that no data was written by the Receiver (count of0
).- If the Sender used a deprecated
prometheus.WriteRequest
Protobuf Message, it MUST NOT assume that no data was written by the Receiver (count of0
).
In the second case, should Sender assume the data was written correctly? (I might be missing some context here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
So first case is broader - as there might be more messages in future, but I will check how we can improve.
In the second case, should Sender assume the data was written correctly? (I might be missing some context here).
Correct, there is no way to tell UNLESS you see the header with values for 1.0 message (even if 2.0 receiver was used, we don't know that). I will add example perhaps - might help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, PTAL @thampiotr
Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com> Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com> Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I still think the accepted
wording was okay, it was really ingest/ingested
we needed to remove imo since that implied some kind of persistence which rules out some receivers or at least significantly increases the response time on writes.
Thanks @cstyan I want to make sure you are happy with final wording decision too (: We could switch back to
WDYT? |
I'm not unhappy, but I do think
What about:
And then...
Damn, now I'm just contradicting myself over the course of multiple comments, including this one I am writing right now. I think |
Thanks! I agree Received == Accepted, but the reason we rule out receive fits accepted IMO, so it implies it's NEVER durable write (in practice, it depends on the receiver). Write is universal, it's whatever remote write is for, so best. Ingest is too in the other extreme. Agree it does not read well. What about we imply "write" and have 'X-Prometheus-Remote-Written-Samples'? (: |
The more I think about it, the more I like accepted/received like we had and really focus on this NEVER being durable write count, and always about initial validation/how many samples not rejected.. but then we need rewrite this section a bit for that and perhaps never send them on internal errors (non recoverable?). Tricky. |
description of what `Written` means in the context of the RW2.0 spec. Signed-off-by: Callum Styan <callumstyan@gmail.com>
We switched to |
Fixes: prometheus/prometheus#14359