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

Human-friendly Duration serialization is not backwards-compatible #257

Closed
jutley opened this issue Sep 11, 2020 · 3 comments
Closed

Human-friendly Duration serialization is not backwards-compatible #257

jutley opened this issue Sep 11, 2020 · 3 comments

Comments

@jutley
Copy link

jutley commented Sep 11, 2020

Recently, there have been changes to Duration to allow mixed units, e.g. 1h30m. When durations are serialized, they will include mixed units. This change will break older clients which do not know how to deserialize mixed unit durations. They will get an error that looks like not a valid duration string: "1h30m".

I think it would be a better implementation to serialize durations in a way that uses a single unit. This maintains backwards compatibility.

@brian-brazil
Copy link
Contributor

Can you explain what this broke in Prometheus itself? I don't think we ever read back in these values, so this shouldn't be an issue.

@jutley
Copy link
Author

jutley commented Sep 15, 2020

I don't believe anything broke specifically within Prometheus. In our case, we use cortextool, which uses this library for parsing durations returned by a Prometheus/Cortex rules API. If Prometheus/Cortex is on a version with the new duration format and returns a mixed-unit duration, cortextool is unable to parse them.

At this point, cortextool has been updated, so it's not directly an issue for us anymore. I'm not sure how many other projects will have this issue, or whether compatibility for projects outside of the prometheus org is even a concern for this library.

Regardless, I think it's important to at least file this issue for discoverability in case someone else encounters this behavior.

@roidelapluie
Copy link
Member

Thanks for your input. As it looks like there is no issue within Prometheus I'll close this. It does not seem the right repo for a placeholder issue like this, and cortex has released since.

alanprot pushed a commit to alanprot/common that referenced this issue Mar 15, 2023
This adds `Flush()` to the `middleware.badResponseLoggingWriter`, making it implement `http.Flusher` if the wrapped `http.ResponseWriter` does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants