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

Implement /-/reload #493

Merged
merged 10 commits into from
Mar 31, 2021
Merged

Implement /-/reload #493

merged 10 commits into from
Mar 31, 2021

Conversation

rfratto
Copy link
Member

@rfratto rfratto commented Mar 26, 2021

PR Description

Adds /-/reload. Supporting this change required ensuring that Entrypoint.Run doesn't exit when re-creating the server.

Which issue(s) this PR fixes

Closes #147 (finally!)

Notes to the Reviewer

PR Checklist

  • CHANGELOG updated
  • Documentation added
  • Tests updated

@rfratto
Copy link
Member Author

rfratto commented Mar 29, 2021

I've moved the handling of the server recreation logic to a new package, which helped a bit. I'll do a little more thinking about if it can be simplified tomorrow, and then test it one more time before opening this up for review.

@rfratto rfratto requested a review from mattdurham March 30, 2021 13:45
@rfratto rfratto marked this pull request as ready for review March 30, 2021 13:45
cmd/agent/entrypoint.go Outdated Show resolved Hide resolved
cmd/agent/entrypoint.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattdurham mattdurham left a comment

Choose a reason for hiding this comment

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

Tested with tls and had some feedback on documentation. Ran through the code and tried calling the reload config endpoint with a variety of valid and invalid configs without issues. Did parallels calls to reload on both the primary and reload-port around 10k times with no observed memory leak or issues.

docs/api.md Outdated
server, as restarting it will prevent an HTTP client from reading the response
of the reload. Instead, use the `--reload-addr` and `--reload-port` flags
supported by the Agent. That will launch a secondary HTTP server that only
responds to `/-/reload` and can be used to safely reload the system.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it make sense to disable reload on the "primary" server if --reload-* is passed in?

Copy link
Member Author

Choose a reason for hiding this comment

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

🤷‍♂️ I'm okay with leaving them both open and just recommend not using the primary server. I can see both arguments here though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Going to leave this as-is for now and let's come back later to see if we want to restrict it.

@rfratto rfratto merged commit 484dd4d into grafana:main Mar 31, 2021
@rfratto rfratto deleted the reload branch March 31, 2021 17:29
@rfratto rfratto mentioned this pull request Mar 31, 2021
3 tasks
@mattdurham mattdurham mentioned this pull request Sep 7, 2021
3 tasks
mattdurham pushed a commit that referenced this pull request Nov 11, 2021
* implement /-/reload

* move reloading server to a new server util package

* documentation

* more docs

* fix bug in util/server

* move unregisterer to util/server

* document logger propagation

* remove weird log propagation hack

* remove go-cmp and defer to yaml comparison

* document reload server constraints
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Apr 15, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Prometheus /-/reload endpoint
2 participants