-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1473 from glogiotatidis/issue-1446
[Fix #1446] Move Channel targeting in the browser.
- Loading branch information
Showing
22 changed files
with
279 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ Date: 2020-03-31 | |
|
||
## Status | ||
|
||
Accepted | ||
Replaced by ADR 0007. | ||
|
||
## Context | ||
|
||
|
29 changes: 29 additions & 0 deletions
29
docs/architecture/decisions/0007-move-channel-targeting-to-browser.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 7. Move Channel targeting to browser. | ||
|
||
Date: 2020-11-12 | ||
|
||
## Status | ||
|
||
Accepted | ||
|
||
## Context | ||
|
||
We want to be able to create more complex Targets, specifically targets that | ||
will evaluate to true for Profiles older than X weeks with X being different for | ||
each channel. | ||
|
||
The requirement comes from an initiative to reduce the number of active Jobs per week and thus reduce the programming and analyzing time required. With this change we will be able to schedule one Job for multiple channels while maintaining different targeting for each channel. | ||
|
||
|
||
## Decision | ||
|
||
We decide to move Channel targeting from the server to the browser. To accomplish this we will take advantage of `browser.update.channel` JEXL attribute to target snippets based on channel and remove any server side code that does channel targeting. | ||
|
||
We will generate one bundle for each locale, instead of one bundle for each locale, channel combination. | ||
|
||
This ADR replaces 0006 since all Jobs for locale will be included in all channels. | ||
|
||
|
||
## Consequences | ||
|
||
CDN traffic is expected to increase since bundles are going to include Job from all channels of a locale. The increase is not expected to be significant because traditionally most Jobs are on Release channel and it's the Release that generates from of the traffic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.2.13 on 2020-10-26 10:28 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('base', '0043_auto_20201104_0811'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='target', | ||
name='filtr_channels', | ||
field=models.CharField(default='release;', max_length=255), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 2.2.13 on 2020-10-26 12:55 | ||
|
||
from django.db import migrations | ||
from django.db.models import Q | ||
|
||
def forwards(apps, schema_editor): | ||
Target = apps.get_model('base', 'Target') | ||
from snippets.base.forms import TargetAdminForm | ||
for target in Target.objects.filter( | ||
Q(on_release=True) | \ | ||
Q(on_esr=True) | \ | ||
Q(on_beta=True) | \ | ||
Q(on_aurora=True) | \ | ||
Q(on_nightly=True)): | ||
|
||
value = '' | ||
for key in ['release', 'esr', 'beta', 'aurora', 'nightly']: | ||
if getattr(target, f'on_{key}', False): | ||
value += f'{key};' | ||
value = value.strip(';') | ||
|
||
target.filtr_channels = value | ||
f = TargetAdminForm(instance=target) | ||
target.jexl_expr = f.generate_jexl_expr(f.initial) | ||
target.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('base', '0044_target_filtr_channel'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(forwards), | ||
] |
Oops, something went wrong.