Commit graph

10 commits

Author SHA1 Message Date
Andrew Newdigate
4f4de36cac Migrate correlation and tracing code to LabKit
This change is a fairly straightforward refactor to extract the tracing
and correlation-id code from the gitlab rails codebase into the new
LabKit-Ruby project.

The corresponding import into LabKit-Ruby was in
https://gitlab.com/gitlab-org/labkit-ruby/merge_requests/1

The code itself remains very similar for now.

Extracting it allows us to reuse it in other projects, such as
Gitaly-Ruby. This will give us the advantages of correlation-ids and
distributed tracing in that project too.
2019-04-18 09:57:16 +02:00
Nick Thomas
452f508143
Fix the last-ditch memory killer pgroup SIGKILL 2019-03-09 13:34:06 +00:00
Nick Thomas
f0c52df5e5 sidekiq: terminate child processes at shutdown
Sidekiq jobs frequently spawn long-lived child processes to do work.
In some circumstances, these can be reparented to init when sidekiq is
terminated, leading to duplication of work and strange concurrency
problems.

This commit changes sidekiq so that, if run as a process group leader,
it will forward `INT` and `TERM` signals to the whole process group. If
the memory killer is active, it will also use the process group when
resorting to `kill -9` to shut down.

These changes mean that a naive `kill <pid-of-sidekiq>` will now do the
right thing, killing any child processes spawned by sidekiq, as long as
the process supervisor placed it in its own process group.

If sidekiq isn't a process group leader, this new code is skipped.
2019-03-04 09:06:41 -08:00
Nick Thomas
adddbf437d
SIGSTP should be SIGTSTP 2019-03-01 10:38:38 +00:00
Nick Thomas
ff431fe076
Revert "Restart Unicorn and Sidekiq when GRPC throws 14:Endpoint read failed"
This reverts commit 006753110a.
2019-02-28 14:45:20 +00:00
Kamil Trzciński
ebb5d9f4db Revert "Prefer to use correlation-id in logs"
This reverts commit 3560b11922.
2018-12-06 21:46:31 +01:00
Kamil Trzciński
3560b11922 Prefer to use correlation-id in logs
This changes `correlation_id` to be `correlation-id` when passed via jobs
2018-12-06 20:49:31 +01:00
Kamil Trzciński
39c1731a53 Log and pass correlation-id between Unicorn, Sidekiq and Gitaly
The Correlation ID is taken or generated from received X-Request-ID.
Then it is being passed to all executed services (sidekiq workers
or gitaly calls).

The Correlation ID is logged in all structured logs as `correlation_id`.
2018-12-06 20:46:14 +01:00
Jacob Vosmaer (GitLab)
006753110a Restart Unicorn and Sidekiq when GRPC throws 14:Endpoint read failed 2018-02-26 09:54:20 +00:00
Douwe Maan
ccb5bad6b8 Send SIGSTP before SIGTERM to actually give Sidekiq jobs 30s to finish when the memory killer kicks in 2017-11-02 15:33:19 +01:00