cmd/worker: catch when the server is about to get killed

And log how long it was alive. This is achieved by catching a SIGTERM
signal. Cloud Run shuts down a container 10s after this signal is sent,
so this allows us to print the state of the server. The hope is that
we can find out why our instance are being killed often.

https://cloud.google.com/run/docs/container-contract#lifecycle

Change-Id: I6df4a96843cf4e82e2c485464afbf440263abcb7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/539775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
1 file changed
tree: 2aaf695651a60b75dd7223bf8967900874fd572c
  1. cmd/
  2. deploy/
  3. devtools/
  4. internal/
  5. terraform/
  6. .dockerignore
  7. .gitignore
  8. all_test.go
  9. checks.bash
  10. config.json.commented
  11. CONTRIBUTING.md
  12. go.mod
  13. go.sum
  14. LICENSE
  15. Makefile
  16. PATENTS
  17. README.md
  18. tools.go
README.md

pkgsite-metrics

This repository contains code that serves pkg.go.dev/metrics.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the time repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/pkgsite-metrics:” in the subject line, so it is easy to find.