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 config.my-cnf hot reload /-/reload #734

Merged
merged 5 commits into from
Jun 15, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mysqld_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ func main() {
http.Handle("/", landingPage)
}
http.HandleFunc("/probe", handleProbe(enabledScrapers, logger))

http.HandleFunc("/-/reload", func(w http.ResponseWriter, r *http.Request) {
if error := c.ReloadConfig(*configMycnf, *mysqldAddress, *mysqldUser, *tlsInsecureSkipVerify, logger); error != nil {
level.Info(logger).Log("msg", "Error reloading host config", "file", *configMycnf, "err", error)
SuperQ marked this conversation as resolved.
Show resolved Hide resolved
return
}
_, _ = w.Write([]byte(`ok`))
})
srv := &http.Server{}
if err := web.ListenAndServe(srv, toolkitFlags, logger); err != nil {
level.Error(logger).Log("msg", "Error starting HTTP server", "err", err)
Expand Down