diff options
Diffstat (limited to 'tools/metrics/rappor')
-rwxr-xr-x | tools/metrics/rappor/pretty_print.py | 21 | ||||
-rwxr-xr-x | tools/metrics/rappor/pretty_print_test.py | 7 | ||||
-rw-r--r-- | tools/metrics/rappor/rappor.xml | 21 |
3 files changed, 35 insertions, 14 deletions
diff --git a/tools/metrics/rappor/pretty_print.py b/tools/metrics/rappor/pretty_print.py index f88e1c3..b5b1ba3 100755 --- a/tools/metrics/rappor/pretty_print.py +++ b/tools/metrics/rappor/pretty_print.py @@ -15,18 +15,25 @@ import presubmit_util # Model definitions for rappor.xml content _SUMMARY_TYPE = models.TextNodeType('summary') +_NOISE_ATTRIBUTES = [ + 'fake-prob', + 'fake-one-prob', + 'one-coin-prob', + 'zero-coin-prob', +] + +_STRING_NOISE_TYPE = models.ObjectNodeType('string-noise', + float_attributes=_NOISE_ATTRIBUTES) + +_FLAG_NOISE_TYPE = models.ObjectNodeType('flag-noise', + float_attributes=_NOISE_ATTRIBUTES) + _PARAMETERS_TYPE = models.ObjectNodeType('parameters', int_attributes=[ 'num-cohorts', 'bytes', 'hash-functions', ], - float_attributes=[ - 'fake-prob', - 'fake-one-prob', - 'one-coin-prob', - 'zero-coin-prob', - ], string_attributes=[ 'reporting-level' ]) @@ -37,6 +44,8 @@ _RAPPOR_PARAMETERS_TYPE = models.ObjectNodeType('rappor-parameters', children=[ models.ChildType('summary', _SUMMARY_TYPE, False), models.ChildType('parameters', _PARAMETERS_TYPE, False), + models.ChildType('stringNoise', _STRING_NOISE_TYPE, False), + models.ChildType('flagNoise', _FLAG_NOISE_TYPE, False), ]) _RAPPOR_PARAMETERS_TYPES_TYPE = models.ObjectNodeType('rappor-parameter-types', diff --git a/tools/metrics/rappor/pretty_print_test.py b/tools/metrics/rappor/pretty_print_test.py index f69b7df..58478dd 100755 --- a/tools/metrics/rappor/pretty_print_test.py +++ b/tools/metrics/rappor/pretty_print_test.py @@ -21,9 +21,12 @@ PRETTY_XML = """ <summary> Fake type for tests. </summary> - <parameters num-cohorts="128" bytes="1" hash-functions="2" fake-prob="0.5" - fake-one-prob="0.5" one-coin-prob="0.75" zero-coin-prob="0.25" + <parameters num-cohorts="128" bytes="1" hash-functions="2" reporting-level="COARSE"/> + <string-noise fake-prob="0.5" fake-one-prob="0.5" one-coin-prob="0.75" + zero-coin-prob="0.25"/> + <flag-noise fake-prob="0.5" fake-one-prob="0.75" one-coin-prob="0.875" + zero-coin-prob="0.125"/> </rappor-parameters> </rappor-parameter-types> diff --git a/tools/metrics/rappor/rappor.xml b/tools/metrics/rappor/rappor.xml index f457557..a577c1e 100644 --- a/tools/metrics/rappor/rappor.xml +++ b/tools/metrics/rappor/rappor.xml @@ -23,9 +23,12 @@ components/rappor/rappor_service.cc. <summary> Stricter parameters for metrics collected from a broader population. </summary> - <parameters num-cohorts="128" bytes="1" hash-functions="2" fake-prob="0.5" - fake-one-prob="0.5" one-coin-prob="0.75" zero-coin-prob="0.25" + <parameters num-cohorts="128" bytes="1" hash-functions="2" reporting-level="COARSE"/> + <string-noise fake-prob="0.5" fake-one-prob="0.5" one-coin-prob="0.75" + zero-coin-prob="0.25"/> + <flag-noise fake-prob="0.25" fake-one-prob="0.5" one-coin-prob="0.875" + zero-coin-prob="0.125"/> </rappor-parameters> <rappor-parameters name="ETLD_PLUS_ONE"> @@ -33,18 +36,24 @@ components/rappor/rappor_service.cc. Deprecated parameters for collecting the domain and registry of a URL from UMA opt-in users. </summary> - <parameters num-cohorts="128" bytes="16" hash-functions="2" fake-prob="0.5" - fake-one-prob="0.5" one-coin-prob="0.75" zero-coin-prob="0.25" + <parameters num-cohorts="128" bytes="16" hash-functions="2" reporting-level="FINE"/> + <string-noise fake-prob="0.5" fake-one-prob="0.5" one-coin-prob="0.75" + zero-coin-prob="0.25"/> + <flag-noise fake-prob="0.25" fake-one-prob="0.5" one-coin-prob="0.875" + zero-coin-prob="0.125"/> </rappor-parameters> <rappor-parameters name="UMA_RAPPOR_TYPE"> <summary> Parameters suitable for metrics from UMA opt-in users. </summary> - <parameters num-cohorts="128" bytes="4" hash-functions="2" fake-prob="0.5" - fake-one-prob="0.5" one-coin-prob="0.75" zero-coin-prob="0.25" + <parameters num-cohorts="128" bytes="4" hash-functions="2" reporting-level="FINE"/> + <string-noise fake-prob="0.5" fake-one-prob="0.5" one-coin-prob="0.75" + zero-coin-prob="0.25"/> + <flag-noise fake-prob="0.25" fake-one-prob="0.5" one-coin-prob="0.875" + zero-coin-prob="0.125"/> </rappor-parameters> </rappor-parameter-types> |