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

Clarify and clean up template contract for status #149

Merged
merged 4 commits into from
Mar 30, 2022

Conversation

colega
Copy link
Contributor

@colega colega commented Mar 29, 2022

What this PR does:

Ring was passing a mix of time.Time and formatted string for the time: unified to pass always time.Time, and decide what to do when rendering. This will allow us some extra customisation if replacing the template with a non-default one.

Also replaced the "Unhealthy" state by "UNHEALTHY" in the template, because the rest of states are uppercase. Not replacing the constant value because it's being used for metrics and we'd have to fix the recording rules in all the downstream projects.

Changed how heartbeat time is rendered: rendering the duration since the heartbeat and the time in parenthesis: heartbeats are so common that showing a date doesn't make sense, and since they're usually few seconds away, the "duration ago" is what makes more sense IMO.

Which issue(s) this PR fixes:

Relates to #148

Checklist

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Ring was passing a mix of time.Time and formatted string for the time:
unified to pass always time.Time, and decide what to do when rendering.
This will allow us some extra customisation if replacing the template
with a non-default one.

Also replaced the "Unhealthy" state by "UNHEALTHY" in the template,
because the rest of states are uppercase. Not replacing the constant
value because it's being used for metrics and we'd have to fix the
recording rules in all the downstream projects.

Changed how heartbeat time is rendered: rendering the duration since the
heartbeat and the time in parenthesis: heartbeats are so common that
showing a date doesn't make sense, and since they're usually few seconds
away, the "duration ago" is what makes more sense IMO.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega requested a review from pracucci March 29, 2022 16:29
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega force-pushed the clean-up-template-contract branch from de8e589 to 0b963d9 Compare March 29, 2022 16:30
Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

kv/memberlist/kv_init_service.go Show resolved Hide resolved
We don't need 4

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega merged commit 8de36ff into main Mar 30, 2022
@colega colega deleted the clean-up-template-contract branch March 30, 2022 07:52
@@ -22,6 +22,7 @@
* [CHANGE] ring/client: It's now possible to set different value than `consul` as default KV store. #120
* [CHANGE] Lifecycler: Default value of lifecycler's `final-sleep` is now `0s` (i.e. no sleep). #121
* [CHANGE] Lifecycler: It's now possible to change default value of lifecycler's `final-sleep`. #121
* [CHANGE] Minor cosmetic changes in ring and memberlist HTTP status templates. #149
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a breaking change? Looks like the output is for humans.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is definitely not breaking, but it's a change. Would you prefer this to be an [ENHANCEMENT]?

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

Successfully merging this pull request may close these issues.

3 participants