feat: Resume Covered Experiences
Resolves gitlab-com/gl-infra/observability/team#4161 (closed).
With the features implemented in this MR, we'll be able to serialize Covered Experiences to Sidekiq jobs. This gives us the functionality to start an experience via an HTTP request served by Rails, and resume and complete it in a Sidekiq job. A real use case example of how this is being used can be seen in the downstream MR.
Guardrails have been included to avoid leaking experiences to other threads while processing a request or job.
In the future, we can use the same strategy to serialize experiences between HTTP services using an HTTP header. This is quite simple to add now with all the supporting code implemented for Sidekiq jobs, but I opted not to add it in this MR because we don't have an immediate use.
Demo: https://youtu.be/QZTSk12gmuI
-
Resumes a previously started covered experience -
New RSpec matcher resume_covered_experience -
Sidekiq middlewares for serializing and deserializing covered experiences to jobs -
Optionally configure the registry path -
Labkit::CoveredExperience::Currentto keep track of started experiences and clean up between requests and jobs