Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6456c6fa
Commit
6456c6fa
authored
Oct 02, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a paragraph to the experiment guide
About the enabled_for_attribute? method
parent
62c5ce8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
+26
-7
doc/development/experiment_guide/index.md
doc/development/experiment_guide/index.md
+26
-7
No files found.
doc/development/experiment_guide/index.md
View file @
6456c6fa
...
...
@@ -67,25 +67,44 @@ addressed.
```
-
Make the experiment available to the frontend in a controller:
```ruby
before_action do
push_frontend_experiment(:signup_flow)
end
end
```
The above will check whether the experiment is enabled and push the result to the frontend.
You can check the state of the feature flag in JavaScript:
```javascript
import { isExperimentEnabled } from '~/experimentation';
if ( isExperimentEnabled('signupFlow') ) {
// ...
}
```
-
It is also possible to run an experiment outside of the controller scope, for example in a worker:
```ruby
class SomeWorker
def perform
# Check if the experiment is enabled at all (the percentage_of_time_value > 0)
return unless Gitlab::Experimentation.enabled?(:experiment_key)
# Since we cannot access cookies in a worker, we need to bucket models based on a unique, unchanging attribute instead.
# Use the following method to check if the experiment is enabled for a certain attribute, for example a username or email address:
if Gitlab::Experimentation.enabled_for_attribute?(:experiment_key, some_attribute)
# execute experimental code
else
# execute control code
end
end
end
```
1.
Track necessary events. See the
[
telemetry guide
](
../telemetry/index.md
)
for details.
1.
After the merge request is merged, use
[
`chatops`
](
../../ci/chatops/README.md
)
in the
[
appropriate channel
](
../feature_flags/controls.md#communicate-the-change
)
to start the experiment for 10% of the users.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment