Skip to content

Commit

Permalink
Clarify documentation regarding search and storage window
Browse files Browse the repository at this point in the history
The documentation for the feature engagement backend does not mention
in particular the edge cases for how long time back we search or store
data. In particular what 0, 1 and 2+ means for `window` and `storage`.

This CL clarifies this in the documentation, in addition to adding a
comment for the storage part in code.

BUG=None

Change-Id: I69f87e861984e60e61ddf2a2995b78c39d1b77c8
Reviewed-on: https://chromium-review.googlesource.com/773117
Reviewed-by: David Trainor <dtrainor@chromium.org>
Commit-Queue: Tommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516929}
  • Loading branch information
tommynyquist authored and Commit Bot committed Nov 16, 2017
1 parent 32991b3 commit 8e873ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/feature_engagement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,19 @@ all described below:
* `window`
* Search for this occurrences of the event within this window.
* The value must be given as a number of days.
* For value N, the following holds:
* `0` Nothing should be counted.
* `1` |current_day| should be counted.
* `2+` |current_day| plus |N-1| more days should be counted.
* Value client side data type: uint32_t
* `storage`
* Store client side data related to events for this event minimum this
long.
* The value must be given as a number of days.
* For value N, the following holds:
* `0` Nothing should be stored.
* `1` |current_day| should be stored.
* `2+` |current_day| plus |N-1| more days should be stored.
* The value should not exceed 10 years (3650 days).
* Value client side data type: uint32_t
* Whenever a particular event is used by multiple features, the maximum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ bool FeatureConfigEventStorageValidator::ShouldKeep(
return false;

// Too old events should not be kept.
// Storage time of N=0: Nothing should be kept.
// Storage time of N=1: |current_day| should be kept.
// Storage time of N=2+: |current_day| plus |N-1| more days should be kept.
uint32_t longest_storage_time = it->second;
uint32_t age = current_day - event_day;
if (longest_storage_time <= age)
Expand Down

0 comments on commit 8e873ca

Please sign in to comment.