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

Gracefully handle shutdowns #19

Closed
Tracked by #5
Pokom opened this issue Nov 30, 2023 · 0 comments · Fixed by #117
Closed
Tracked by #5

Gracefully handle shutdowns #19

Pokom opened this issue Nov 30, 2023 · 0 comments · Fixed by #117
Assignees
Labels
good first issue Good for newcomers

Comments

@Pokom
Copy link
Contributor

Pokom commented Nov 30, 2023

In the exporter.go, we launch our webserver and do not gracefully handle shutdowns:

if err = http.ListenAndServe(cfg.Server.Address, nil); err != nil {
log.Printf("Error listening and serving: %s", err)
os.Exit(1)
}

The implications is that if k8s decides to shutdown the application mid scrape, the process will just shutdown before the scrape can finish. We should add a signal handler that listens for sigterm and sigexit signals and propagate the cancel through the contexts. If you're not familiar with this, check out this stackoverflow answer: https://stackoverflow.com/a/40041517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants