diff --git a/toolkit/components/telemetry/gen_event_data.py b/toolkit/components/telemetry/gen_event_data.py index 205d7624a389..2e6dba2ae678 100644 --- a/toolkit/components/telemetry/gen_event_data.py +++ b/toolkit/components/telemetry/gen_event_data.py @@ -138,7 +138,7 @@ def generate_JSON_definitions(output, *filenames): 'methods': event.methods, 'objects': event.objects, 'extra_keys': event.extra_keys, - 'record_on_release': True if event.dataset == 'opt-out' else False, + 'record_on_release': True if event.dataset_short == 'opt-out' else False, # We don't expire dynamic-builtin scalars: they're only meant for # use in local developer builds anyway. They will expire when rebuilding. 'expired': False, diff --git a/toolkit/components/telemetry/gen_scalar_data.py b/toolkit/components/telemetry/gen_scalar_data.py index e8948266981d..45e1c82cefee 100644 --- a/toolkit/components/telemetry/gen_scalar_data.py +++ b/toolkit/components/telemetry/gen_scalar_data.py @@ -110,7 +110,7 @@ def generate_JSON_definitions(output, *filenames): scalar_definitions[category][scalar.name] = OrderedDict({ 'kind': scalar.nsITelemetry_kind, 'keyed': scalar.keyed, - 'record_on_release': True if scalar.dataset == 'opt-out' else False, + 'record_on_release': True if scalar.dataset_short == 'opt-out' else False, # We don't expire dynamic-builtin scalars: they're only meant for # use in local developer builds anyway. They will expire when rebuilding. 'expired': False, diff --git a/toolkit/components/telemetry/parse_events.py b/toolkit/components/telemetry/parse_events.py index 416fa5ee2f55..59c0ecb98d56 100644 --- a/toolkit/components/telemetry/parse_events.py +++ b/toolkit/components/telemetry/parse_events.py @@ -271,12 +271,20 @@ class EventData: def dataset(self): """Get the nsITelemetry constant equivalent for release_channel_collection. """ - rcc = self._definition.get('release_channel_collection', 'opt-in') + rcc = self.dataset_short if rcc == 'opt-out': return 'nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT' else: return 'nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN' + @property + def dataset_short(self): + """Get the short name of the chosen release channel collection policy for the event. + """ + # The collection policy is optional, but we still define a default + # behaviour for it. + return self._definition.get('release_channel_collection', 'opt-in') + @property def extra_keys(self): return self._definition.get('extra_keys', {}).keys() diff --git a/toolkit/components/telemetry/parse_scalars.py b/toolkit/components/telemetry/parse_scalars.py index 911111c8bd35..37caf3ec4ac2 100755 --- a/toolkit/components/telemetry/parse_scalars.py +++ b/toolkit/components/telemetry/parse_scalars.py @@ -276,18 +276,24 @@ class ScalarType: @property def dataset(self): - """Get the nsITelemetry constant equivalent to the chose release channel collection + """Get the nsITelemetry constant equivalent to the chosen release channel collection policy for the scalar. """ - # The collection policy is optional, but we still define a default - # behaviour for it. - rcc = self._definition.get('release_channel_collection', 'opt-in') + rcc = self.dataset_short table = { 'opt-in': 'OPTIN', 'opt-out': 'OPTOUT', } return 'nsITelemetry::DATASET_RELEASE_CHANNEL_' + table[rcc] + @property + def dataset_short(self): + """Get the short name of the chosen release channel collection policy for the scalar. + """ + # The collection policy is optional, but we still define a default + # behaviour for it. + return self._definition.get('release_channel_collection', 'opt-in') + @property def cpp_guard(self): """Get the cpp guard for this scalar"""