Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/development/sidekiq_style_guide.md')
-rw-r--r--doc/development/sidekiq_style_guide.md50
1 files changed, 50 insertions, 0 deletions
diff --git a/doc/development/sidekiq_style_guide.md b/doc/development/sidekiq_style_guide.md
index c181b31f069..d52a3e652e3 100644
--- a/doc/development/sidekiq_style_guide.md
+++ b/doc/development/sidekiq_style_guide.md
@@ -61,6 +61,56 @@ the extra jobs will take resources away from jobs from workers that were already
there, if the resources available to the Sidekiq process handling the namespace
are not adjusted appropriately.
+## Feature Categorization
+
+Each Sidekiq worker, or one of its ancestor classes, must declare a
+`feature_category` attribute. This attribute maps each worker to a feature
+category. This is done for error budgeting, alert routing, and team attribution
+for Sidekiq workers.
+
+The declaration uses the `feature_category` class method, as shown below.
+
+```ruby
+class SomeScheduledTaskWorker
+ include ApplicationWorker
+
+ # Declares that this feature is part of the
+ # `continuous_integration` feature category
+ feature_category :continuous_integration
+
+ # ...
+end
+```
+
+The list of value values can be found in the file `config/feature_categories.yml`.
+This file is, in turn generated from the [`stages.yml` from the GitLab Company Handbook
+source](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/data/stages.yml).
+
+### Updating `config/feature_categories.yml`
+
+Occassionally new features will be added to GitLab stages. When this occurs, you
+can automatically update `config/feature_categories.yml` by running
+`scripts/update-feature-categories`. This script will fetch and parse
+[`stages.yml`](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/data/stages.yml)
+and generare a new version of the file, which needs to be checked into source control.
+
+### Excluding Sidekiq workers from feature categorization
+
+A few Sidekiq workers, that are used across all features, cannot be mapped to a
+single category. These should be declared as such using the `feature_category_not_owned!`
+ declaration, as shown below:
+
+```ruby
+class SomeCrossCuttingConcernWorker
+ include ApplicationWorker
+
+ # Declares that this worker does not map to a feature category
+ feature_category_not_owned!
+
+ # ...
+end
+```
+
## Tests
Each Sidekiq worker must be tested using RSpec, just like any other class. These