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

Add /ingester/unregister-on-shutdown HTTP endpoint #7739

Conversation

LasseHels
Copy link
Contributor

@LasseHels LasseHels commented Mar 27, 2024

What this PR does

This pull request adds a HTTP /ingester/unregister-on-shutdown endpoint to ingesters. The endpoint was originally conceived here and has a formal proposal document here.

Which issue(s) this PR fixes or relates to

Fixes #5901.

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features. I'm not sure if this is an experimental feature?

@LasseHels
Copy link
Contributor Author

LasseHels commented Mar 27, 2024

The original proposal suggested an /ingester/unregister-on-shutdown name for the endpoint. I've only now realised that this is probably a terrible name, as the term shutdown carries a specific meaning in the context of ingesters.

The name /ingester/unregister-on-shutdown invites operators to erroneously believe that the endpoint controls whether the endpoint unregisters from the ring on its next shutdown, as opposed to its next termination. A shutdown is a termination, but a termination is not necessarily a shutdown, and the distinction is important.

Ingesters already have an /ingester/shutdown endpoint, and I think it's important that the unregister endpoint explicitly conveys that it is not related specifically to shutdowns, but more generally to any kind of graceful termination.

I'll give some thought to a better name. Currently, I am partial to a name like /ingester/unregister-on-termination.

@LasseHels
Copy link
Contributor Author

LasseHels commented Apr 2, 2024

After giving it some thought, I think I prefer the original /ingester/unregister-on-shutdown name. While it is true that the term "shutdown" is ambiguous in the context of ingesters, "unregister-on-shutdown" is at least consistent with the name of the -ingester.ring.unregister-on-shutdown configuration option.

Having an endpoint called /ingester/unregister-on-termination that manipulates a -ingester.ring.unregister-on-shutdown configuration option is likely more confusing than re-using the technically incorrect but semantically consistent "shutdown" term.

I expect much of this ambiguity can be clarified in the endpoint's documentation, and I will attempt to do so.

Opinions on the name of the endpoint are welcome.

@dimitarvdimitrov
Copy link
Contributor

my 2c: Mimir has already conflated scaledown with shutdown (e.g. -ingester.ring.unregister-on-shutdown vs POST /ingester/shutdown vs POST /ingester/prepare-shutdown). Your decision to keep /ingester/unregister-on-shutdown makes sense to me

@LasseHels LasseHels marked this pull request as ready for review April 5, 2024 07:39
@LasseHels LasseHels requested review from jdbaldry and a team as code owners April 5, 2024 07:39
@LasseHels
Copy link
Contributor Author

We are still in the process of testing out a crude implementation of this endpoint in our cluster. Since that is expected to take some time, I figured the review of this feature could be performed in parallel.

@LasseHels LasseHels changed the title WIP: Add /ingester/unregister-on-shutdown HTTP endpoint Add /ingester/unregister-on-shutdown HTTP endpoint Apr 5, 2024
Copy link
Member

@jdbaldry jdbaldry left a comment

Choose a reason for hiding this comment

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

docs lgtm

docs/sources/mimir/references/http-api/index.md Outdated Show resolved Hide resolved
@LasseHels
Copy link
Contributor Author

@dimitarvdimitrov It would be great if we could proceed with the review of this change. I'm not sure who to ping (or who can review) so I am reaching out to you as you've been previously involved with the issue.

@LasseHels
Copy link
Contributor Author

@dimitarvdimitrov Any update on the review status of this pull request? I'd be happy to reach out to someone else from the Mimir team in case you're not the right person to review this.

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.

Thank you for your work on this. I'd suggest to simplify the handler code, and fix mismatch in HTTP method names (endpoint is registered with POST but reacts on PUT).

docs/sources/mimir/references/http-api/index.md Outdated Show resolved Hide resolved
pkg/api/api.go Outdated Show resolved Hide resolved
pkg/ingester/ingester.go Outdated Show resolved Hide resolved
pkg/ingester/ingester.go Outdated Show resolved Hide resolved
pkg/ingester/ingester_test.go Outdated Show resolved Hide resolved
pkg/ingester/ingester_test.go Outdated Show resolved Hide resolved
pkg/ingester/ingester_test.go Outdated Show resolved Hide resolved
pkg/ingester/ingester_test.go Outdated Show resolved Hide resolved
pkg/ingester/ingester_test.go Outdated Show resolved Hide resolved
@LasseHels
Copy link
Contributor Author

@pstibrany Thanks for reviewing! With your suggestions, the diff is now much leaner. I've addressed all comments. Feel free to take another look.

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.

Thank you very much for addressing my feedback and very clear explanation of taken actions! Let's fix the changelog entry (my bad that I missed in previous review), and we can merge it.

CHANGELOG.md Outdated Show resolved Hide resolved
pkg/ingester/ingester_test.go Outdated Show resolved Hide resolved
@pstibrany pstibrany merged commit 5518c5b into grafana:main Apr 24, 2024
29 checks passed
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.

Unregister ingesters on shutdown unless an update is being rolled out
4 participants